mirror of
https://github.com/discordeno/discordeno.git
synced 2026-06-03 09:20:08 +00:00
refactor: typings using ReturnType (#2105)
* fix: check new types idea * fix: type errors * fix: new style * fix: more cleanup * fix: more cleanup * fix: cleanup audit logs * fix: cleanup stickers * fix: cleanup integrations * fix: more cleanup * fix: organize into 1 place * fix: few errors * fix: some broken import fixes * fix: quite a lot of fixes across the board * fix: more fixes for broken imports * fix: more fixes for broken imports * fix: handler imports * fix: all remaining import errors * fix: more errors needing fixes * fix: clearing up transformers * fix: few moer types * fix: more cleanup of extra types * fix: fmt * fix: cleanup discordeno file * Nuke Base Types (#2102) * fix: cleanup snake stuff * convert camelCase to snake_case (#2103) * fix: add camelize * fix: finalize remaining errors * fix: imports in test Co-authored-by: LTS20050703 <87189679+lts20050703@users.noreply.github.com>
This commit is contained in:
20
plugins/cache/src/setupCacheEdits.ts
vendored
20
plugins/cache/src/setupCacheEdits.ts
vendored
@@ -1,12 +1,4 @@
|
||||
import type {
|
||||
Bot,
|
||||
GuildMemberAdd,
|
||||
GuildMemberRemove,
|
||||
MessageReactionAdd,
|
||||
MessageReactionRemove,
|
||||
MessageReactionRemoveAll,
|
||||
SnakeCasedPropertiesDeep,
|
||||
} from "../deps.ts";
|
||||
import type { Bot, DiscordGuildMemberAdd, DiscordGuildMemberRemove, DiscordMessageReactionAdd, DiscordMessageReactionRemove, DiscordMessageReactionRemoveAll } from "../deps.ts";
|
||||
import type { BotWithCache } from "./addCacheCollections.ts";
|
||||
|
||||
export function setupCacheEdits<B extends Bot>(bot: BotWithCache<B>) {
|
||||
@@ -19,7 +11,7 @@ export function setupCacheEdits<B extends Bot>(bot: BotWithCache<B>) {
|
||||
} = bot.handlers;
|
||||
|
||||
bot.handlers.GUILD_MEMBER_ADD = function (_, data, shardId) {
|
||||
const payload = data.d as SnakeCasedPropertiesDeep<GuildMemberAdd>;
|
||||
const payload = data.d as DiscordGuildMemberAdd;
|
||||
|
||||
const guild = bot.guilds.get(bot.transformers.snowflake(payload.guild_id));
|
||||
|
||||
@@ -29,7 +21,7 @@ export function setupCacheEdits<B extends Bot>(bot: BotWithCache<B>) {
|
||||
};
|
||||
|
||||
bot.handlers.GUILD_MEMBER_REMOVE = function (_, data, shardId) {
|
||||
const payload = data.d as SnakeCasedPropertiesDeep<GuildMemberRemove>;
|
||||
const payload = data.d as DiscordGuildMemberRemove;
|
||||
|
||||
const guild = bot.guilds.get(bot.transformers.snowflake(payload.guild_id));
|
||||
|
||||
@@ -39,7 +31,7 @@ export function setupCacheEdits<B extends Bot>(bot: BotWithCache<B>) {
|
||||
};
|
||||
|
||||
bot.handlers.MESSAGE_REACTION_ADD = function (_, data, shardId) {
|
||||
const payload = data.d as SnakeCasedPropertiesDeep<MessageReactionAdd>;
|
||||
const payload = data.d as DiscordMessageReactionAdd;
|
||||
|
||||
const messageId = bot.transformers.snowflake(payload.message_id);
|
||||
const message = bot.messages.get(messageId);
|
||||
@@ -74,7 +66,7 @@ export function setupCacheEdits<B extends Bot>(bot: BotWithCache<B>) {
|
||||
};
|
||||
|
||||
bot.handlers.MESSAGE_REACTION_REMOVE = function (_, data, shardId) {
|
||||
const payload = data.d as SnakeCasedPropertiesDeep<MessageReactionRemove>;
|
||||
const payload = data.d as DiscordMessageReactionRemove;
|
||||
|
||||
const messageId = bot.transformers.snowflake(payload.message_id);
|
||||
const message = bot.messages.get(messageId);
|
||||
@@ -105,7 +97,7 @@ export function setupCacheEdits<B extends Bot>(bot: BotWithCache<B>) {
|
||||
};
|
||||
|
||||
bot.handlers.MESSAGE_REACTION_REMOVE_ALL = function (_, data, shardId) {
|
||||
const payload = data.d as SnakeCasedPropertiesDeep<MessageReactionRemoveAll>;
|
||||
const payload = data.d as DiscordMessageReactionRemoveAll;
|
||||
|
||||
const messageId = bot.transformers.snowflake(payload.message_id);
|
||||
const message = bot.messages.get(messageId);
|
||||
|
||||
Reference in New Issue
Block a user