Skip to main content

Members

Everything about the people in a server: reading who they are, and the moderation actions you can take on them.

Show the whole Members flyout

The Members subcategory

Members and users​

This is the distinction to get straight first.

  • A user is a Discord account. Username, avatar, banner, creation date. The same everywhere.
  • A member is that user inside one server. Nickname, roles, join date, server color.

Some blocks accept either. Anything that bans, kicks, times out or changes roles needs a member, because those things only exist inside a server. The editor will not let you plug the wrong one in.

User of member

user of member converts a member into the user behind it.

Getting a member or user​

BlockReturns
get memberA member of a server, by username or ID.
get userA Discord user, by username or ID.

For each member

for each member in server loops over everyone.

Current member

current member in loop is the one being handled.

warning

Looping over every member in a large server is slow, and it needs the Server Members Intent switched on in the Discord Developer Portal. If the loop runs zero times, that intent is usually why.

Reading a member or user​

BlockReturns
idThe Discord ID.
usernameThe account username.
nicknameThe server nickname, if set.
avatarA URL to the avatar.
bannerA URL to the profile banner.
colorThe color their name shows in, from their highest colored role.
accentTheir profile accent color.
joinedWhen they joined the server.
createdWhen the account was made.
statusOnline, idle, do not disturb or offline.
flagsDiscord account badges, as a list.
has badgeTrue when a user has a specific profile badge: Discord Staff, Partnered Server Owner, HypeSquad, Bug Hunter, Early Supporter, Active Developer and so on.
badge countHow many profile badges a user has.
activity nameThe name of what the member is doing right now, like the game they are playing.
activity typeThe kind of activity: Playing, Streaming, Listening, Watching, Custom or Competing.
streamingTrue when the member is streaming right now.
activity elapsedHow many seconds the member has spent on their current activity.
is botTrue when the account is a bot.
is systemTrue when it is an official Discord account.
dm channelThe DM channel with that user.

creation date of user is the block behind account-age checks. Comparing it against the current date catches brand new accounts joining during a raid.

The activity blocks read the member's presence, so they need the Presence intent switched on in the Discord Developer Portal. Without it they come back empty. See Events.

Permission and safety checks​

BlockReturns
has permissionWhether the member has a permission.
bannableWhether the bot is allowed to ban them.
kickableWhether the bot is allowed to kick them.
timed outWhether they are currently timed out.

Check is member bannable by the bot? before banning. It is false when the target's highest role is above the bot's, or when they own the server, and it saves you an error your user never sees.

Moderation actions​

BlockWhat it does
banBans a member, with a reason for the audit log.
unbanRemoves a ban from a server. Takes a user, since they are no longer a member.
kickRemoves a member from the server. They can rejoin.
timeoutSilences a member for a number of seconds.
remove timeoutEnds a timeout early.
set nicknameChanges their server nickname.

Timeouts are capped by Discord at 28 days.

Direct messages​

Send a DM

send a DM to user/member opens a direct message and sends it. It takes the same components input as any other send block.

warning

Sending a DM fails when the person has DMs from server members turned off, and there is nothing your bot can do about that. Wrap it in a try block from JavaScript so one closed inbox does not stop the rest of your command.

Events​

For joins, leaves, role changes and nickname changes, see Server Actions and Member Actions.

A worked example: a ban command​

  1. A slash command ban with a user option and a text option for the reason.
  2. Check that member of the interaction has the Ban Members permission, and reply with an error if not.
  3. Check is member bannable by the bot? on the target, and reply with an error if not.
  4. Try to send a DM telling them they were banned, wrapped in a try block.
  5. ban member with the reason.
  6. Reply confirming it, and post a line in your mod log channel.