refactor(util): COMMANDS_GUILD_ID constant arg order (#440)

* fmt

* refactor(util): change arg order for COMMANDS_GUILD_ID

* refactor(handlers): change arg order for COMMANDS_GUILD_ID

* feat(handlers): add getSlashCommand function

* Update mod.ts

* remove that
This commit is contained in:
ITOH
2021-01-24 12:12:40 +01:00
committed by GitHub
parent e952d1d9cb
commit 51387c5705
3 changed files with 10 additions and 7 deletions
+2
View File
@@ -116,6 +116,7 @@ import {
editWebhookMessage, editWebhookMessage,
executeSlashCommand, executeSlashCommand,
executeWebhook, executeWebhook,
getSlashCommand,
getSlashCommands, getSlashCommands,
getWebhook, getWebhook,
upsertSlashCommand, upsertSlashCommand,
@@ -237,6 +238,7 @@ export let handlers = {
editWebhookMessage, editWebhookMessage,
deleteWebhookMessage, deleteWebhookMessage,
createSlashCommand, createSlashCommand,
getSlashCommand,
getSlashCommands, getSlashCommands,
upsertSlashCommand, upsertSlashCommand,
editSlashCommand, editSlashCommand,
+7 -6
View File
@@ -20,10 +20,11 @@ import { botHasChannelPermissions } from "../../util/permissions.ts";
import { urlToBase64 } from "../../util/utils.ts"; import { urlToBase64 } from "../../util/utils.ts";
import { structures } from "../structures/mod.ts"; import { structures } from "../structures/mod.ts";
/** Create a new webhook. Requires the MANAGE_WEBHOOKS permission. Returns a webhook object on success. Webhook names follow our naming restrictions that can be found in our Usernames and Nicknames documentation, with the following additional stipulations: /**
* * Create a new webhook. Requires the MANAGE_WEBHOOKS permission. Returns a webhook object on success. Webhook names follow our naming restrictions that can be found in our Usernames and Nicknames documentation, with the following additional stipulations:
* Webhook names cannot be: 'clyde' *
*/ * Webhook names cannot be: 'clyde'
*/
export async function createWebhook( export async function createWebhook(
channelID: string, channelID: string,
options: WebhookCreateOptions, options: WebhookCreateOptions,
@@ -310,7 +311,7 @@ export function deleteSlashCommand(id: string, guildID?: string) {
return RequestManager.delete(endpoints.COMMANDS_ID(applicationID, id)); return RequestManager.delete(endpoints.COMMANDS_ID(applicationID, id));
} }
return RequestManager.delete( return RequestManager.delete(
endpoints.COMMANDS_GUILD_ID(applicationID, id, guildID), endpoints.COMMANDS_GUILD_ID(applicationID, guildID, id),
); );
} }
@@ -339,7 +340,7 @@ export function executeSlashCommand(
Date.now() + 900000, Date.now() + 900000,
); );
// IF NO MENTIONS ARE PROVIDED, FORCE DISABLE MENTIONS // If no mentions are provided, force disable mentions
if (!(options.data.allowed_mentions)) { if (!(options.data.allowed_mentions)) {
options.data.allowed_mentions = { parse: [] }; options.data.allowed_mentions = { parse: [] };
} }
+1 -1
View File
@@ -143,8 +143,8 @@ export const endpoints = {
`${baseEndpoints.BASE_URL}/applications/${applicationID}/commands/${commandID}`, `${baseEndpoints.BASE_URL}/applications/${applicationID}/commands/${commandID}`,
COMMANDS_GUILD_ID: ( COMMANDS_GUILD_ID: (
applicationID: string, applicationID: string,
commandID: string,
guildID: string, guildID: string,
commandID: string,
) => ) =>
`${baseEndpoints.BASE_URL}/applications/${applicationID}/guilds/${guildID}/commands/${commandID}`, `${baseEndpoints.BASE_URL}/applications/${applicationID}/guilds/${guildID}/commands/${commandID}`,