Reputation: 53
How do I add buttons to my welcome message? button switch to another channel
@client.event
async def on_member_join(member):
channel = client.get_channel(channelID)
await channel.send(f'Hello')
Upvotes: 2
Views: 1488
Reputation: 2663
For buttons I use discord-py-slash-command
package (documentation).
from discord_slash.utils import manage_components
from discord_slash.model import ButtonStyle
@client.event
async def on_member_join(member):
channel = client.get_channel(channelID)
button = manage_components.create_button(style=ButtonStyle.URL, label="Your channel", url=f'https://discord.com/channels/{member.guild.id}/{channel.id}')
action_row = manage_components.create_actionrow(button)
await channel.send(content=f'Hello', components=[action_row])
This will create a button that will forward you to your channel.
Link consists of: https://discord.com/channels/<server_id>/<channel_id>
Read more about Discord buttons
Upvotes: 2