diff --git a/packages/gil/lib/listeners/CommandMessageListener.ts b/packages/gil/lib/listeners/CommandMessageListener.ts index 651d648b..a20aa594 100644 --- a/packages/gil/lib/listeners/CommandMessageListener.ts +++ b/packages/gil/lib/listeners/CommandMessageListener.ts @@ -84,9 +84,9 @@ export default class CommandMessageListener extends Listener { const context = this.gil.options?.contexts?.command ? await this.gil.options.contexts.command({ - server: params.server, - message: params.message, - }) + server: params.server, + message: params.message, + }) : {}; this.gil.emitter.emit("commandRan", { @@ -100,6 +100,7 @@ export default class CommandMessageListener extends Listener { await command.execute({ message: params.message, args: attemptConvertArguments.arguments, + server: params.server, ...context, }); } catch (e) { diff --git a/packages/gil/lib/structures/Command.ts b/packages/gil/lib/structures/Command.ts index 3c8bf3b3..8862f30c 100644 --- a/packages/gil/lib/structures/Command.ts +++ b/packages/gil/lib/structures/Command.ts @@ -2,7 +2,7 @@ import { Collection } from "@discordjs/collection"; import glob from "fast-glob"; import { Message } from "guilded.js"; import { GilClient } from "../GilClient"; -import { StoredRoleType } from "../adapters/db/DatabaseAdapter"; +import { StoredRoleType, StoredServer } from "../adapters/db/DatabaseAdapter"; import { CommandArgument, CommandArgumentType } from "../arguments/ArgumentParser"; import { CommandMessageParams } from "../events"; import { Manager } from "./Manager"; @@ -43,7 +43,7 @@ export abstract class Command { public constructor( public readonly gil: GilClient, public readonly options: CommandOptions, - ) {} + ) { } public abstract execute(commandContext: CommandContext): unknown | Promise; } @@ -51,6 +51,7 @@ export abstract class Command { export interface CommandExecuteContext> { message: Message; args: Args; + server: StoredServer; } export type CommandContext> = T & CommandExecuteContext; diff --git a/packages/gil/package.json b/packages/gil/package.json index b4ad7ecd..6145e016 100644 --- a/packages/gil/package.json +++ b/packages/gil/package.json @@ -1,6 +1,6 @@ { "name": "@guildedjs/gil", - "version": "0.6.2", + "version": "0.6.3", "description": "Framework for guilded.js that allows you to build bots with ease.", "author": "Zaid \"Nico\" ", "license": "MIT",