#Modal works, after restart it doesn't and the cycle continues.
1 messages · Page 1 of 1 (latest)
I tried implementing the callback and defer method from /giveaway, which helped, but after some changes to the code and restarts it suddenly stopped working and gave the errors above.
I'm so confused. Let me also send you one of the commands that experience this issue.
class MsgModal(discord.ui.Modal):
def __init__(self, *args, **kwargs) -> None:
super().__init__(*args, **kwargs)
self.add_item(discord.ui.InputText(label="Message", style=discord.InputTextStyle.long))
async def callback(self, interaction: discord.Interaction):
message = self.children[0].value
await interaction.response.defer()
await self.send_message(message, interaction)
async def send_message(self, message, interaction):
channel = interaction.channel
await channel.send(f"{message}")
@bot.slash_command()
async def msg(ctx: discord.ApplicationContext):
"""Send a message using Sentinel"""
author_perms = ctx.author.guild_permissions
if author_perms.administrator:
modal = MsgModal(title="Message")
await ctx.send_modal(modal)
else:
await ctx.respond("You must have administrator permissions to use this command.", ephemeral=True)
I am confused whether this is an issue with Pebblehost or the code itself- I might need to test this.