This commit is contained in:
insert 2024-08-10 22:45:06 -04:00
parent 6d4157fc9a
commit ba4eed2538
Signed by: insert
GPG key ID: A70775C389ACF105

View file

@ -33,14 +33,18 @@ class GameView(nextcord.ui.View):
try: try:
turnping = ogmsg[i+1].split("<")[1].split(">")[0] turnping = ogmsg[i+1].split("<")[1].split(">")[0]
except IndexError: except IndexError:
message = message + "The turn is over" message = message + "The round is over"
turnover = True turnover = True
continue continue
else: else:
message = message + ogmsg[i] + "\n" message = message + ogmsg[i] + "\n"
if turnover: if turnover:
await interaction.response.edit_message(content=message,view=None) await interaction.response.edit_message(content=message,view=None)
await interaction.followup.send(f"The turn has concluded") try:
await interaction.message.unpin()
except:
pass
await interaction.followup.send(f"The round has concluded")
else: else:
await interaction.response.edit_message(content=message) await interaction.response.edit_message(content=message)
await interaction.followup.send(f"<{turnping}> it is now your turn!") await interaction.followup.send(f"<{turnping}> it is now your turn!")
@ -67,13 +71,25 @@ class gameutils(commands.Cog):
default_member_permissions=nextcord.Permissions(manage_roles=True), default_member_permissions=nextcord.Permissions(manage_roles=True),
) )
@nextcord.ext.application_checks.has_permissions(manage_roles=True) @nextcord.ext.application_checks.has_permissions(manage_roles=True)
async def turngen(self, interaction: nextcord.Interaction, role: nextcord.Role, turnmessage: str): async def turngen(self, interaction: nextcord.Interaction, role: nextcord.Role, turnmessage: str, disadvantagerole: nextcord.Role = nextcord.SlashOption(required=False)):
message = f"{turnmessage}\n" message = f"{turnmessage}\n"
if disadvantagerole:
disusers = disadvantagerole.members
users = role.members users = role.members
users = list(set(users) - set(disusers))
random.shuffle(users) random.shuffle(users)
for i in range(len(users)): for i in range(len(users)):
message = message + f"{str(i+1)}\. <@{users[i].id}>\n" message = message + f"{str(i+1)}\. <@{users[i].id}>\n"
await interaction.response.send_message(message, view=GameView(), allowed_mentions=nextcord.AllowedMentions.none()) if disadvantagerole:
random.shuffle(disusers)
for i in range(len(disusers)):
message = message + f"{str(i+1)}\. <@{users[i].id}> **disadventage**\n"
sentmsg = await interaction.response.send_message(message, view=GameView(), allowed_mentions=nextcord.AllowedMentions.none())
try:
sentmsg = await sentmsg.fetch()
await sentmsg.pin()
except:
pass
await interaction.followup.send(f"<@{users[0].id}> it is now your turn!") await interaction.followup.send(f"<@{users[0].id}> it is now your turn!")