Spaces:
Running
Running
shift link outside of DM
Browse files
app.py
CHANGED
@@ -46,8 +46,8 @@ class DMButton(Button):
|
|
46 |
self.message = message
|
47 |
|
48 |
async def callback(self, interaction: discord.Interaction):
|
49 |
-
await interaction.user.send(self.message)
|
50 |
-
await interaction.response.send_message(
|
51 |
|
52 |
@bot.command(name='sendbutton')
|
53 |
async def send_button(ctx):
|
@@ -55,10 +55,10 @@ async def send_button(ctx):
|
|
55 |
unique_string = generate_unique_string()
|
56 |
user_tokens[ctx.author.id] = unique_string
|
57 |
unique_link = f"{GRADIO_APP_URL}?user_id={ctx.author.id}&token={unique_string}"
|
58 |
-
button = DMButton(label="Verify Discord Account", style=discord.ButtonStyle.primary, message=f"To complete the verification process, visit this
|
59 |
view = View()
|
60 |
view.add_item(button)
|
61 |
-
await ctx.send("Click the button below:",
|
62 |
|
63 |
|
64 |
# Gradio ------------------------------------------------------------------------------------------------------------
|
|
|
46 |
self.message = message
|
47 |
|
48 |
async def callback(self, interaction: discord.Interaction):
|
49 |
+
# await interaction.user.send(self.message) # this is for DMs, but users may have DMs disabled
|
50 |
+
await interaction.response.send_message(self.message, ephemeral=True)
|
51 |
|
52 |
@bot.command(name='sendbutton')
|
53 |
async def send_button(ctx):
|
|
|
55 |
unique_string = generate_unique_string()
|
56 |
user_tokens[ctx.author.id] = unique_string
|
57 |
unique_link = f"{GRADIO_APP_URL}?user_id={ctx.author.id}&token={unique_string}"
|
58 |
+
button = DMButton(label="Verify Discord Account", style=discord.ButtonStyle.primary, message=f"To complete the verification process, visit this Space and click the 'sign in with Hugging Face' button: {unique_link}")
|
59 |
view = View()
|
60 |
view.add_item(button)
|
61 |
+
await ctx.send(view=view) # "Click the button below:",
|
62 |
|
63 |
|
64 |
# Gradio ------------------------------------------------------------------------------------------------------------
|