Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import disnake
- from disnake.ext import commands
- class BookCreationEvents(commands.Cog):
- def __init__(self,bot):
- self.bot = bot
- @commands.Cog.listener()
- async def on_thread_create(self,thread):
- # if the new thread does not belong to the open_books forum, pass
- if thread.category.name != "Book Club":
- pass
- announce_channel = thread.guild.get_channel(1112533230483148882)
- embed = disnake.Embed(
- color = disnake.Colour.random(),
- title = "A New Book Has Been Created!",
- description = f"Click Here To View This Thread {thread.jump_url}"
- ).add_field(
- name = "Book Name",
- value = thread.name,
- inline = False
- ).add_field(
- name = "Book Details",
- value = thread.starter_message,
- inline = False
- ).add_field(
- name = "Book Genre",
- value = [tag.name for tag in thread.applied_tags]
- )
- return await announce_channel.send_message("@here A New Book Thread Has Been Started.", embed=embed)
- def setup(bot):
- bot.add_cog(BookCreationEvents(bot))
Add Comment
Please, Sign In to add comment