mirror of
https://github.com/discordeno/discordeno.git
synced 2026-06-16 03:18:17 +00:00
change: prettier code
This commit is contained in:
committed by
GitHub Action
parent
a8ccf05e8b
commit
baf8583976
@@ -7,5 +7,10 @@ export async function batchEditSlashCommandPermissions(
|
||||
guildId: bigint,
|
||||
options: { id: string; permissions: ApplicationCommandPermissions[] }[]
|
||||
) {
|
||||
return await bot.rest.runMethod(bot.rest,"put", bot.constants.endpoints.COMMANDS_PERMISSIONS(bot.applicationId, guildId), options);
|
||||
return await bot.rest.runMethod(
|
||||
bot.rest,
|
||||
"put",
|
||||
bot.constants.endpoints.COMMANDS_PERMISSIONS(bot.applicationId, guildId),
|
||||
options
|
||||
);
|
||||
}
|
||||
|
||||
@@ -19,7 +19,9 @@ export async function createSlashCommand(bot: Bot, options: CreateGlobalApplicat
|
||||
return await bot.rest.runMethod<ApplicationCommand>(
|
||||
bot.rest,
|
||||
"post",
|
||||
guildId ? bot.constants.endpoints.COMMANDS_GUILD(bot.applicationId, guildId) : bot.constants.endpoints.COMMANDS(bot.applicationId),
|
||||
guildId
|
||||
? bot.constants.endpoints.COMMANDS_GUILD(bot.applicationId, guildId)
|
||||
: bot.constants.endpoints.COMMANDS(bot.applicationId),
|
||||
options
|
||||
);
|
||||
}
|
||||
|
||||
@@ -5,6 +5,8 @@ export async function deleteSlashCommand(bot: Bot, id: bigint, guildId?: bigint)
|
||||
return await bot.rest.runMethod<undefined>(
|
||||
bot.rest,
|
||||
"delete",
|
||||
guildId ? bot.constants.endpoints.COMMANDS_GUILD_ID(bot.applicationId, guildId, id) : bot.constants.endpoints.COMMANDS_ID(bot.applicationId, id)
|
||||
guildId
|
||||
? bot.constants.endpoints.COMMANDS_GUILD_ID(bot.applicationId, guildId, id)
|
||||
: bot.constants.endpoints.COMMANDS_ID(bot.applicationId, id)
|
||||
);
|
||||
}
|
||||
|
||||
@@ -8,7 +8,12 @@ export async function editSlashCommandPermissions(
|
||||
commandId: bigint,
|
||||
options: ApplicationCommandPermissions[]
|
||||
) {
|
||||
return await bot.rest.runMethod(bot.rest,"put", bot.constants.endpoints.COMMANDS_PERMISSION(bot.applicationId, guildId, commandId), {
|
||||
return await bot.rest.runMethod(
|
||||
bot.rest,
|
||||
"put",
|
||||
bot.constants.endpoints.COMMANDS_PERMISSION(bot.applicationId, guildId, commandId),
|
||||
{
|
||||
permissions: options,
|
||||
});
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
@@ -48,12 +48,14 @@ export async function editSlashResponse(bot: Bot, token: string, options: Discor
|
||||
content: options.content,
|
||||
embeds: options.embeds,
|
||||
file: options.file,
|
||||
allowed_mentions: options.allowedMentions ? {
|
||||
allowed_mentions: options.allowedMentions
|
||||
? {
|
||||
parse: options.allowedMentions.parse,
|
||||
roles: options.allowedMentions.roles,
|
||||
users: options.allowedMentions.users,
|
||||
replied_user: options.allowedMentions.repliedUser
|
||||
} : undefined,
|
||||
replied_user: options.allowedMentions.repliedUser,
|
||||
}
|
||||
: undefined,
|
||||
attachments: options.attachments,
|
||||
// TODO: Snakelize components??
|
||||
components: options.components,
|
||||
|
||||
@@ -7,13 +7,19 @@ export async function getSlashCommands(bot: Bot, guildId?: bigint) {
|
||||
const result = await bot.rest.runMethod<ApplicationCommand[]>(
|
||||
bot.rest,
|
||||
"get",
|
||||
guildId ? bot.constants.endpoints.COMMANDS_GUILD(bot.applicationId, guildId) : bot.constants.endpoints.COMMANDS(bot.applicationId)
|
||||
guildId
|
||||
? bot.constants.endpoints.COMMANDS_GUILD(bot.applicationId, guildId)
|
||||
: bot.constants.endpoints.COMMANDS(bot.applicationId)
|
||||
);
|
||||
|
||||
return new Collection(
|
||||
result.map((command) => [
|
||||
command.name,
|
||||
{ ...command, id: bot.transformers.snowflake(command.id), applicationId: bot.transformers.snowflake(command.applicationId) },
|
||||
{
|
||||
...command,
|
||||
id: bot.transformers.snowflake(command.id),
|
||||
applicationId: bot.transformers.snowflake(command.applicationId),
|
||||
},
|
||||
])
|
||||
);
|
||||
}
|
||||
|
||||
@@ -5,7 +5,12 @@ import type {Bot} from "../../../bot.ts";
|
||||
/**
|
||||
* Edit an existing slash command. If this command did not exist, it will create it.
|
||||
*/
|
||||
export async function upsertSlashCommand(bot: Bot, commandId: bigint, options: EditGlobalApplicationCommand, guildId?: bigint) {
|
||||
export async function upsertSlashCommand(
|
||||
bot: Bot,
|
||||
commandId: bigint,
|
||||
options: EditGlobalApplicationCommand,
|
||||
guildId?: bigint
|
||||
) {
|
||||
[options] = bot.utils.validateSlashCommands([options]);
|
||||
|
||||
return await bot.rest.runMethod<ApplicationCommand>(
|
||||
|
||||
@@ -18,7 +18,9 @@ export async function upsertSlashCommands(
|
||||
return await bot.rest.runMethod<ApplicationCommand[]>(
|
||||
bot.rest,
|
||||
"put",
|
||||
guildId ? bot.constants.endpoints.COMMANDS_GUILD(bot.applicationId, guildId) : bot.constants.endpoints.COMMANDS(bot.applicationId),
|
||||
guildId
|
||||
? bot.constants.endpoints.COMMANDS_GUILD(bot.applicationId, guildId)
|
||||
: bot.constants.endpoints.COMMANDS(bot.applicationId),
|
||||
options
|
||||
);
|
||||
}
|
||||
|
||||
@@ -4,7 +4,11 @@ import type {SnakeCasedPropertiesDeep} from "../../types/util.ts";
|
||||
|
||||
/** Returns the initial Interaction response. Functions the same as Get Webhook Message */
|
||||
export async function getOriginalInteractionResponse(bot: Bot, token: string) {
|
||||
const result = await bot.rest.runMethod<SnakeCasedPropertiesDeep<Message>>(bot.rest,"get", bot.constants.endpoints.INTERACTION_ORIGINAL_ID_TOKEN(bot.applicationId, token));
|
||||
const result = await bot.rest.runMethod<SnakeCasedPropertiesDeep<Message>>(
|
||||
bot.rest,
|
||||
"get",
|
||||
bot.constants.endpoints.INTERACTION_ORIGINAL_ID_TOKEN(bot.applicationId, token)
|
||||
);
|
||||
|
||||
return bot.transformers.message(result);
|
||||
}
|
||||
|
||||
@@ -42,7 +42,7 @@ export async function sendInteractionResponse(
|
||||
parse: options.data.allowedMentions.parse,
|
||||
roles: options.data.allowedMentions.roles,
|
||||
users: options.data.allowedMentions.users,
|
||||
replied_user: options.data.allowedMentions.repliedUser
|
||||
replied_user: options.data.allowedMentions.repliedUser,
|
||||
},
|
||||
...(options.data.messageReference?.messageId
|
||||
? {
|
||||
@@ -57,7 +57,7 @@ export async function sendInteractionResponse(
|
||||
file: options.data.file,
|
||||
// TODO: Snakelize components??
|
||||
components: options.data.components,
|
||||
flags: options.data.flags
|
||||
flags: options.data.flags,
|
||||
});
|
||||
}
|
||||
|
||||
@@ -80,7 +80,7 @@ export async function sendInteractionResponse(
|
||||
parse: options.data.allowedMentions.parse,
|
||||
roles: options.data.allowedMentions.roles,
|
||||
users: options.data.allowedMentions.users,
|
||||
replied_user: options.data.allowedMentions.repliedUser
|
||||
replied_user: options.data.allowedMentions.repliedUser,
|
||||
},
|
||||
...(options.data.messageReference?.messageId
|
||||
? {
|
||||
@@ -95,7 +95,7 @@ export async function sendInteractionResponse(
|
||||
file: options.data.file,
|
||||
// TODO: Snakelize components??
|
||||
components: options.data.components,
|
||||
flags: options.data.flags
|
||||
flags: options.data.flags,
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
@@ -85,7 +85,7 @@ export async function sendMessage(bot: Bot, channelId: bigint, content: string |
|
||||
parse: content.allowedMentions.parse,
|
||||
roles: content.allowedMentions.roles,
|
||||
users: content.allowedMentions.users,
|
||||
replied_user: content.allowedMentions.repliedUser
|
||||
replied_user: content.allowedMentions.repliedUser,
|
||||
},
|
||||
file: content.file,
|
||||
// TODO: Snakelize components??
|
||||
|
||||
@@ -58,7 +58,7 @@ export async function editWebhookMessage(
|
||||
parse: content.allowedMentions.parse,
|
||||
roles: content.allowedMentions.roles,
|
||||
users: content.allowedMentions.users,
|
||||
replied_user: content.allowedMentions.repliedUser
|
||||
replied_user: content.allowedMentions.repliedUser,
|
||||
},
|
||||
attachments: options.attachments,
|
||||
// TODO: Snakelize components??
|
||||
|
||||
Reference in New Issue
Block a user