可以使用discord.py在Discord论坛的主题中添加反应或编辑标签吗?

huangapple go评论78阅读模式
英文:

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('✅')

huangapple
  • 本文由 发表于 2023年4月17日 23:10:16
  • 转载请务必保留本文链接:https://go.coder-hub.com/76036630.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定