Add a guild member to a guild via oauth2 access token
CurrentUser must be a member of the guild
| Permissions needed | Condition |
|---|---|
| CREATE_INSTANT_INVITE | always |
| OAUTH2 Scopes |
|---|
| guilds.join |
// add a user to a server
const client = new SnowTransfer("TOKEN")
const memberData = {
access_token: "access token of a user with the guilds.join scope"
}
client.guild.addGuildMember("guildId", "memberId", memberData)
Id of the guild
Id of the guild member
object containing the needed request data
Add a role to a guild member
Resolves the Promise on successful execution
| Permissions needed | Condition |
|---|---|
| MANAGE_ROLES | always |
// add a role to a member with a reason of "I want to add a role"
const client = new SnowTransfer("TOKEN")
client.guild.addGuildMemberRole("guildId", "memberId", "roleId", { reason: "I want to add a role" })
Id of the guild
Id of the guild member
Id of the role
Optional data: { object with reason property
Optional reason?: stringCreate a new Guild, limited to 10 guilds (you may create more if you are whitelisted) Check the discord docs for more infos
// Creates a simple guild with the name "Demo Guild"
const client = new SnowTransfer("TOKEN")
const guildData = {
name: "Demo Guild"
}
const guild = await client.guild.createGuild(guildData)
Data for the new guild
Ban a guild member
Resolves the Promise on successful execution
| Permissions needed | Condition |
|---|---|
| BAN_MEMBERS | always |
// Ban a user with a reason and delete the last 2 days of their messages
const client = new SnowTransfer("TOKEN")
const banData = {
reason: "Memes were not good enough",
delete_message_days":2
}
client.guild.createGuildBan("guild Id", "memberId", banData)
Id of the guild
Id of the guild member
Optional data: { object with a reason and a delete_message_days property
Optional delete_Optional reason?: stringCreate a channel within a guild
| Permissions needed | Condition |
|---|---|
| MANAGE_CHANNELS | always |
| ADMINISTRATOR | setting MANAGE_ROLES in permission_overwrites |
| * | if setting * permission in overwrites where * is any permission |
// Creates a guild voice channel with the name "nice voice channel" and with permission connect denied for the
role const client = new SnowTransfer("TOKEN") const channelData = { name: "nice voice channel", type: 2, permission_overwrites: [{ id: "guild id", type: 0, allow: "0" deny: (BigInt(1) << BigInt(20)).toString() }] } const channel = await client.guild.createGuildChannel("guild id", channelData)
Id of the guild
channel properties
Create a new Role
| Permissions needed | Condition |
|---|---|
| MANAGE_ROLES | always |
// Create a role with the name "Nice Role" and a color of a soft blue
const client = new SnowTransfer("TOKEN")
const roleData = {
name: "Nice Role",
color: 0x7c7cf8
}
client.guild.createGuildRole("guild Id", roleData)
Id of the guild
Optional data: RoleOptionsdata with role properties
Delete a guild
CurrentUser must be the owner of the guild
This action is irreversible, so use it with caution!
Resolves the Promise on successful execution
const client = new SnowTransfer("TOKEN")
client.guild.deleteGuild("guild id")
Id of the guild
Update a guild welcome screen object
| Permissions needed | Condition |
|---|---|
| MANAGE_GUILD | always |
// Disabled the welcome screen
const client = new SnowTransfer("TOKEN")
const welcomeScreen = await client.guild.updateGuildWelcomeScreen("guildId", { enabled: false })
Id of guild
Welcome screen data
Get a guild via Id
CurrentUser must be a member of the guild
const client = new SnowTransfer("TOKEN")
const guild = await client.guild.getGuild("guild id")
Id of the guild
Optional with_counts: booleanwhen true, will return approximate member and presence counts for the guild
Get a specific ban of a guild member
ban object
a DiscordAPIError if the member is not banned
| Permissions needed | Condition |
|---|---|
| BAN_MEMBERS | always |
const client = new SnowTransfer("TOKEN")
const ban = await client.guild.getGuildBan("guildId", "memberId")
Id of the guild
Id of the member
Get bans of a guild
List of bans
| Permissions needed | Condition |
|---|---|
| BAN_MEMBERS | always |
const client = new SnowTransfer("TOKEN")
const bans = await client.guild.getGuildBans("guildId")
Id of the guild
Optional options: { Query string options
Optional after?: stringOptional before?: stringOptional limit?: numberGet a list of all channels for a guild. Does not include threads
CurrentUser must be a member of the guild
list of channels
const client = new SnowTransfer("TOKEN")
const channels = await client.guild.getGuildChannels("guild id")
Id of the guild
Get integrations for a guild
List of integration objects
| Permissions needed | Condition |
|---|---|
| MANAGE_GUILD | always |
const client = new SnowTransfer("TOKEN")
const integrations = await client.guild.getGuildIntegrations("guildId")
Id of the guild
Get invites for a guild
List of invites (with metadata)
| Permissions needed | Condition |
|---|---|
| MANAGE_GUILD | always |
const client = new SnowTransfer("TOKEN")
const invites = await client.guild.getGuildInvites("guildId")
Id of the guild
Get a guild member via Id
CurrentUser must be a member of the guild
const client = new SnowTransfer("TOKEN")
const member = await client.guild.getGuildMember("guild id", "member id")
Id of the guild
Id of the guild member
Get a list of guild members
CurrentUser must be a member of the guild
list of guild members
| Intents |
|---|
| GUILD_MEMBERS |
// Gets 10 members from a guild
const client = new SnowTransfer("TOKEN")
const members = await client.guild.getGuildMembers("guild id", { limit: 10 })
Id of the guild
Optional data: GetGuildMembersDataquery data
Gets a guild's preview. If the CurrentUser is not in the guild, the guild must be lurkable
const client = new SnowTransfer("TOKEN")
const guildPreview = await client.guild.getGuildPreview("guild id")
Id of the guild
Get the amount of members that would be pruned when a prune with the passed amount of days would be started
Object with a "pruned" key indicating the amount of members that would be pruned
| Permissions needed | Condition |
|---|---|
| KICK_MEMBERS | always |
const client = new SnowTransfer("TOKEN")
const data = await client.guild.getGuildPruneCount("guildId", { days: 7 })
Id of the guild
Optional query: { Optional days?: numberOptional include_Get a list of roles for a guild
array of roles
| Permissions needed | Condition |
|---|---|
| MANAGE_ROLES | always |
const client = new SnowTransfer("TOKEN")
const roles = await client.guild.getGuildRoles("guildId")
Id of the guild
Get a guild's vanity URL code
partial invite object
| Permissions needed | Condition |
|---|---|
| MANAGE_GUILD | always |
const client = new SnowTransfer("TOKEN")
const vanityUrl = await client.guild.getGuildVanityUrl("guildId")
Id of the guild
Get a list of voice regions for the guild, includes vip-regions unlike voice.getVoiceRegions
List of voice regions
const client = new SnowTransfer("TOKEN")
const regions = await client.guild.getGuildVoiceRegions("guildId")
Id of the guild
Get a guild's welcome screen object
| Permissions needed | Condition |
|---|---|
| MANAGE_GUILD | if the welcome screen is not enabled |
const client = new SnowTransfer("TOKEN")
const welcomeScreen = await client.guild.getGuildWelcomeScreen("guildId")
Id of the guild
Get a guild widget settings object
| Permissions needed | Condition |
|---|---|
| MANAGE_GUILD | always |
const client = new SnowTransfer("TOKEN")
const widgetSettings = await client.guild.getGuildWidgetSettings("guildId")
Id of the guild
Returns all active threads in the guild, including public and private threads. Threads are ordered by their id, in descending order
All active threads and member objects of the CurrentUser that the CurrentUser has access to.
const client = new SnowTransfer("TOKEN")
const threads = await client.guild.listActiveThreads("guild id")
Id of the guild
Remove a ban of a user
Resolves the Promise on successful execution
| Permissions needed | Condition |
|---|---|
| BAN_MEMBERS | always |
// Remove a ban of a user with a reason
const client = new SnowTransfer("TOKEN")
client.guild.removeGuildBan("guildId", "memberId", "This guy was cool")
Id of the guild
Id of the guild member
Optional reason: stringReason for removing the ban
Delete a guild integration
Resolves the Promise on successful execution
| Permissions needed | Condition |
|---|---|
| MANAGE_GUILD | always |
const client = new SnowTransfer("TOKEN")
await client.guild.deleteGuildIntegration("guildId", "integrationId", "Didn't need anymore")
Id of the guild
Id of the integration
Optional reason: stringRemove a guild member (aka kick them)
Resolves the Promise on successful execution
| Permissions needed | Condition |
|---|---|
| KICK_MEMBERS | always |
// Kick a member with a reason of "spam"
const client = new SnowTransfer("TOKEN")
client.guild.removeGuildMember("guild Id", "memberId", "spam")
Id of the guild
Id of the guild member
Optional reason: stringReason for kicking the member
Remove a role from a guild member
Resolves the Promise on successful execution
| Permissions needed | Condition |
|---|---|
| MANAGE_ROLES | always |
// remove a role from a member with a reason of "I want to remove a role"
const client = new SnowTransfer("TOKEN")
client.guild.removeGuildMemberRole("guildId", "memberId", "roleId", "I want to remove a role")
Id of the guild
Id of the guild member
Id of the role
Optional reason: stringDelete a role from the guild
Resolves the Promise on successful execution
| Permissions needed | Condition |
|---|---|
| MANAGE_ROLES | always |
// Deletes a role with a reason "This role is too cool"
const client = new SnowTransfer("TOKEN")
client.guild.deleteGuildRole("guildId", "roleId", "This role is too cool")
Id of the guild
Id of the role
Optional reason: stringReason for deleting the role
Get a list of guild members that match a query
list of guild members
// Gets all members with the username "Wolke"
const client = new SnowTransfer("TOKEN")
const members = await client.guild.searchGuildMembers("guild id", { query: "Wolke" })
Id of the guild
query data
Optional limit?: numberStart a prune
Object with a "pruned" key indicating the amount of members that were pruned
| Permissions needed | Condition |
|---|---|
| KICK_MEMBERS | always |
const client = new SnowTransfer("TOKEN")
const data = await client.guild.startGuildPrune("guildId", { days: 7 })
Id of the guild
Object with prune data
Optional compute_Optional days?: numberOptional include_Optional reason?: stringOptional days?: numberOptional include_Optional reason?: stringBatch update the positions of channels. Only those being moved needs to be included here
Resolves the Promise on successful execution
| Permissions needed | Condition |
|---|---|
| MANAGE_CHANNELS | always |
// Sets the position of a channel to 2 under a category channel
const client = new SnowTransfer("TOKEN")
client.guild.updateChannelPositions("guild id", [{ id: "channel id", position: 2, category_id: "category id" }])
Id of the guild
Positional data to send
Updates the current user's voice state in a stage channel
Resolves the Promise on successful execution
| Permissions needed | Condition |
|---|---|
| MUTE_MEMBERS | when trying to un-suppress yourself |
| REQUEST_TO_SPEAK | when trying to request to speak |
// Unsuppresses the CurrentUser in the stage channel they're in
const client = new SnowTransfer("TOKEN")
client.guild.updateGuildVoiceState("guildId", { channel_id: "channel id", suppress: false })
Id of the guild
Data of the voice state
Optional request_Optional suppress?: booleanUpdate a guild
| Permissions needed | Condition |
|---|---|
| MANAGE_GUILD | always |
// Update the name of a guild to "Nice Guild"
const client = new SnowTransfer("TOKEN")
const guildData = {
name: "Nice Guild"
}
client.guild.updateGuild("guild Id", guildData)
Id of the guild
Updated guild data
Update properties of a guild member
Resolves the Promise on successful execution
| Permissions needed | Condition |
|---|---|
| MANAGE_NICKNAMES | Nick Updates |
| MANAGE_ROLES | Role Updates |
| MUTE_MEMBERS | Mute Updates |
| DEAFEN_MEMBERS | Deaf Updates |
| MOVE_MEMBERS | Voice Move |
| CONNECT | Voice Move |
| MODERATE_MEMBERS | Timeouts |
// Reset the nickname of a guild member
const client = new SnowTransfer("TOKEN")
const memberData = {
nick: "" // You can reset nicknames by providing an empty string as the value of data.nick
}
const member = await client.guild.updateGuildMember("guild Id", "memberId", memberData)
Id of the guild
Id of the guild member
Updated properties
Update a guild role
| Permissions needed | Condition |
|---|---|
| MANAGE_ROLES | always |
const client = new SnowTransfer("TOKEN")
const roleData = {
name: "Nicer Role",
}
client.guild.updateGuildRole("guildId", "roleId", roleData)
Id of the guild
Id of the role
updated properties of the role
Modify the positions of roles
array of roles
| Permissions needed | Condition |
|---|---|
| MANAGE_ROLES | always |
const client = new SnowTransfer("TOKEN")
const roles = await client.guild.updateGuildRolePositions("guildId", [{ id: "guild id", position: 1 }, { id: "role id 2", position: 2 }])
Id of the guild
Role data to update
Update a guild widget settings object
Updated Guild Widget settings
| Permissions needed | Condition |
|---|---|
| MANAGE_GUILD | always |
// Sets a widget as disabled
const client = new SnowTransfer("TOKEN")
const widgetSettings = await client.guild.updateGuildWidgetSettings("guildId", { enabled: false })
Id of the guild
widget settings
Update the nick of the CurrentMember
Resolves the Promise on successful execution
| Permissions needed | Condition |
|---|---|
| CHANGE_NICKNAME | always |
// change nick of bot to "Nice Nick"
const client = new SnowTransfer("TOKEN")
const nickData = {
nick: "Nice Nick"
}
client.guild.updateSelf("guildId", nickData)
Id of the guild
object with a nick property and optionally, a reason property
Optional reason?: stringUpdates a user's voice state in a stage channel
Resolves the Promise on successful execution
| Permissions needed | Condition |
|---|---|
| MUTE_MEMBERS | when trying to suppress/un-suppress |
// Suppresses the user in the stage channel they're in
const client = new SnowTransfer("TOKEN")
client.guild.updateGuildVoiceState("guildId", "userId", { channel_id: "channel id", suppress: true })
Id of the guild
Data of the voice state
Optional suppress?: booleanCreate a new Guild Method Handler
Usually SnowTransfer creates a method handler for you, this is here for completion
You can access the methods listed via client.guild.method, where client is an initialized SnowTransfer instance
request handler that calls the rest api
Generated using TypeDoc
Methods for interacting with Guilds