mirror of
https://github.com/discordeno/discordeno.git
synced 2026-06-02 08:50:07 +00:00
fix(plugins): await old function return (#2065)
* fix(plugins): await old function return * Update plugins/permissions/src/channels/stage.ts lol Co-authored-by: TriForMine <quentin.nicolini@hotmail.fr> Co-authored-by: TriForMine <quentin.nicolini@hotmail.fr>
This commit is contained in:
@@ -4,7 +4,7 @@ import { requireBotGuildPermissions } from "../permissions.ts";
|
||||
export default function deleteChannel(bot: BotWithCache) {
|
||||
const deleteChannelOld = bot.helpers.deleteChannel;
|
||||
|
||||
bot.helpers.deleteChannel = function (channelId, reason) {
|
||||
bot.helpers.deleteChannel = async function (channelId, reason) {
|
||||
const channel = bot.channels.get(channelId);
|
||||
|
||||
if (channel?.guildId) {
|
||||
@@ -32,6 +32,6 @@ export default function deleteChannel(bot: BotWithCache) {
|
||||
);
|
||||
}
|
||||
|
||||
return deleteChannelOld(channelId, reason);
|
||||
return await deleteChannelOld(channelId, reason);
|
||||
};
|
||||
}
|
||||
|
||||
@@ -4,13 +4,13 @@ import { requireBotChannelPermissions } from "../permissions.ts";
|
||||
export default function deleteChannelOverwrite(bot: BotWithCache) {
|
||||
const deleteChannelOverwriteOld = bot.helpers.deleteChannelOverwrite;
|
||||
|
||||
bot.helpers.deleteChannelOverwrite = function (channelId, overwriteId) {
|
||||
bot.helpers.deleteChannelOverwrite = async function (channelId, overwriteId) {
|
||||
const channel = bot.channels.get(channelId);
|
||||
|
||||
if (channel?.guildId) {
|
||||
requireBotChannelPermissions(bot, channelId, ["MANAGE_ROLES"]);
|
||||
}
|
||||
|
||||
return deleteChannelOverwriteOld(channelId, overwriteId);
|
||||
return await deleteChannelOverwriteOld(channelId, overwriteId);
|
||||
};
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@ import { requireBotChannelPermissions } from "../permissions.ts";
|
||||
export default function editChannel(bot: BotWithCache) {
|
||||
const editChannelOld = bot.helpers.editChannel;
|
||||
|
||||
bot.helpers.editChannel = function (channelId, options, reason) {
|
||||
bot.helpers.editChannel = async function (channelId, options, reason) {
|
||||
const channel = bot.channels.get(channelId);
|
||||
|
||||
if (channel?.guildId) {
|
||||
@@ -118,6 +118,6 @@ export default function editChannel(bot: BotWithCache) {
|
||||
}
|
||||
}
|
||||
|
||||
return editChannelOld(channelId, options, reason);
|
||||
return await editChannelOld(channelId, options, reason);
|
||||
};
|
||||
}
|
||||
|
||||
@@ -4,12 +4,12 @@ import { requireBotChannelPermissions } from "../permissions.ts";
|
||||
export default function editChannelOverwrite(bot: BotWithCache) {
|
||||
const editChannelOverwriteOld = bot.helpers.editChannelOverwrite;
|
||||
|
||||
bot.helpers.editChannelOverwrite = function (channelId, overwriteId, options) {
|
||||
bot.helpers.editChannelOverwrite = async function (channelId, overwriteId, options) {
|
||||
const channel = bot.channels.get(channelId);
|
||||
if (channel?.guildId) {
|
||||
requireBotChannelPermissions(bot, channelId, ["MANAGE_ROLES"]);
|
||||
}
|
||||
|
||||
return editChannelOverwriteOld(channelId, overwriteId, options);
|
||||
return await editChannelOverwriteOld(channelId, overwriteId, options);
|
||||
};
|
||||
}
|
||||
|
||||
@@ -4,12 +4,12 @@ import { requireBotChannelPermissions } from "../permissions.ts";
|
||||
export default function followChannel(bot: BotWithCache) {
|
||||
const followChannelOld = bot.helpers.followChannel;
|
||||
|
||||
bot.helpers.followChannel = function (sourceChannelId, targetChannelId) {
|
||||
bot.helpers.followChannel = async function (sourceChannelId, targetChannelId) {
|
||||
const channel = bot.channels.get(targetChannelId);
|
||||
if (channel?.guildId) {
|
||||
requireBotChannelPermissions(bot, channel, ["MANAGE_WEBHOOKS"]);
|
||||
}
|
||||
|
||||
return followChannelOld(sourceChannelId, targetChannelId);
|
||||
return await followChannelOld(sourceChannelId, targetChannelId);
|
||||
};
|
||||
}
|
||||
|
||||
@@ -4,12 +4,12 @@ import { requireBotChannelPermissions } from "../permissions.ts";
|
||||
export default function getChannelWebhooks(bot: BotWithCache) {
|
||||
const getChannelWebhooksOld = bot.helpers.getChannelWebhooks;
|
||||
|
||||
bot.helpers.getChannelWebhooks = function (channelId) {
|
||||
bot.helpers.getChannelWebhooks = async function (channelId) {
|
||||
const channel = bot.channels.get(channelId);
|
||||
if (channel?.guildId) {
|
||||
requireBotChannelPermissions(bot, channelId, ["MANAGE_WEBHOOKS"]);
|
||||
}
|
||||
|
||||
return getChannelWebhooksOld(channelId);
|
||||
return await getChannelWebhooksOld(channelId);
|
||||
};
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@ import { requireBotChannelPermissions } from "../permissions.ts";
|
||||
export function createStageInstance(bot: BotWithCache) {
|
||||
const createStageInstanceOld = bot.helpers.createStageInstance;
|
||||
|
||||
bot.helpers.createStageInstance = function (channelId, topic, privacyLevel) {
|
||||
bot.helpers.createStageInstance = async function (channelId, topic, privacyLevel) {
|
||||
if (!bot.utils.validateLength(topic, { max: 120, min: 1 })) {
|
||||
throw new Error(
|
||||
"The topic length for creating a stage instance must be between 1-120.",
|
||||
@@ -17,35 +17,35 @@ export function createStageInstance(bot: BotWithCache) {
|
||||
"MOVE_MEMBERS",
|
||||
]);
|
||||
|
||||
return createStageInstanceOld(channelId, topic, privacyLevel);
|
||||
return await createStageInstanceOld(channelId, topic, privacyLevel);
|
||||
};
|
||||
}
|
||||
|
||||
export function deleteStageInstance(bot: BotWithCache) {
|
||||
const deleteStageInstanceOld = bot.helpers.deleteStageInstance;
|
||||
|
||||
bot.helpers.deleteStageInstance = function (channelId) {
|
||||
bot.helpers.deleteStageInstance = async function (channelId) {
|
||||
requireBotChannelPermissions(bot, channelId, [
|
||||
"MANAGE_CHANNELS",
|
||||
"MUTE_MEMBERS",
|
||||
"MOVE_MEMBERS",
|
||||
]);
|
||||
|
||||
return deleteStageInstanceOld(channelId);
|
||||
return await deleteStageInstanceOld(channelId);
|
||||
};
|
||||
}
|
||||
|
||||
export function updateStageInstance(bot: BotWithCache) {
|
||||
const updateStageInstanceOld = bot.helpers.updateStageInstance;
|
||||
|
||||
bot.helpers.updateStageInstance = function (channelId, data) {
|
||||
bot.helpers.updateStageInstance = async function (channelId, data) {
|
||||
requireBotChannelPermissions(bot, channelId, [
|
||||
"MANAGE_CHANNELS",
|
||||
"MUTE_MEMBERS",
|
||||
"MOVE_MEMBERS",
|
||||
]);
|
||||
|
||||
return updateStageInstanceOld(channelId, data);
|
||||
return await updateStageInstanceOld(channelId, data);
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -4,9 +4,9 @@ import { requireBotGuildPermissions } from "../permissions.ts";
|
||||
export default function swapChannels(bot: BotWithCache) {
|
||||
const swapChannelsOld = bot.helpers.swapChannels;
|
||||
|
||||
bot.helpers.swapChannels = function (guildId, channelPositions) {
|
||||
bot.helpers.swapChannels = async function (guildId, channelPositions) {
|
||||
requireBotGuildPermissions(bot, guildId, ["MANAGE_CHANNELS"]);
|
||||
|
||||
return swapChannelsOld(guildId, channelPositions);
|
||||
return await swapChannelsOld(guildId, channelPositions);
|
||||
};
|
||||
}
|
||||
|
||||
@@ -21,6 +21,6 @@ export default function addToThread(bot: BotWithCache) {
|
||||
await requireBotChannelPermissions(bot, channel, ["SEND_MESSAGES"]);
|
||||
}
|
||||
|
||||
return addToThreadOld(threadId, userId);
|
||||
return await addToThreadOld(threadId, userId);
|
||||
};
|
||||
}
|
||||
|
||||
@@ -15,6 +15,6 @@ export default function getArchivedThreads(bot: BotWithCache) {
|
||||
);
|
||||
}
|
||||
|
||||
return getArchivedThreadsOld(channelId, options);
|
||||
return await getArchivedThreadsOld(channelId, options);
|
||||
};
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@ import { BotWithCache, GatewayIntents } from "../../../deps.ts";
|
||||
export default function getThreadMembers(bot: BotWithCache) {
|
||||
const getThreadMembersOld = bot.helpers.getThreadMembers;
|
||||
|
||||
bot.helpers.getThreadMembers = function (threadId) {
|
||||
bot.helpers.getThreadMembers = async function (threadId) {
|
||||
const hasIntent = bot.intents & GatewayIntents.GuildMembers;
|
||||
if (!hasIntent) {
|
||||
throw new Error(
|
||||
@@ -11,6 +11,6 @@ export default function getThreadMembers(bot: BotWithCache) {
|
||||
);
|
||||
}
|
||||
|
||||
return getThreadMembersOld(threadId);
|
||||
return await getThreadMembersOld(threadId);
|
||||
};
|
||||
}
|
||||
|
||||
@@ -3,13 +3,13 @@ import { BotWithCache } from "../../../deps.ts";
|
||||
export default function joinThread(bot: BotWithCache) {
|
||||
const joinThreadOld = bot.helpers.joinThread;
|
||||
|
||||
bot.helpers.joinThread = function (threadId) {
|
||||
bot.helpers.joinThread = async function (threadId) {
|
||||
const channel = bot.channels.get(threadId);
|
||||
|
||||
if (channel && !channel.archived) {
|
||||
throw new Error("You can not join an archived channel.");
|
||||
}
|
||||
|
||||
return joinThreadOld(threadId);
|
||||
return await joinThreadOld(threadId);
|
||||
};
|
||||
}
|
||||
|
||||
@@ -3,13 +3,13 @@ import { BotWithCache } from "../../../deps.ts";
|
||||
export default function leaveThread(bot: BotWithCache) {
|
||||
const leaveThreadOld = bot.helpers.leaveThread;
|
||||
|
||||
bot.helpers.leaveThread = function (threadId) {
|
||||
bot.helpers.leaveThread = async function (threadId) {
|
||||
const channel = bot.channels.get(threadId);
|
||||
|
||||
if (channel && !channel.archived) {
|
||||
throw new Error("You can not leave an archived channel.");
|
||||
}
|
||||
|
||||
return leaveThreadOld(threadId);
|
||||
return await leaveThreadOld(threadId);
|
||||
};
|
||||
}
|
||||
|
||||
@@ -28,6 +28,6 @@ export default function removeThreadMember(bot: BotWithCache) {
|
||||
}
|
||||
}
|
||||
|
||||
return removeThreadMemberOld(threadId, userId);
|
||||
return await removeThreadMemberOld(threadId, userId);
|
||||
};
|
||||
}
|
||||
|
||||
@@ -40,6 +40,6 @@ export default function connectToVoiceChannel(bot: BotWithCache) {
|
||||
|
||||
await requireBotChannelPermissions(bot, channel, permsNeeded);
|
||||
|
||||
return connectToVoiceChannelOld(guildId, channelId, options);
|
||||
return await connectToVoiceChannelOld(guildId, channelId, options);
|
||||
};
|
||||
}
|
||||
|
||||
@@ -4,40 +4,40 @@ import { requireBotGuildPermissions } from "./permissions.ts";
|
||||
export function addDiscoverySubcategory(bot: BotWithCache) {
|
||||
const addDiscoverySubcategoryOld = bot.helpers.addDiscoverySubcategory;
|
||||
|
||||
bot.helpers.addDiscoverySubcategory = function (guildId, categoryId) {
|
||||
bot.helpers.addDiscoverySubcategory = async function (guildId, categoryId) {
|
||||
requireBotGuildPermissions(bot, guildId, ["MANAGE_GUILD"]);
|
||||
|
||||
return addDiscoverySubcategoryOld(guildId, categoryId);
|
||||
return await addDiscoverySubcategoryOld(guildId, categoryId);
|
||||
};
|
||||
}
|
||||
|
||||
export function removeDiscoverySubcategory(bot: BotWithCache) {
|
||||
const removeDiscoverySubcategoryOld = bot.helpers.removeDiscoverySubcategory;
|
||||
|
||||
bot.helpers.removeDiscoverySubcategory = function (guildId, categoryId) {
|
||||
bot.helpers.removeDiscoverySubcategory = async function (guildId, categoryId) {
|
||||
requireBotGuildPermissions(bot, guildId, ["MANAGE_GUILD"]);
|
||||
|
||||
return removeDiscoverySubcategoryOld(guildId, categoryId);
|
||||
return await removeDiscoverySubcategoryOld(guildId, categoryId);
|
||||
};
|
||||
}
|
||||
|
||||
export function getDiscovery(bot: BotWithCache) {
|
||||
const getDiscoveryOld = bot.helpers.getDiscovery;
|
||||
|
||||
bot.helpers.getDiscovery = function (guildId) {
|
||||
bot.helpers.getDiscovery = async function (guildId) {
|
||||
requireBotGuildPermissions(bot, guildId, ["MANAGE_GUILD"]);
|
||||
|
||||
return getDiscoveryOld(guildId);
|
||||
return await getDiscoveryOld(guildId);
|
||||
};
|
||||
}
|
||||
|
||||
export function editDiscovery(bot: BotWithCache) {
|
||||
const editDiscoveryOld = bot.helpers.editDiscovery;
|
||||
|
||||
bot.helpers.editDiscovery = function (guildId, data) {
|
||||
bot.helpers.editDiscovery = async function (guildId, data) {
|
||||
requireBotGuildPermissions(bot, guildId, ["MANAGE_GUILD"]);
|
||||
|
||||
return editDiscoveryOld(guildId, data);
|
||||
return await editDiscoveryOld(guildId, data);
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -59,6 +59,6 @@ export default function editMember(bot: BotWithCache) {
|
||||
...requiredPerms,
|
||||
]);
|
||||
|
||||
return editMemberOld(guildId, memberId, options);
|
||||
return await editMemberOld(guildId, memberId, options);
|
||||
};
|
||||
}
|
||||
|
||||
@@ -4,30 +4,30 @@ import { requireBotGuildPermissions } from "./permissions.ts";
|
||||
export function createEmoji(bot: BotWithCache) {
|
||||
const createEmojiOld = bot.helpers.createEmoji;
|
||||
|
||||
bot.helpers.createEmoji = function (guildId, id) {
|
||||
bot.helpers.createEmoji = async function (guildId, id) {
|
||||
requireBotGuildPermissions(bot, guildId, ["MANAGE_EMOJIS"]);
|
||||
|
||||
return createEmojiOld(guildId, id);
|
||||
return await createEmojiOld(guildId, id);
|
||||
};
|
||||
}
|
||||
|
||||
export function deleteEmoji(bot: BotWithCache) {
|
||||
const deleteEmojiOld = bot.helpers.deleteEmoji;
|
||||
|
||||
bot.helpers.deleteEmoji = function (guildId, id) {
|
||||
bot.helpers.deleteEmoji = async function (guildId, id) {
|
||||
requireBotGuildPermissions(bot, guildId, ["MANAGE_EMOJIS"]);
|
||||
|
||||
return deleteEmojiOld(guildId, id);
|
||||
return await deleteEmojiOld(guildId, id);
|
||||
};
|
||||
}
|
||||
|
||||
export function editEmoji(bot: BotWithCache) {
|
||||
const editEmojiOld = bot.helpers.editEmoji;
|
||||
|
||||
bot.helpers.editEmoji = function (guildId, id, options) {
|
||||
bot.helpers.editEmoji = async function (guildId, id, options) {
|
||||
requireBotGuildPermissions(bot, guildId, ["MANAGE_EMOJIS"]);
|
||||
|
||||
return editEmojiOld(guildId, id, options);
|
||||
return await editEmojiOld(guildId, id, options);
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@ import { BotWithCache } from "../../deps.ts";
|
||||
export default function createGuild(bot: BotWithCache) {
|
||||
const createGuildOld = bot.helpers.createGuild;
|
||||
|
||||
bot.helpers.createGuild = function (options) {
|
||||
bot.helpers.createGuild = async function (options) {
|
||||
if (bot.guilds.size > 10) {
|
||||
throw new Error(
|
||||
"A bot can not create a guild if it is already in 10 guilds.",
|
||||
@@ -17,6 +17,6 @@ export default function createGuild(bot: BotWithCache) {
|
||||
throw new Error("The guild name must be between 2 and 100 characters.");
|
||||
}
|
||||
|
||||
return createGuildOld(options);
|
||||
return await createGuildOld(options);
|
||||
};
|
||||
}
|
||||
|
||||
@@ -3,12 +3,12 @@ import { BotWithCache } from "../../deps.ts";
|
||||
export default function deleteGuild(bot: BotWithCache) {
|
||||
const deleteGuildOld = bot.helpers.deleteGuild;
|
||||
|
||||
bot.helpers.deleteGuild = function (guildId) {
|
||||
bot.helpers.deleteGuild = async function (guildId) {
|
||||
const guild = bot.guilds.get(guildId);
|
||||
if (guild && guild.ownerId !== bot.id) {
|
||||
throw new Error("A bot can only delete a guild it owns.");
|
||||
}
|
||||
|
||||
return deleteGuildOld(guildId);
|
||||
return await deleteGuildOld(guildId);
|
||||
};
|
||||
}
|
||||
|
||||
@@ -4,9 +4,9 @@ import { requireBotGuildPermissions } from "../permissions.ts";
|
||||
export default function editGuild(bot: BotWithCache) {
|
||||
const editGuildOld = bot.helpers.editGuild;
|
||||
|
||||
bot.helpers.editGuild = function (guildId, options, shardId) {
|
||||
bot.helpers.editGuild = async function (guildId, options, shardId) {
|
||||
requireBotGuildPermissions(bot, guildId, ["MANAGE_GUILD"]);
|
||||
|
||||
return editGuildOld(guildId, options, shardId);
|
||||
return await editGuildOld(guildId, options, shardId);
|
||||
};
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@ import { requireBotChannelPermissions, requireBotGuildPermissions } from "../per
|
||||
export function createScheduledEvent(bot: BotWithCache) {
|
||||
const createScheduledEventOld = bot.helpers.createScheduledEvent;
|
||||
|
||||
bot.helpers.createScheduledEvent = function (guildId, options) {
|
||||
bot.helpers.createScheduledEvent = async function (guildId, options) {
|
||||
if (options.entityType === ScheduledEventEntityType.StageInstance) {
|
||||
if (!options.channelId) {
|
||||
throw new Error(
|
||||
@@ -64,14 +64,14 @@ export function createScheduledEvent(bot: BotWithCache) {
|
||||
"MANAGE_EVENTS",
|
||||
]);
|
||||
|
||||
return createScheduledEventOld(guildId, options);
|
||||
return await createScheduledEventOld(guildId, options);
|
||||
};
|
||||
}
|
||||
|
||||
export function editScheduledEvent(bot: BotWithCache) {
|
||||
const editScheduledEventOld = bot.helpers.editScheduledEvent;
|
||||
|
||||
bot.helpers.editScheduledEvent = function (guildId, eventId, options) {
|
||||
bot.helpers.editScheduledEvent = async function (guildId, eventId, options) {
|
||||
if (options.entityType === ScheduledEventEntityType.StageInstance) {
|
||||
if (!options.channelId) {
|
||||
throw new Error(
|
||||
@@ -131,7 +131,7 @@ export function editScheduledEvent(bot: BotWithCache) {
|
||||
"MANAGE_EVENTS",
|
||||
]);
|
||||
|
||||
return editScheduledEventOld(guildId, eventId, options);
|
||||
return await editScheduledEventOld(guildId, eventId, options);
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -4,9 +4,9 @@ import { requireBotGuildPermissions } from "../permissions.ts";
|
||||
export default function getAuditLogs(bot: BotWithCache) {
|
||||
const getAuditLogsOld = bot.helpers.getAuditLogs;
|
||||
|
||||
bot.helpers.getAuditLogs = function (guildId, options) {
|
||||
bot.helpers.getAuditLogs = async function (guildId, options) {
|
||||
requireBotGuildPermissions(bot, guildId, ["VIEW_AUDIT_LOG"]);
|
||||
|
||||
return getAuditLogsOld(guildId, options);
|
||||
return await getAuditLogsOld(guildId, options);
|
||||
};
|
||||
}
|
||||
|
||||
@@ -4,9 +4,9 @@ import { requireBotGuildPermissions } from "../permissions.ts";
|
||||
export default function getBan(bot: BotWithCache) {
|
||||
const getBanOld = bot.helpers.getBan;
|
||||
|
||||
bot.helpers.getBan = function (guildId, memberId) {
|
||||
bot.helpers.getBan = async function (guildId, memberId) {
|
||||
requireBotGuildPermissions(bot, guildId, ["BAN_MEMBERS"]);
|
||||
|
||||
return getBanOld(guildId, memberId);
|
||||
return await getBanOld(guildId, memberId);
|
||||
};
|
||||
}
|
||||
|
||||
@@ -4,9 +4,9 @@ import { requireBotGuildPermissions } from "../permissions.ts";
|
||||
export default function getBans(bot: BotWithCache) {
|
||||
const getBansOld = bot.helpers.getBans;
|
||||
|
||||
bot.helpers.getBans = function (guildId) {
|
||||
bot.helpers.getBans = async function (guildId) {
|
||||
requireBotGuildPermissions(bot, guildId, ["BAN_MEMBERS"]);
|
||||
|
||||
return getBansOld(guildId);
|
||||
return await getBansOld(guildId);
|
||||
};
|
||||
}
|
||||
|
||||
@@ -4,9 +4,9 @@ import { requireBotGuildPermissions } from "../permissions.ts";
|
||||
export default function getPruneCount(bot: BotWithCache) {
|
||||
const getPruneCountOld = bot.helpers.getPruneCount;
|
||||
|
||||
bot.helpers.getPruneCount = function (guildId, options) {
|
||||
bot.helpers.getPruneCount = async function (guildId, options) {
|
||||
requireBotGuildPermissions(bot, guildId, ["KICK_MEMBERS"]);
|
||||
|
||||
return getPruneCountOld(guildId, options);
|
||||
return await getPruneCountOld(guildId, options);
|
||||
};
|
||||
}
|
||||
|
||||
@@ -4,9 +4,9 @@ import { requireBotGuildPermissions } from "../permissions.ts";
|
||||
export default function getVanityUrl(bot: BotWithCache) {
|
||||
const getVanityUrlOld = bot.helpers.getVanityUrl;
|
||||
|
||||
bot.helpers.getVanityUrl = function (guildId) {
|
||||
bot.helpers.getVanityUrl = async function (guildId) {
|
||||
requireBotGuildPermissions(bot, guildId, ["MANAGE_GUILD"]);
|
||||
|
||||
return getVanityUrlOld(guildId);
|
||||
return await getVanityUrlOld(guildId);
|
||||
};
|
||||
}
|
||||
|
||||
@@ -4,23 +4,23 @@ import { requireBotGuildPermissions } from "../permissions.ts";
|
||||
export function getWelcomeScreen(bot: BotWithCache) {
|
||||
const getWelcomeScreenOld = bot.helpers.getWelcomeScreen;
|
||||
|
||||
bot.helpers.getWelcomeScreen = function (guildId) {
|
||||
bot.helpers.getWelcomeScreen = async function (guildId) {
|
||||
const guild = bot.guilds.get(guildId);
|
||||
if (!guild?.welcomeScreen) {
|
||||
requireBotGuildPermissions(bot, guildId, ["MANAGE_GUILD"]);
|
||||
}
|
||||
|
||||
return getWelcomeScreenOld(guildId);
|
||||
return await getWelcomeScreenOld(guildId);
|
||||
};
|
||||
}
|
||||
|
||||
export function editWelcomeScreen(bot: BotWithCache) {
|
||||
const editWelcomeScreenOld = bot.helpers.editWelcomeScreen;
|
||||
|
||||
bot.helpers.editWelcomeScreen = function (guildId, options) {
|
||||
bot.helpers.editWelcomeScreen = async function (guildId, options) {
|
||||
requireBotGuildPermissions(bot, guildId, ["MANAGE_GUILD"]);
|
||||
|
||||
return editWelcomeScreenOld(guildId, options);
|
||||
return await editWelcomeScreenOld(guildId, options);
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -4,10 +4,10 @@ import { requireBotGuildPermissions } from "../permissions.ts";
|
||||
export function editWidget(bot: BotWithCache) {
|
||||
const editWidgetOld = bot.helpers.editWidget;
|
||||
|
||||
bot.helpers.editWidget = function (guildId, enabled, channelId) {
|
||||
bot.helpers.editWidget = async function (guildId, enabled, channelId) {
|
||||
requireBotGuildPermissions(bot, guildId, ["MANAGE_GUILD"]);
|
||||
|
||||
return editWidgetOld(guildId, enabled, channelId);
|
||||
return await editWidgetOld(guildId, enabled, channelId);
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -4,20 +4,20 @@ import { requireBotGuildPermissions } from "./permissions.ts";
|
||||
export function deleteIntegration(bot: BotWithCache) {
|
||||
const deleteIntegrationOld = bot.helpers.deleteIntegration;
|
||||
|
||||
bot.helpers.deleteIntegration = function (guildId, id) {
|
||||
bot.helpers.deleteIntegration = async function (guildId, id) {
|
||||
requireBotGuildPermissions(bot, guildId, ["MANAGE_GUILD"]);
|
||||
|
||||
return deleteIntegrationOld(guildId, id);
|
||||
return await deleteIntegrationOld(guildId, id);
|
||||
};
|
||||
}
|
||||
|
||||
export function getIntegrations(bot: BotWithCache) {
|
||||
const getIntegrationsOld = bot.helpers.getIntegrations;
|
||||
|
||||
bot.helpers.getIntegrations = function (guildId) {
|
||||
bot.helpers.getIntegrations = async function (guildId) {
|
||||
requireBotGuildPermissions(bot, guildId, ["MANAGE_GUILD"]);
|
||||
|
||||
return getIntegrationsOld(guildId);
|
||||
return await getIntegrationsOld(guildId);
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -76,7 +76,7 @@ export function validateApplicationCommandOptions(
|
||||
export function createApplicationCommand(bot: BotWithCache) {
|
||||
const createApplicationCommandOld = bot.helpers.createApplicationCommand;
|
||||
|
||||
bot.helpers.createApplicationCommand = function (options, guildId) {
|
||||
bot.helpers.createApplicationCommand = async function (options, guildId) {
|
||||
const isChatInput = !options.type ||
|
||||
options.type === ApplicationCommandTypes.ChatInput;
|
||||
|
||||
@@ -135,14 +135,14 @@ export function createApplicationCommand(bot: BotWithCache) {
|
||||
options.options = validateApplicationCommandOptions(bot, options.options);
|
||||
}
|
||||
|
||||
return createApplicationCommandOld(options, guildId);
|
||||
return await createApplicationCommandOld(options, guildId);
|
||||
};
|
||||
}
|
||||
|
||||
export function editInteractionResponse(bot: BotWithCache) {
|
||||
const editInteractionResponseOld = bot.helpers.editInteractionResponse;
|
||||
|
||||
bot.helpers.editInteractionResponse = function (token, options) {
|
||||
bot.helpers.editInteractionResponse = async function (token, options) {
|
||||
if (options.content && options.content.length > 2000) {
|
||||
throw Error(bot.constants.Errors.MESSAGE_MAX_LENGTH);
|
||||
}
|
||||
@@ -191,7 +191,7 @@ export function editInteractionResponse(bot: BotWithCache) {
|
||||
}
|
||||
}
|
||||
|
||||
return editInteractionResponseOld(token, options);
|
||||
return await editInteractionResponseOld(token, options);
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@ import { AllowedMentionsTypes, BotWithCache } from "../../deps.ts";
|
||||
export default function editFollowupMessage(bot: BotWithCache) {
|
||||
const editFollowupMessageOld = bot.helpers.editFollowupMessage;
|
||||
|
||||
bot.helpers.editFollowupMessage = function (
|
||||
bot.helpers.editFollowupMessage = async function (
|
||||
token,
|
||||
messageId,
|
||||
options,
|
||||
@@ -56,6 +56,6 @@ export default function editFollowupMessage(bot: BotWithCache) {
|
||||
}
|
||||
}
|
||||
|
||||
return editFollowupMessageOld(token, messageId, options);
|
||||
return await editFollowupMessageOld(token, messageId, options);
|
||||
};
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@ import { requireBotChannelPermissions } from "./permissions.ts";
|
||||
export function createInvite(bot: BotWithCache) {
|
||||
const createInviteOld = bot.helpers.createInvite;
|
||||
|
||||
bot.helpers.createInvite = function (channelId, options = {}) {
|
||||
bot.helpers.createInvite = async function (channelId, options = {}) {
|
||||
if (options.maxAge && (options.maxAge < 0 || options.maxAge > 604800)) {
|
||||
throw new Error(
|
||||
"The max age for an invite must be between 0 and 604800.",
|
||||
@@ -16,27 +16,27 @@ export function createInvite(bot: BotWithCache) {
|
||||
|
||||
requireBotChannelPermissions(bot, channelId, ["CREATE_INSTANT_INVITE"]);
|
||||
|
||||
return createInviteOld(channelId, options);
|
||||
return await createInviteOld(channelId, options);
|
||||
};
|
||||
}
|
||||
|
||||
export function getChannelInvites(bot: BotWithCache) {
|
||||
const getChannelInvitesOld = bot.helpers.getChannelInvites;
|
||||
|
||||
bot.helpers.getChannelInvites = function (channelId) {
|
||||
bot.helpers.getChannelInvites = async function (channelId) {
|
||||
requireBotChannelPermissions(bot, channelId, ["MANAGE_CHANNELS"]);
|
||||
|
||||
return getChannelInvitesOld(channelId);
|
||||
return await getChannelInvitesOld(channelId);
|
||||
};
|
||||
}
|
||||
|
||||
export function getInvites(bot: BotWithCache) {
|
||||
const getInvitesOld = bot.helpers.getInvites;
|
||||
|
||||
bot.helpers.getInvites = function (guildId) {
|
||||
bot.helpers.getInvites = async function (guildId) {
|
||||
requireBotChannelPermissions(bot, guildId, ["MANAGE_GUILD"]);
|
||||
|
||||
return getInvitesOld(guildId);
|
||||
return await getInvitesOld(guildId);
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -4,20 +4,20 @@ import { requireBotGuildPermissions } from "../permissions.ts";
|
||||
export function banMember(bot: BotWithCache) {
|
||||
const banMemberOld = bot.helpers.banMember;
|
||||
|
||||
bot.helpers.banMember = function (guildId, id, options) {
|
||||
bot.helpers.banMember = async function (guildId, id, options) {
|
||||
requireBotGuildPermissions(bot, guildId, ["BAN_MEMBERS"]);
|
||||
|
||||
return banMemberOld(guildId, id, options);
|
||||
return await banMemberOld(guildId, id, options);
|
||||
};
|
||||
}
|
||||
|
||||
export function unbanMember(bot: BotWithCache) {
|
||||
const unbanMemberOld = bot.helpers.unbanMember;
|
||||
|
||||
bot.helpers.unbanMember = function (guildId, id) {
|
||||
bot.helpers.unbanMember = async function (guildId, id) {
|
||||
requireBotGuildPermissions(bot, guildId, ["BAN_MEMBERS"]);
|
||||
|
||||
return unbanMemberOld(guildId, id);
|
||||
return await unbanMemberOld(guildId, id);
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -4,9 +4,9 @@ import { requireBotGuildPermissions } from "../permissions.ts";
|
||||
export default function editBotNickname(bot: BotWithCache) {
|
||||
const editBotNicknameOld = bot.helpers.editBotNickname;
|
||||
|
||||
bot.helpers.editBotNickname = function (guildId, options) {
|
||||
bot.helpers.editBotNickname = async function (guildId, options) {
|
||||
requireBotGuildPermissions(bot, guildId, ["CHANGE_NICKNAME"]);
|
||||
|
||||
return editBotNicknameOld(guildId, options);
|
||||
return await editBotNicknameOld(guildId, options);
|
||||
};
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@ import { requireBotGuildPermissions } from "../permissions.ts";
|
||||
export default function editMember(bot: BotWithCache) {
|
||||
const editMemberOld = bot.helpers.editMember;
|
||||
|
||||
bot.helpers.editMember = function (guildId, memberId, options) {
|
||||
bot.helpers.editMember = async function (guildId, memberId, options) {
|
||||
const requiredPerms: PermissionStrings[] = [];
|
||||
if (options.roles) requiredPerms.push("MANAGE_ROLES");
|
||||
// NULL IS ALLOWED
|
||||
@@ -17,6 +17,6 @@ export default function editMember(bot: BotWithCache) {
|
||||
requireBotGuildPermissions(bot, guildId, requiredPerms);
|
||||
}
|
||||
|
||||
return editMemberOld(guildId, memberId, options);
|
||||
return await editMemberOld(guildId, memberId, options);
|
||||
};
|
||||
}
|
||||
|
||||
@@ -4,9 +4,9 @@ import { requireBotGuildPermissions } from "../permissions.ts";
|
||||
export default function kickMember(bot: BotWithCache) {
|
||||
const editMemberOld = bot.helpers.kickMember;
|
||||
|
||||
bot.helpers.kickMember = function (guildId, memberId, reason) {
|
||||
bot.helpers.kickMember = async function (guildId, memberId, reason) {
|
||||
requireBotGuildPermissions(bot, guildId, ["KICK_MEMBERS"]);
|
||||
|
||||
return editMemberOld(guildId, memberId, reason);
|
||||
return await editMemberOld(guildId, memberId, reason);
|
||||
};
|
||||
}
|
||||
|
||||
@@ -4,9 +4,9 @@ import { requireBotGuildPermissions } from "../permissions.ts";
|
||||
export default function pruneMembers(bot: BotWithCache) {
|
||||
const pruneMembersOld = bot.helpers.pruneMembers;
|
||||
|
||||
bot.helpers.pruneMembers = function (guildId, options) {
|
||||
bot.helpers.pruneMembers = async function (guildId, options) {
|
||||
requireBotGuildPermissions(bot, guildId, ["KICK_MEMBERS"]);
|
||||
|
||||
return pruneMembersOld(guildId, options);
|
||||
return await pruneMembersOld(guildId, options);
|
||||
};
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@ import { requireBotChannelPermissions } from "../permissions.ts";
|
||||
export function sendMessage(bot: BotWithCache) {
|
||||
const sendMessageOld = bot.helpers.sendMessage;
|
||||
|
||||
bot.helpers.sendMessage = function (
|
||||
bot.helpers.sendMessage = async function (
|
||||
channelId,
|
||||
content,
|
||||
) {
|
||||
@@ -90,7 +90,7 @@ export function sendMessage(bot: BotWithCache) {
|
||||
}
|
||||
}
|
||||
|
||||
return sendMessageOld(channelId, content);
|
||||
return await sendMessageOld(channelId, content);
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@ import { requireBotChannelPermissions } from "../permissions.ts";
|
||||
export function deleteMessage(bot: BotWithCache) {
|
||||
const deleteMessageOld = bot.helpers.deleteMessage;
|
||||
|
||||
bot.helpers.deleteMessage = function (
|
||||
bot.helpers.deleteMessage = async function (
|
||||
channelId,
|
||||
messageId,
|
||||
reason,
|
||||
@@ -27,14 +27,14 @@ export function deleteMessage(bot: BotWithCache) {
|
||||
);
|
||||
}
|
||||
|
||||
return deleteMessageOld(channelId, messageId, reason, milliseconds);
|
||||
return await deleteMessageOld(channelId, messageId, reason, milliseconds);
|
||||
};
|
||||
}
|
||||
|
||||
export function deleteMessages(bot: BotWithCache) {
|
||||
const deleteMessagesOld = bot.helpers.deleteMessages;
|
||||
|
||||
bot.helpers.deleteMessages = function (
|
||||
bot.helpers.deleteMessages = async function (
|
||||
channelId,
|
||||
ids,
|
||||
reason,
|
||||
@@ -70,7 +70,7 @@ export function deleteMessages(bot: BotWithCache) {
|
||||
"MANAGE_MESSAGES",
|
||||
]);
|
||||
|
||||
return deleteMessagesOld(channelId, ids, reason);
|
||||
return await deleteMessagesOld(channelId, ids, reason);
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@ import { requireBotChannelPermissions } from "../permissions.ts";
|
||||
export function getMessage(bot: BotWithCache) {
|
||||
const getMessageOld = bot.helpers.getMessage;
|
||||
|
||||
bot.helpers.getMessage = function (
|
||||
bot.helpers.getMessage = async function (
|
||||
channelId,
|
||||
messageId,
|
||||
) {
|
||||
@@ -15,14 +15,14 @@ export function getMessage(bot: BotWithCache) {
|
||||
]);
|
||||
}
|
||||
|
||||
return getMessageOld(channelId, messageId);
|
||||
return await getMessageOld(channelId, messageId);
|
||||
};
|
||||
}
|
||||
|
||||
export function getMessages(bot: BotWithCache) {
|
||||
const getMessagesOld = bot.helpers.getMessages;
|
||||
|
||||
bot.helpers.getMessages = function (
|
||||
bot.helpers.getMessages = async function (
|
||||
channelId,
|
||||
options,
|
||||
) {
|
||||
@@ -34,7 +34,7 @@ export function getMessages(bot: BotWithCache) {
|
||||
]);
|
||||
}
|
||||
|
||||
return getMessagesOld(channelId, options);
|
||||
return await getMessagesOld(channelId, options);
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@ import { requireBotChannelPermissions } from "../permissions.ts";
|
||||
export function pinMessage(bot: BotWithCache) {
|
||||
const pinMessageOld = bot.helpers.pinMessage;
|
||||
|
||||
bot.helpers.pinMessage = function (
|
||||
bot.helpers.pinMessage = async function (
|
||||
channelId,
|
||||
messageId,
|
||||
) {
|
||||
@@ -12,14 +12,14 @@ export function pinMessage(bot: BotWithCache) {
|
||||
"MANAGE_MESSAGES",
|
||||
]);
|
||||
|
||||
return pinMessageOld(channelId, messageId);
|
||||
return await pinMessageOld(channelId, messageId);
|
||||
};
|
||||
}
|
||||
|
||||
export function unpinMessage(bot: BotWithCache) {
|
||||
const unpinMessageOld = bot.helpers.unpinMessage;
|
||||
|
||||
bot.helpers.unpinMessage = function (
|
||||
bot.helpers.unpinMessage = async function (
|
||||
channelId,
|
||||
messageId,
|
||||
) {
|
||||
@@ -27,7 +27,7 @@ export function unpinMessage(bot: BotWithCache) {
|
||||
"MANAGE_MESSAGES",
|
||||
]);
|
||||
|
||||
return unpinMessageOld(channelId, messageId);
|
||||
return await unpinMessageOld(channelId, messageId);
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -4,20 +4,20 @@ import { requireBotChannelPermissions } from "../permissions.ts";
|
||||
export function addReaction(bot: BotWithCache) {
|
||||
const addReactionOld = bot.helpers.addReaction;
|
||||
|
||||
bot.helpers.addReaction = function (channelId, messageId, reaction) {
|
||||
bot.helpers.addReaction = async function (channelId, messageId, reaction) {
|
||||
requireBotChannelPermissions(bot, channelId, [
|
||||
"READ_MESSAGE_HISTORY",
|
||||
"ADD_REACTIONS",
|
||||
]);
|
||||
|
||||
return addReactionOld(channelId, messageId, reaction);
|
||||
return await addReactionOld(channelId, messageId, reaction);
|
||||
};
|
||||
}
|
||||
|
||||
export function addReactions(bot: BotWithCache) {
|
||||
const addReactionsOld = bot.helpers.addReactions;
|
||||
|
||||
bot.helpers.addReactions = function (
|
||||
bot.helpers.addReactions = async function (
|
||||
channelId,
|
||||
messageId,
|
||||
reactions,
|
||||
@@ -28,14 +28,14 @@ export function addReactions(bot: BotWithCache) {
|
||||
"ADD_REACTIONS",
|
||||
]);
|
||||
|
||||
return addReactionsOld(channelId, messageId, reactions, ordered);
|
||||
return await addReactionsOld(channelId, messageId, reactions, ordered);
|
||||
};
|
||||
}
|
||||
|
||||
export function removeReaction(bot: BotWithCache) {
|
||||
const removeReactionOld = bot.helpers.removeReaction;
|
||||
|
||||
bot.helpers.removeReaction = function (
|
||||
bot.helpers.removeReaction = async function (
|
||||
channelId,
|
||||
messageId,
|
||||
reactions,
|
||||
@@ -48,14 +48,14 @@ export function removeReaction(bot: BotWithCache) {
|
||||
]);
|
||||
}
|
||||
|
||||
return removeReactionOld(channelId, messageId, reactions, options);
|
||||
return await removeReactionOld(channelId, messageId, reactions, options);
|
||||
};
|
||||
}
|
||||
|
||||
export function removeAllReactions(bot: BotWithCache) {
|
||||
const removeAllReactionsOld = bot.helpers.removeAllReactions;
|
||||
|
||||
bot.helpers.removeAllReactions = function (
|
||||
bot.helpers.removeAllReactions = async function (
|
||||
channelId,
|
||||
messageId,
|
||||
) {
|
||||
@@ -63,14 +63,14 @@ export function removeAllReactions(bot: BotWithCache) {
|
||||
"MANAGE_MESSAGES",
|
||||
]);
|
||||
|
||||
return removeAllReactionsOld(channelId, messageId);
|
||||
return await removeAllReactionsOld(channelId, messageId);
|
||||
};
|
||||
}
|
||||
|
||||
export function removeReactionEmoji(bot: BotWithCache) {
|
||||
const removeReactionEmojiOld = bot.helpers.removeReactionEmoji;
|
||||
|
||||
bot.helpers.removeReactionEmoji = function (
|
||||
bot.helpers.removeReactionEmoji = async function (
|
||||
channelId,
|
||||
messageId,
|
||||
reaction,
|
||||
@@ -79,7 +79,7 @@ export function removeReactionEmoji(bot: BotWithCache) {
|
||||
"MANAGE_MESSAGES",
|
||||
]);
|
||||
|
||||
return removeReactionEmojiOld(channelId, messageId, reaction);
|
||||
return await removeReactionEmojiOld(channelId, messageId, reaction);
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@ import { BotWithCache } from "../../deps.ts";
|
||||
export function editBotProfile(bot: BotWithCache) {
|
||||
const editBotProfileOld = bot.helpers.editBotProfile;
|
||||
|
||||
bot.helpers.editBotProfile = function (
|
||||
bot.helpers.editBotProfile = async function (
|
||||
options,
|
||||
) {
|
||||
// Nothing was edited
|
||||
@@ -36,7 +36,7 @@ export function editBotProfile(bot: BotWithCache) {
|
||||
}
|
||||
}
|
||||
|
||||
return editBotProfileOld(options);
|
||||
return await editBotProfileOld(options);
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@ import { highestRole, requireBotGuildPermissions } from "../permissions.ts";
|
||||
export default function addRole(bot: BotWithCache) {
|
||||
const addRoleOld = bot.helpers.addRole;
|
||||
|
||||
bot.helpers.addRole = function (
|
||||
bot.helpers.addRole = async function (
|
||||
guildId,
|
||||
memberId,
|
||||
roleId,
|
||||
@@ -27,6 +27,6 @@ export default function addRole(bot: BotWithCache) {
|
||||
requireBotGuildPermissions(bot, guild, ["MANAGE_ROLES"]);
|
||||
}
|
||||
|
||||
return addRoleOld(guildId, memberId, roleId, reason);
|
||||
return await addRoleOld(guildId, memberId, roleId, reason);
|
||||
};
|
||||
}
|
||||
|
||||
@@ -4,13 +4,13 @@ import { requireBotGuildPermissions } from "../permissions.ts";
|
||||
export default function createRole(bot: BotWithCache) {
|
||||
const createRoleOld = bot.helpers.createRole;
|
||||
|
||||
bot.helpers.createRole = function (
|
||||
bot.helpers.createRole = async function (
|
||||
guildId,
|
||||
options,
|
||||
reason,
|
||||
) {
|
||||
requireBotGuildPermissions(bot, guildId, ["MANAGE_ROLES"]);
|
||||
|
||||
return createRoleOld(guildId, options, reason);
|
||||
return await createRoleOld(guildId, options, reason);
|
||||
};
|
||||
}
|
||||
|
||||
@@ -4,12 +4,12 @@ import { requireBotGuildPermissions } from "../permissions.ts";
|
||||
export default function deleteRole(bot: BotWithCache) {
|
||||
const deleteRoleOld = bot.helpers.deleteRole;
|
||||
|
||||
bot.helpers.deleteRole = function (
|
||||
bot.helpers.deleteRole = async function (
|
||||
guildId,
|
||||
id,
|
||||
) {
|
||||
requireBotGuildPermissions(bot, guildId, ["MANAGE_ROLES"]);
|
||||
|
||||
return deleteRoleOld(guildId, id);
|
||||
return await deleteRoleOld(guildId, id);
|
||||
};
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@ import { highestRole, requireBotGuildPermissions } from "../permissions.ts";
|
||||
export default function editRole(bot: BotWithCache) {
|
||||
const editRoleOld = bot.helpers.editRole;
|
||||
|
||||
bot.helpers.editRole = function (
|
||||
bot.helpers.editRole = async function (
|
||||
guildId,
|
||||
id,
|
||||
options,
|
||||
@@ -26,6 +26,6 @@ export default function editRole(bot: BotWithCache) {
|
||||
requireBotGuildPermissions(bot, guild, ["MANAGE_ROLES"]);
|
||||
}
|
||||
|
||||
return editRoleOld(guildId, id, options);
|
||||
return await editRoleOld(guildId, id, options);
|
||||
};
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@ import { highestRole, requireBotGuildPermissions } from "../permissions.ts";
|
||||
export default function removeRole(bot: BotWithCache) {
|
||||
const removeRoleOld = bot.helpers.removeRole;
|
||||
|
||||
bot.helpers.removeRole = function (
|
||||
bot.helpers.removeRole = async function (
|
||||
guildId,
|
||||
memberId,
|
||||
roleId,
|
||||
@@ -27,6 +27,6 @@ export default function removeRole(bot: BotWithCache) {
|
||||
requireBotGuildPermissions(bot, guild, ["MANAGE_ROLES"]);
|
||||
}
|
||||
|
||||
return removeRoleOld(guildId, memberId, roleId, reason);
|
||||
return await removeRoleOld(guildId, memberId, roleId, reason);
|
||||
};
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@ import { requireBotChannelPermissions } from "../permissions.ts";
|
||||
export default function createWebhook(bot: BotWithCache) {
|
||||
const createWebhookOld = bot.helpers.createWebhook;
|
||||
|
||||
bot.helpers.createWebhook = function (channelId, options) {
|
||||
bot.helpers.createWebhook = async function (channelId, options) {
|
||||
requireBotChannelPermissions(bot, channelId, ["MANAGE_WEBHOOKS"]);
|
||||
|
||||
if (
|
||||
@@ -17,6 +17,6 @@ export default function createWebhook(bot: BotWithCache) {
|
||||
);
|
||||
}
|
||||
|
||||
return createWebhookOld(channelId, options);
|
||||
return await createWebhookOld(channelId, options);
|
||||
};
|
||||
}
|
||||
|
||||
@@ -4,9 +4,9 @@ import { requireBotChannelPermissions } from "../permissions.ts";
|
||||
export default function deleteWebhook(bot: BotWithCache) {
|
||||
const deleteWebhookOld = bot.helpers.deleteWebhook;
|
||||
|
||||
bot.helpers.deleteWebhook = function (channelId, options) {
|
||||
bot.helpers.deleteWebhook = async function (channelId, options) {
|
||||
requireBotChannelPermissions(bot, channelId, ["MANAGE_WEBHOOKS"]);
|
||||
|
||||
return deleteWebhookOld(channelId, options);
|
||||
return await deleteWebhookOld(channelId, options);
|
||||
};
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@ import { requireBotChannelPermissions } from "../permissions.ts";
|
||||
export default function editWebhook(bot: BotWithCache) {
|
||||
const editWebhookOld = bot.helpers.editWebhook;
|
||||
|
||||
bot.helpers.editWebhook = function (channelId, webhookId, options) {
|
||||
bot.helpers.editWebhook = async function (channelId, webhookId, options) {
|
||||
requireBotChannelPermissions(bot, channelId, ["MANAGE_WEBHOOKS"]);
|
||||
if (options.name) {
|
||||
if (
|
||||
@@ -18,6 +18,6 @@ export default function editWebhook(bot: BotWithCache) {
|
||||
}
|
||||
}
|
||||
|
||||
return editWebhookOld(channelId, webhookId, options);
|
||||
return await editWebhookOld(channelId, webhookId, options);
|
||||
};
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@ import { validateComponents } from "../components.ts";
|
||||
export function editWebhookMessage(bot: BotWithCache) {
|
||||
const editWebhookMessageOld = bot.helpers.editWebhookMessage;
|
||||
|
||||
bot.helpers.editWebhookMessage = function (
|
||||
bot.helpers.editWebhookMessage = async function (
|
||||
webhookId,
|
||||
webhookToken,
|
||||
options,
|
||||
@@ -62,7 +62,7 @@ export function editWebhookMessage(bot: BotWithCache) {
|
||||
|
||||
if (options.components) validateComponents(bot, options.components);
|
||||
|
||||
return editWebhookMessageOld(webhookId, webhookToken, options);
|
||||
return await editWebhookMessageOld(webhookId, webhookToken, options);
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@ import { validateComponents } from "../components.ts";
|
||||
export default function sendWebhook(bot: BotWithCache) {
|
||||
const sendWebhookOld = bot.helpers.sendWebhook;
|
||||
|
||||
bot.helpers.sendWebhook = function (webhookId, webhookToken, options) {
|
||||
bot.helpers.sendWebhook = async function (webhookId, webhookToken, options) {
|
||||
if (
|
||||
options.content &&
|
||||
!bot.utils.validateLength(options.content, { max: 2000 })
|
||||
@@ -62,6 +62,6 @@ export default function sendWebhook(bot: BotWithCache) {
|
||||
);
|
||||
}
|
||||
|
||||
return sendWebhookOld(webhookId, webhookToken, options);
|
||||
return await sendWebhookOld(webhookId, webhookToken, options);
|
||||
};
|
||||
}
|
||||
|
||||
16
r.ts
Normal file
16
r.ts
Normal file
@@ -0,0 +1,16 @@
|
||||
import { createBot } from "./bot.ts";
|
||||
|
||||
const bot = createBot({
|
||||
token: "",
|
||||
botId: 1n,
|
||||
events: {},
|
||||
intents: [],
|
||||
});
|
||||
|
||||
await bot.helpers.deleteWebhookMessage(
|
||||
943082834103500820n,
|
||||
"LgGfOmEpEh13BP-u31TCUADsr0cE0LCn5ZTQM-RL1toQf0YUJBV5gd8tdpK0gC8c3J7Z",
|
||||
943083038240301056n,
|
||||
);
|
||||
|
||||
// https://discord.com/api/webhooks/943082834103500820/LgGfOmEpEh13BP-u31TCUADsr0cE0LCn5ZTQM-RL1toQf0YUJBV5gd8tdpK0gC8c3J7Z
|
||||
Reference in New Issue
Block a user