mirror of
https://github.com/aljazceru/chatgpt-telegram-bot.git
synced 2025-12-20 06:05:12 +01:00
added youtube audio extractor, dice, and direct response for images
This commit is contained in:
38
bot/plugins/dice.py
Normal file
38
bot/plugins/dice.py
Normal file
@@ -0,0 +1,38 @@
|
||||
from typing import Dict
|
||||
|
||||
from .plugin import Plugin
|
||||
|
||||
|
||||
class DicePlugin(Plugin):
|
||||
"""
|
||||
A plugin to send a die in the chat
|
||||
"""
|
||||
def get_source_name(self) -> str:
|
||||
return "Dice"
|
||||
|
||||
def get_spec(self) -> [Dict]:
|
||||
return [{
|
||||
"name": "send_dice",
|
||||
"description": "Send a dice in the chat, with a random number between 1 and 6",
|
||||
"parameters": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"emoji": {
|
||||
"type": "string",
|
||||
"enum": ["🎲", "🎯", "🏀", "⚽", "🎳", "🎰"],
|
||||
"description": "Emoji on which the dice throw animation is based."
|
||||
"Dice can have values 1-6 for “🎲”, “🎯” and “🎳”, values 1-5 for “🏀” "
|
||||
"and “⚽”, and values 1-64 for “🎰”. Defaults to “🎲”.",
|
||||
}
|
||||
},
|
||||
},
|
||||
}]
|
||||
|
||||
async def execute(self, function_name, **kwargs) -> Dict:
|
||||
return {
|
||||
'direct_result': {
|
||||
'kind': 'dice',
|
||||
'format': 'dice',
|
||||
'value': kwargs.get('emoji', '🎲')
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user