Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @commands.has_any_role("Book Club Captain", "Owner", "Developer")
- async def create_new_book_thread(self, inter, book_title: str, book_author: str,
- tag: str, *, book_description: str):
- await inter.response.defer(ephemeral=True)
- forum_channel = inter.guild.get_channel(1108149493104377948)
- forum_tags = [tag for tag in forum_channel.available_tags]
- for t in forum_tags:
- if t.name == tag:
- tag_to_apply = t
- new_thread = await forum_channel.create_thread(
- name = f"{book_title} - {book_author}",
- applied_tags = [tag_to_apply,],
- content = book_description
- )
- jump_thread = inter.guild.get_thread(new_thread)
- return await inter.edit_original_message(f"{inter.author.mention} Your New Book Thread Has Been Created. {jump_thread.jump_url}")
- @create_new_book_thread.autocomplete("tag")
- async def create_new_book_thread_autocomplete(self,inter,string):
- forum_tags = [tag.name for tag in inter.guild.get_channel(1108149493104377948).available_tags]
- return [i for i in forum_tags if string.lower() in i.lower()]
Advertisement
Add Comment
Please, Sign In to add comment