mirror of
https://github.com/aljazceru/chatgpt-telegram-bot.git
synced 2025-12-18 21:25:10 +01:00
39 lines
1.3 KiB
Python
39 lines
1.3 KiB
Python
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', '🎲')
|
|
}
|
|
}
|