FIxed stuff

This commit is contained in:
Paillat
2023-07-16 17:11:24 +02:00
parent 4f9a7eb0a6
commit 6c404c3803
4 changed files with 179 additions and 41 deletions

View File

@@ -1,5 +1,78 @@
import discord
functions = [
{
"name": "add_reaction_to_last_message",
"description": "React to the last message sent by the user with an emoji.",
"parameters": {
"type": "object",
"properties": {
"emoji": {
"type": "string",
"description": "an emoji to react with, only one emoji is supported"
},
"message": {
"type": "string",
"description": "Your message"
}
},
"required": ["emoji"]
}
},
{
"name": "reply_to_last_message",
"description": "Reply to the last message sent by the user.",
"parameters": {
"type": "object",
"properties": {
"message": {
"type": "string",
"description": "Your message"
}
},
"required": ["message"]
}
},
{
"name": "send_a_stock_image",
"description": "Send a stock image in the channel.",
"parameters": {
"type": "object",
"properties": {
"query": {
"type": "string",
"description": "The query to search for, words separated by spaces"
},
"message": {
"type": "string",
"description": "Your message to send with the image"
}
},
"required": ["query"]
}
}
]
server_normal_channel_functions = [
{
"name": "create_a_thread",
"description": "Create a thread in the channel. Use this if you see a long discussion coming.",
"parameters": {
"type": "object",
"properties": {
"name": {
"type": "string",
"description": "The name of the thread"
},
"message": {
"type": "string",
"description": "Your message to send with the thread"
}
},
"required": ["name", "message"]
}
},
]
unsplash_random_image_url = "https://source.unsplash.com/random/1920x1080"
async def add_reaction_to_last_message(message_to_react_to: discord.Message, emoji, message=""):
if message == "":
@@ -17,4 +90,8 @@ async def send_a_stock_image(message_in_channel_in_wich_to_send: discord.Message
await message_in_channel_in_wich_to_send.channel.send(f"https://source.unsplash.com/random/1920x1080?{query}")
else:
await message_in_channel_in_wich_to_send.channel.send(message)
await message_in_channel_in_wich_to_send.channel.send(f"https://source.unsplash.com/random/1920x1080?{query}")
await message_in_channel_in_wich_to_send.channel.send(f"https://source.unsplash.com/random/1920x1080?{query}")
async def create_a_thread(channel_in_which_to_create_the_thread: discord.TextChannel, name: str, message: str):
msg = await channel_in_which_to_create_the_thread.send(message)
await msg.create_thread(name=name)