From 961c75e4ff87dda326dcfd4289a1c1927e3cf363 Mon Sep 17 00:00:00 2001 From: FO-nTTaX Date: Sun, 8 Aug 2021 02:42:43 +0200 Subject: [PATCH] [V3] complete rewrite because the old one was a mess --- ftsbot/cogs/rolecommands.py | 101 ++++++++++++++++++++++++++++++++---- ftsbot/data.py | 19 ++++--- 2 files changed, 104 insertions(+), 16 deletions(-) diff --git a/ftsbot/cogs/rolecommands.py b/ftsbot/cogs/rolecommands.py index af340b7..46ee2fd 100644 --- a/ftsbot/cogs/rolecommands.py +++ b/ftsbot/cogs/rolecommands.py @@ -52,45 +52,128 @@ async def setup(self, ctx): # Build menu entries_per_select = 25 - amount_select = math.ceil(len(data.botroles) / entries_per_select) # Add roles + # Wikis + amount_select = math.ceil(len(data.botroleswikis) / entries_per_select) components = [] for i in range(0, amount_select): options = [] for j in range(0, entries_per_select): entry_id = j + i * entries_per_select - if entry_id < len(data.botroles): - role = data.botroles[entry_id] + if entry_id < len(data.botroleswikis): + role = data.botroleswikis[entry_id] options.append(SelectOption(role, role)) components.append(SelectMenu( custom_id='addrole_select_' + str(i), - placeholder='Choose which roles you want to add', + placeholder='Choose which wiki roles you want to add', max_values=len(options), options=options )) await ctx.send( - '**Which roles do you want to add?**', + '**Which wiki roles do you want to add?**', + components=components + ) + # Languages + amount_select = math.ceil(len(data.botroleslanguages) / entries_per_select) + components = [] + for i in range(0, amount_select): + options = [] + for j in range(0, entries_per_select): + entry_id = j + i * entries_per_select + if entry_id < len(data.botroleslanguages): + role = data.botroleslanguages[entry_id] + options.append(SelectOption(role, role)) + components.append(SelectMenu( + custom_id='addrole_select_' + str(i), + placeholder='Choose which language roles you want to add', + max_values=len(options), + options=options + )) + await ctx.send( + '**Which language roles do you want to add?**', + components=components + ) + # Misc + amount_select = math.ceil(len(data.botrolesmisc) / entries_per_select) + components = [] + for i in range(0, amount_select): + options = [] + for j in range(0, entries_per_select): + entry_id = j + i * entries_per_select + if entry_id < len(data.botrolesmisc): + role = data.botrolesmisc[entry_id] + options.append(SelectOption(role, role)) + components.append(SelectMenu( + custom_id='addrole_select_' + str(i), + placeholder='Choose which misc roles you want to add', + max_values=len(options), + options=options + )) + await ctx.send( + '**Which misc roles do you want to add?**', components=components ) # Remove roles + # Wikis + amount_select = math.ceil(len(data.botroleswikis) / entries_per_select) + components = [] + for i in range(0, amount_select): + options = [] + for j in range(0, entries_per_select): + entry_id = j + i * entries_per_select + if entry_id < len(data.botroleswikis): + role = data.botroleswikis[entry_id] + options.append(SelectOption(role, role)) + components.append(SelectMenu( + custom_id='removerole_select_' + str(i), + placeholder='Choose which wiki roles you want to remove', + max_values=len(options), + options=options + )) + await ctx.send( + '**Which wiki roles do you want to remove?**', + components=components + ) + # Languages + amount_select = math.ceil(len(data.botroleslanguages) / entries_per_select) + components = [] + for i in range(0, amount_select): + options = [] + for j in range(0, entries_per_select): + entry_id = j + i * entries_per_select + if entry_id < len(data.botroleslanguages): + role = data.botroleslanguages[entry_id] + options.append(SelectOption(role, role)) + components.append(SelectMenu( + custom_id='removerole_select_' + str(i), + placeholder='Choose which language roles you want to remove', + max_values=len(options), + options=options + )) + await ctx.send( + '**Which language roles do you want to remove?**', + components=components + ) + # Misc + amount_select = math.ceil(len(data.botrolesmisc) / entries_per_select) components = [] for i in range(0, amount_select): options = [] for j in range(0, entries_per_select): entry_id = j + i * entries_per_select - if entry_id < len(data.botroles): - role = data.botroles[entry_id] + if entry_id < len(data.botrolesmisc): + role = data.botrolesmisc[entry_id] options.append(SelectOption(role, role)) components.append(SelectMenu( custom_id='removerole_select_' + str(i), - placeholder='Choose which roles you want to remove', + placeholder='Choose which misc roles you want to remove', max_values=len(options), options=options )) await ctx.send( - '**Which roles do you want to remove?**', + '**Which misc roles do you want to remove?**', components=components ) diff --git a/ftsbot/data.py b/ftsbot/data.py index 0a3d2f7..d5c0b46 100644 --- a/ftsbot/data.py +++ b/ftsbot/data.py @@ -73,8 +73,8 @@ 'reviewer': 'Reviewer' } -botroles = [ - # wikis +# Wiki roles +botroleswikis = [ 'Age of Empires', 'Apex Legends', 'Arena FPS', @@ -86,6 +86,7 @@ 'Brawl Stars', 'Call of Duty', 'Clash Royale', + 'Commons', 'Counter-Strike', 'Critical Ops', 'CrossFire', @@ -117,10 +118,10 @@ 'Warcraft', 'Wild Rift', 'World of Warcraft', - # Common(s) - 'Commons', - 'Templates', - # Languages +] + +# Language roles +botroleslanguages = [ 'Arabic', 'Belarusian', 'Bosnian', @@ -150,7 +151,11 @@ 'Tagalog', 'Thai', 'Ukrainian', - # Misc +] + +# Misc roles +botrolesmisc = [ + 'Templates', 'Announcements', 'CS Predictions', 'Game Night',