This commit is contained in:
insert 2024-08-11 00:33:12 -04:00
parent 0c427bc6dc
commit 32eddce00c
Signed by: insert
GPG key ID: A70775C389ACF105

View file

@ -8,11 +8,12 @@ from urllib.parse import urlparse
import os import os
class TurnModal(nextcord.ui.Modal): class TurnModal(nextcord.ui.Modal):
def __init__(self,message,turnping): def __init__(self,message,turnping,fristrun):
self.message = message self.message = message
self.turnping = turnping self.turnping = turnping
self.fristrun = fristrun
super().__init__( super().__init__(
f"set turn message/context" f"set turn message/context for {self.fristrun.name}/{self.fristrun.display_name}" if self.fristrun else f"set turn message/context"
) )
self.text = nextcord.ui.TextInput( self.text = nextcord.ui.TextInput(
@ -24,8 +25,11 @@ class TurnModal(nextcord.ui.Modal):
self.add_item(self.text) self.add_item(self.text)
async def callback(self, interaction: nextcord.Interaction) -> None: async def callback(self, interaction: nextcord.Interaction) -> None:
if not fristrun:
await interaction.response.edit_message(content=self.message) await interaction.response.edit_message(content=self.message)
await interaction.followup.send(f"<{self.turnping}> it is now your turn!\n{self.text.value}") await interaction.followup.send(f"<{self.turnping}> it is now your turn!\n{self.text.value}")
else:
await interaction.followup.send(f"<{self.fristrun.id}> it is now your turn!\n{self.text.value}")
class GameView(nextcord.ui.View): class GameView(nextcord.ui.View):
@ -66,7 +70,7 @@ class GameView(nextcord.ui.View):
pass pass
await interaction.followup.send(f"The round has concluded") await interaction.followup.send(f"The round has concluded")
else: else:
await interaction.response.send_modal(TurnModal(message,turnping)) await interaction.response.send_modal(TurnModal(message,turnping,False))
return return
class gameutils(commands.Cog): class gameutils(commands.Cog):
@ -109,7 +113,8 @@ class gameutils(commands.Cog):
await sentmsg.pin() await sentmsg.pin()
except: except:
pass pass
await interaction.followup.send(f"<@{users[0].id}> it is now your turn!") await interaction.followup.send_modal(None,None,users[0])
#await interaction.followup.send(f"<@{users[0].id}> it is now your turn!")
@nextcord.slash_command( @nextcord.slash_command(
name="dice", name="dice",