bans

list

Returns a list of ban objects for the users banned from this guild

params

fieldtypedescription

limit?

integer

number of users to return (up to maximum 1000)

before?

user id

consider only users before given user id

after?

user id

consider only users after given user id

await discord.bans.list('GUILD_ID', params? /* see above */)

Returns Ban[]

get

Returns a ban object for the given user or errors if the ban cannot be found

await discord.bans.get('GUILD_ID', 'USER_ID')

Returns Ban

create

Create a guild ban, and optionally delete previous messages sent by the banned user

fieldtypedescription

delete_message_days?

integer

number of days to delete messages for (0-7) - deprecated

delete_message_seconds?

integer

number of seconds to delete messages for, between 0 and 604800 (7 days)

await discord.bans.create('GUILD_ID', 'USER_ID', options? /* see above */)

Returns Ban

remove

Remove the ban for a user

await discord.bans.remove('GUILD_ID', 'USER_ID')

Returns void

classes

Ban

Fields

fieldtypedescription

reason

string | null | never

Reason for the ban - never when ban is returned from ban.create

user

User | { id: Snowflake}

The banned user - only has id if ban is returned from ban.create

guild_id

Snowflake

The id of the guild that the user is banned in

Methods

Get

Gets this ban and updates this class

await ban.get()

Remove

Removes this ban

await ban.remove()

Last updated