Modify a Discord server name using a Discord bot
@dylburger
code:
data:privatelast updated:5 years ago
today
Build integrations remarkably fast!
You're viewing a public workflow template.
Sign up to customize, add steps, modify code and more.
Join 1,000,000+ developers using the Pipedream platform
steps.
trigger
Cron Scheduler
Deploy to configure a custom schedule
This workflow runs on Pipedream's servers and is triggered on a custom schedule.
steps.
get_current_user_guilds
List the guilds the current bot user is a part of from the /users/@me/guilds API endpoint
auth
(auths.discord_bot)
params
Optional
code
async (params, auths) => {
1
2
3
4
5
6
7
8
9
10
11
12
13
14
}
15
// See https://discordapp.com/developers/docs/resources/user#get-current-user-guilds
return await require("@pipedreamhq/platform").axios(this, {
  method: "GET",
  url: `https://discordapp.com/api/users/@me/guilds`,
  headers: {
    "Authorization": `Bot ${auths.discord_bot.bot_token}`,
  },
  params: {
    before: params.before,
    after: params.after,
    limit: params.limit,
  }
})
steps.
modify_guild
Modify a guild's settings. Requires the MANAGE_GUILD permission. Returns the updated guild object on success
auth
(auths.discord_bot)
params
Guild ID
{{steps.get_current_user_guilds.$return_value[0].id}}
string ·params.guild_id
Optional
code
async (params, auths) => {
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
}
25
// See https://discordapp.com/developers/docs/resources/guild#modify-guild
return await require("@pipedreamhq/platform").axios(this, {
  method: "PATCH",
  url: `https://discordapp.com/api/guilds/${params.guild_id}`,
  headers: {
    "Authorization": `Bot ${auths.discord_bot.bot_token}`,
    "Content-Type": "application/json",
  },
  data: {
    name: params.name,
    region: params.region,
    verification_level: params.verification_level,
    default_message_notifications: params.default_message_notifications,
    explicit_content_filter: params.explicit_content_filter,
    afk_channel_id: params.afk_channel_id,
    afk_timeout: params.afk_timeout,
    icon: params.icon,
    owner_id: params.owner_id,
    splash: params.splash,
    banner: params.banner,
    system_channel_id: params.system_channel_id,
  }
})