Add application emoji endpoints (#3774)

This commit is contained in:
Fleny
2024-07-20 16:56:00 -05:00
committed by GitHub
parent c1fd19c0ee
commit 2421ae24cf
6 changed files with 125 additions and 1 deletions
+26
View File
@@ -26,6 +26,7 @@ import type {
CamelizedDiscordVanityUrl,
CamelizedDiscordVoiceRegion,
CreateApplicationCommand,
CreateApplicationEmoji,
CreateAutoModerationRuleOptions,
CreateChannelInvite,
CreateEntitlement,
@@ -77,6 +78,7 @@ import type {
ListArchivedThreads,
ListGuildMembers,
MfaLevels,
ModifyApplicationEmoji,
ModifyChannel,
ModifyGuild,
ModifyGuildChannelPositions,
@@ -133,6 +135,9 @@ export function createBotHelpers(bot: Bot): BotHelpers {
createEmoji: async (guildId, options, reason) => {
return bot.transformers.emoji(bot, snakelize(await bot.rest.createEmoji(guildId, options, reason)))
},
createApplicationEmoji: async (options) => {
return bot.transformers.emoji(bot, snakelize(await bot.rest.createApplicationEmoji(options)))
},
createForumThread: async (channelId, options, reason) => {
return bot.transformers.channel(bot, { channel: snakelize(await bot.rest.createForumThread(channelId, options, reason)) })
},
@@ -187,6 +192,9 @@ export function createBotHelpers(bot: Bot): BotHelpers {
editEmoji: async (guildId, id, options, reason) => {
return bot.transformers.emoji(bot, snakelize(await bot.rest.editEmoji(guildId, id, options, reason)))
},
editApplicationEmoji: async (id, options) => {
return bot.transformers.emoji(bot, snakelize(await bot.rest.editApplicationEmoji(id, options)))
},
editFollowupMessage: async (token, messageId, options) => {
return bot.transformers.message(bot, snakelize(await bot.rest.editFollowupMessage(token, messageId, options)))
},
@@ -323,9 +331,19 @@ export function createBotHelpers(bot: Bot): BotHelpers {
getEmoji: async (guildId, emojiId) => {
return bot.transformers.emoji(bot, snakelize(await bot.rest.getEmoji(guildId, emojiId)))
},
getApplicationEmoji: async (emojiId) => {
return bot.transformers.emoji(bot, snakelize(await bot.rest.getApplicationEmoji(emojiId)))
},
getEmojis: async (guildId) => {
return (await bot.rest.getEmojis(guildId)).map((res) => bot.transformers.emoji(bot, snakelize(res)))
},
getApplicationEmojis: async () => {
const res = await bot.rest.getApplicationEmojis()
return {
items: res.items.map((item) => bot.transformers.emoji(bot, snakelize(item))),
}
},
getFollowupMessage: async (token, messageId) => {
return bot.transformers.message(bot, snakelize(await bot.rest.getFollowupMessage(token, messageId)))
},
@@ -578,6 +596,9 @@ export function createBotHelpers(bot: Bot): BotHelpers {
deleteEmoji: async (guildId, id, reason) => {
return await bot.rest.deleteEmoji(guildId, id, reason)
},
deleteApplicationEmoji: async (id) => {
return await bot.rest.deleteApplicationEmoji(id)
},
deleteFollowupMessage: async (token, messageId) => {
return await bot.rest.deleteFollowupMessage(token, messageId)
},
@@ -723,6 +744,7 @@ export interface BotHelpers {
createAutomodRule: (guildId: BigString, options: CreateAutoModerationRuleOptions, reason?: string) => Promise<AutoModerationRule>
createChannel: (guildId: BigString, options: CreateGuildChannel, reason?: string) => Promise<Channel>
createEmoji: (guildId: BigString, options: CreateGuildEmoji, reason?: string) => Promise<Emoji>
createApplicationEmoji: (options: CreateApplicationEmoji) => Promise<Emoji>
createForumThread: (channelId: BigString, options: CreateForumPostWithMessage, reason?: string) => Promise<Channel>
createGlobalApplicationCommand: (command: CreateApplicationCommand, options?: CreateGlobalApplicationCommandOptions) => Promise<ApplicationCommand>
createGuild: (options: CreateGuild) => Promise<Guild>
@@ -754,6 +776,7 @@ export interface BotHelpers {
editBotProfile: (options: { username?: string; botAvatarURL?: string | null }) => Promise<User>
editChannel: (channelId: BigString, options: ModifyChannel, reason?: string) => Promise<Channel>
editEmoji: (guildId: BigString, id: BigString, options: ModifyGuildEmoji, reason?: string) => Promise<Emoji>
editApplicationEmoji: (id: BigString, options: ModifyApplicationEmoji) => Promise<Emoji>
editFollowupMessage: (token: string, messageId: BigString, options: InteractionCallbackData) => Promise<Message>
editGlobalApplicationCommand: (commandId: BigString, options: CreateApplicationCommand) => Promise<ApplicationCommand>
editGuild: (guildId: BigString, options: ModifyGuild, reason?: string) => Promise<Guild>
@@ -812,7 +835,9 @@ export interface BotHelpers {
getDmChannel: (userId: BigString) => Promise<Channel>
getGroupDmChannel: (options: GetGroupDmOptions) => Promise<Channel>
getEmoji: (guildId: BigString, emojiId: BigString) => Promise<Emoji>
getApplicationEmoji: (emojiId: BigString) => Promise<Emoji>
getEmojis: (guildId: BigString) => Promise<Emoji[]>
getApplicationEmojis: () => Promise<{ items: Emoji[] }>
getFollowupMessage: (token: string, messageId: BigString) => Promise<Message>
getGatewayBot: () => Promise<CamelizedDiscordGetGatewayBot>
getGlobalApplicationCommand: (commandId: BigString) => Promise<ApplicationCommand>
@@ -899,6 +924,7 @@ export interface BotHelpers {
deleteChannel: (channelId: BigString, reason?: string) => Promise<void>
deleteChannelPermissionOverride: (channelId: BigString, overwriteId: BigString, reason?: string) => Promise<void>
deleteEmoji: (guildId: BigString, id: BigString, reason?: string) => Promise<void>
deleteApplicationEmoji: (id: BigString) => Promise<void>
deleteFollowupMessage: (token: string, messageId: BigString) => Promise<void>
deleteGlobalApplicationCommand: (commandId: BigString) => Promise<void>
deleteGuild: (guildId: BigString) => Promise<void>