英文:
Is i possible to add reactions or edit tags in threads in forums with discord.py?
问题
I have a discord bot that edits every new thread created to keep them organized on the same format, so whenever a new thread is created, it checks if it's on the correct format, and if it's not, it will edit the name to "Request #correct_request_number".
This part works perfectly, but I wanted to know if it's possible to edit the tags, or add reactions in threads, like the setting that allows us to choose a reaction that will be added to every new thread, the point is that I wanted it to add different reactions depending on some conditions like if the thread name was correct or needed to be edited
I tried this to add reactions, but I got an error saying thread does not have the add_reaction attribute
@bot.event async def on_thread_create(thread): await thread.add_reaction('✅')
Any other method to do it?
英文:
I have a discord bot that edits every new thread created to keep them organized on the same format, so whenever a new thread is created, it checks if it's on the correct format, and if it's not, it will edit the name to "Request #correct_request_number".
This part works perfectly, but I wanted to know if it's possible to edit the tags, or add reactions in threads, like the setting that allows us to choose a reaction that will be added to every new thread, the point is that I wanted it to add different reactions depending on some conditions like if the thread name was correct or needed to be edited
I tried this to add reactions, but I got an error saying thread does not have the add_reaction attribute
@bot.event
async def on_thread_create(thread):
await thread.add_reaction('✅')
Any other method to do it?
答案1
得分: 1
请注意,论坛帖子没有反应。在论坛菜单中显示的反应对应于添加到帖子初始消息的那些反应。因此,您应该使用 Thread.starter_message 来运行您的任务:
@bot.event
async def on_thread_create(thread):
await thread.starter_message.add_reaction('✅')
英文:
Note that a forum thread has no reactions. The reactions that are displayed in the forum menu correspond to those added to the thread's initial message. So, you should use Thread.starter_message to run your task:
@bot.event
async def on_thread_create(thread):
await thread.starter_message.add_reaction('✅')
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论