I want my users to verify their solana address in my discord server, then a popup will show to input their wallet and the bot will verify the wallet address.
import discord
from discord_components import DiscordComponents, Button, ButtonStyle
client = discord.Client()
DiscordComponents(client)
@client.event
async def on_ready():
print('Logged in as {0.user}'.format(client))
@client.event
async def on_message(message):
if message.content == '/verify':
# Create a UI modal with a button
modal = await message.author.send(
"Please enter your Solana wallet address:",
components=[
Button(style=ButtonStyle.blue, label="Submit", custom_id="submit")
]
)
# Wait for the user to click the button
def check_interaction(interaction):
return interaction.message.id == modal.id and interaction.custom_id == "submit"
interaction = await client.wait_for("button_click", check=check_interaction)
# Validate the wallet address
# ...
# Send a message back to the user indicating whether the wallet address is valid or not
# ...
client.run()
an error shows:
Code Error
Unexpected token (2:5)
DETAILS
SyntaxError: Unexpected token (2:5)
at anonymous.pp$4.raise (/var/task/node_modules/acorn/dist/acorn.js:2927:15)
at anonymous.pp.unexpected (/var/task/node_modules/acorn/dist/acorn.js:698:10)
at anonymous.pp$1.parseImport (/var/task/node_modules/acorn/dist/acorn.js:1573:78)
at anonymous.pp$1.parseStatement (/var/task/node_modules/acorn/dist/acorn.js:872:49)
at anonymous.parseStatement (/var/task/node_modules/acorn-node/lib/dynamic-import/index.js:65:118)
at anonymous.parseStatement (/var/task/node_modules/acorn-node/lib/import-meta/index.js:45:48)
at anonymous.pp$1.parseTopLevel (/var/task/node_modules/acorn/dist/acorn.js:755:23)
at anonymous.parse (/var/task/node_modules/acorn/dist/acorn.js:555:17)
at Function.parse (/var/task/node_modules/acorn/dist/acorn.js:578:37)
at Object.parse (/var/task/node_modules/acorn-node/index.js:30:28)