From 0258722f24d96c0cc99a002553e01b4efbbb4399 Mon Sep 17 00:00:00 2001 From: Skillz4Killz <23035000+Skillz4Killz@users.noreply.github.com> Date: Wed, 18 May 2022 16:12:51 +0000 Subject: [PATCH] fix: return type of helpers plugin --- plugins/helpers/mod.ts | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/plugins/helpers/mod.ts b/plugins/helpers/mod.ts index f26209a97..a85c32b55 100644 --- a/plugins/helpers/mod.ts +++ b/plugins/helpers/mod.ts @@ -21,7 +21,9 @@ import { fetchAndRetrieveMembers } from "./src/fetchAndRetrieveMembers.ts"; import { BotWithCache } from "../cache/src/addCacheCollections.ts"; import { sendTextMessage } from "./src/sendTextMessage.ts"; -export interface BotWithHelpersPlugin extends Bot { +export type BotWithHelpersPlugin = Omit & HelperFunctionsFromHelperPlugin; + +export interface HelperFunctionsFromHelperPlugin { helpers: FinalHelpers & { fetchAndRetrieveMembers: ( guildId: bigint, @@ -72,8 +74,9 @@ export interface BotWithHelpersPlugin extends Bot { }; } -export function enableHelpersPlugin(rawBot: Bot): BotWithHelpersPlugin { - const bot = rawBot as BotWithHelpersPlugin; +export function enableHelpersPlugin(rawBot: B): BotWithHelpersPlugin { + // FORCE OVERRIDE THE TYPE SO WE CAN SETUP FUNCTIONS + const bot = rawBot as unknown as BotWithHelpersPlugin; bot.helpers.fetchAndRetrieveMembers = ( guildId: bigint, @@ -113,7 +116,7 @@ export function enableHelpersPlugin(rawBot: Bot): BotWithHelpersPlugin { channelId: bigint, ) => moveMember(bot, guildId, memberId, channelId); - return bot as BotWithHelpersPlugin; + return bot as BotWithHelpersPlugin; } // EXPORT EVERYTHING HERE SO USERS CAN OPT TO USE FUNCTIONS DIRECTLY