Custom Commands homeCustom Commands
  • Blog
  • Privacy
  • Premium
  • Templates
  • Support
Back to blog
// blog

Send welcome message using custom commands bot

How to send welcome message to a user when he joins server

Md Shahriyar Alam

2 years ago

·7 min read

A Discord welcome message is the first thing a new member sees — and the difference between someone reading your rules and someone lurking forever. With Custom Commands Bot you can set one up in about three minutes, with no coding experience required.

This guide covers the basic welcome DM, then the additions people usually want next: auto-assigning a role on join, posting to a welcome channel, and sending a formatted embed instead of plain text.


Quick Answer: How Do You Set Up a Discord Welcome Message?

Welcome messages aren't a command — nobody types /welcome. They fire automatically when someone joins, so they're built as an event handler:

  1. Open the dashboard and click Events in the sidebar.
  2. Click Create.
  3. Give the event a name (e.g. Welcome).
  4. Set Trigger to MEMBER_JOIN.
  5. Add one line of code in the Pre box.
  6. Save.

That's it. The next member to join gets your welcome message. No syncing required — event handlers are live the moment you save them.


Step 1: Create the Event Handler

In the dashboard sidebar, click Events, then the Create button.

You'll be asked for two things that matter:

Name — anything you like. This is for you, not your members. Welcome is fine.

Trigger — select MEMBER_JOIN. This is what makes the handler run when someone joins your server.

Why an event, not a command? Commands run when a member types something. Events run when something happens in your server. A welcome message reacts to a join, so it belongs in Events.


Step 2: Write the Welcome Message

In the Pre code box, add:

py
send_dm(user, f"Welcome to {server.name}")

Save the event. Done — new members now receive a welcome DM.

What each piece does:

PieceMeaning
send_dm(...)Sends a direct message
userThe member who just joined
server.nameYour server's name, filled in automatically
f"..."A Python f-string — anything in {} gets replaced with its real value

No await needed. In most Python code you'd have to write await send_dm(...). The bot adds that for you automatically, so you can write the obvious thing and it works.


Step 3: Auto-Assign a Role on Join

The most common follow-up: give every new member a starting role. Add one line:

py
send_dm(user, f"Welcome to {server.name}")
add_roles(user, role_id)
# Replace role_id with the ID of the role you want to give

To get a role ID: enable Developer Mode in Discord (User Settings → Advanced), then right-click the role → Copy Role ID.

Assign several roles at once by passing more than one:

py
add_roles(user, 123456789, 987654321)

Assign a role later instead of immediately — useful for trial periods or anti-raid delays:

py
add_roles(user, role_id, after="7 days")

That schedules the role for seven days after they join. The member gets it automatically, even if the bot restarts in between.

Role limits per run: 5 roles on free plans, 15 on premium. Plenty for a welcome flow.


Step 4 (Optional): Post to a Welcome Channel

DMs are easy to miss, and many members have DMs from servers disabled. A visible welcome in a channel usually gets more engagement:

py
send_message(channel_id, f"Welcome {user.mention} to {server.name}!")

Replace channel_id with your welcome channel's ID (right-click the channel → Copy Channel ID).

user.mention pings the new member, which pulls their attention to the channel and the rules you've pointed them at.

Do both — a public greeting plus a private DM with the details:

py
send_message(channel_id, f"Welcome {user.mention}!")
send_dm(user, f"Welcome to {server.name}! Please read the rules in #rules.")
add_roles(user, role_id)

Step 5 (Optional): Send a Welcome Embed

Plain text is functional. An embed looks designed.

Build the embed once under Embeds in the dashboard, then load it in your event:

py
embed = load_embed(123)
send_dm(user, embed=embed)

Because saved embeds support variables, one embed can greet every member by name. Edit it later and every place using it updates — no touching the event handler again.

DM limit: 2 DMs per run. That's a guardrail against accidental spam loops, not something a normal welcome flow will hit.


Also Useful: Goodbye Messages

The same pattern with a different trigger. Create another event handler and set Trigger to MEMBER_LEAVE:

py
send_message(channel_id, f"{old_user.username} has left the server.")

Note it's old_user here, not user — the member is already gone, so the bot hands you their last-known details.

There's also MEMBER_UPDATE, which fires on member changes and gives you added_role, removed_role, and role_action — handy for logging role changes or reacting when someone gets verified.


Troubleshooting Your Welcome Message

SymptomCauseFix
No welcome DM arrivesMember has server DMs disabledPost to a welcome channel instead — you can't override this
Nothing happens at allWrong trigger selectedConfirm the trigger is MEMBER_JOIN
Role isn't assignedBot's role sits below the target roleMove the bot's role above it in Server Settings → Roles
"Missing permissions" errorBot lacks Manage RolesGrant Manage Roles to the bot
Code error on joinTypo or bad IDCheck Logs → Error Logs — it reports the exact line

The role hierarchy one catches almost everyone. Discord will not let a bot assign a role that ranks equal to or higher than its own, no matter what permissions it has. If add_roles silently fails, that's the first thing to check.


Frequently Asked Questions

Can I send a Discord welcome message without coding?

Almost. The welcome message itself is one line you can copy directly from this guide — no programming knowledge needed. Everything else (choosing the trigger, picking the channel, designing the embed) is done through the dashboard.

Why isn't my welcome DM being delivered?

Discord lets every user block DMs from server members. If they've done that, no bot can DM them — this is a privacy setting, not a bug. Post to a welcome channel as a fallback so the greeting always lands somewhere.

Can I give a role automatically when someone joins Discord?

Yes — add_roles(user, role_id) in a MEMBER_JOIN event handler. Make sure the bot's own role is positioned above the role you're assigning, or Discord will reject it.

Can I delay the auto-role instead of giving it instantly?

Yes. add_roles(user, role_id, after="7 days") schedules it. Useful for trial roles, anti-raid cooldowns, or unlocking channels after someone has stuck around.

Do welcome messages need to be synced like slash commands?

No. Syncing only applies to slash commands, because Discord has to register their names and arguments in advance. Event handlers run on your server's activity and go live as soon as you save.

Can I welcome members with an image or a custom design?

Yes — build an embed under Embeds (with images, colours, fields, and thumbnails) and load it with load_embed(id). For richer layouts with buttons and galleries, use Components V2 and load_components(id).


Why This Approach Beats a Fixed Welcome Bot

Most welcome bots hand you a template with a few blanks to fill in. That works right up until you want something slightly different — greet boosters differently, skip the DM for bot accounts, assign a role based on how the member arrived.

Because this runs your logic, "slightly different" is just another line:

py
if user.is_bot:
    return

send_dm(user, f"Welcome to {server.name}")
add_roles(user, role_id)

That's the point of custom commands and event handlers: the simple case stays one line, and the unusual case stays possible. You're never stuck waiting for a feature request.


Next Steps

You now have a working Discord welcome message. Sensible things to build next:

  • A goodbye message with MEMBER_LEAVE
  • A rules command members can call any time
  • Reaction roles so new members pick their own interests
  • Logging with MEMBER_UPDATE to track role changes

Questions, bugs, or a feature you wish existed? Join the support Discord — requests from real servers are what shape the roadmap.

Loading comments…

{}

Need help?

Have a question, a suggestion, or stuck on something? Reach out — we're happy to help.

Join support server
Custom CommandsCustom Commands

The #1 custom commands Discord bot — build commands, events and databases with zero boilerplate.

Links

HomeBlogPrivacySupport

Contact

[email protected]

2 Frederick StreetLondon, WC1X 0ND

{ / } custom commands

© WEiRDSOFT LTD. All rights reserved.