Skip to content

Commit

Permalink
[V3] complete rewrite because the old one was a mess
Browse files Browse the repository at this point in the history
  • Loading branch information
FO-nTTaX committed Aug 8, 2021
1 parent 29ec1d2 commit 961c75e
Show file tree
Hide file tree
Showing 2 changed files with 104 additions and 16 deletions.
101 changes: 92 additions & 9 deletions ftsbot/cogs/rolecommands.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
)

Expand Down
19 changes: 12 additions & 7 deletions ftsbot/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,8 @@
'reviewer': 'Reviewer'
}

botroles = [
# wikis
# Wiki roles
botroleswikis = [
'Age of Empires',
'Apex Legends',
'Arena FPS',
Expand All @@ -86,6 +86,7 @@
'Brawl Stars',
'Call of Duty',
'Clash Royale',
'Commons',
'Counter-Strike',
'Critical Ops',
'CrossFire',
Expand Down Expand Up @@ -117,10 +118,10 @@
'Warcraft',
'Wild Rift',
'World of Warcraft',
# Common(s)
'Commons',
'Templates',
# Languages
]

# Language roles
botroleslanguages = [
'Arabic',
'Belarusian',
'Bosnian',
Expand Down Expand Up @@ -150,7 +151,11 @@
'Tagalog',
'Thai',
'Ukrainian',
# Misc
]

# Misc roles
botrolesmisc = [
'Templates',
'Announcements',
'CS Predictions',
'Game Night',
Expand Down

0 comments on commit 961c75e

Please sign in to comment.