mirror of
https://github.com/thedevs-network/the-guard-bot
synced 2025-08-22 09:57:50 +00:00
fix: make context.ts work
This commit is contained in:
parent
a5472bd928
commit
614043d711
@ -25,4 +25,4 @@ Object.defineProperty(bot.context, "botInfo", {
|
||||
|
||||
// cyclic dependency
|
||||
// bot/index requires context requires actions/warn requires bot/index
|
||||
Object.assign(bot.context, require('./context'));
|
||||
Object.assign(bot.context, require('./context').extn);
|
||||
|
@ -5,6 +5,7 @@
|
||||
"noEmit": true,
|
||||
"noImplicitAny": false,
|
||||
"strict": true,
|
||||
"target": "ES2019"
|
||||
"target": "ES2019",
|
||||
"esModuleInterop": true
|
||||
}
|
||||
}
|
||||
|
21
typings/context.d.ts
vendored
21
typings/context.d.ts
vendored
@ -1,8 +1,4 @@
|
||||
import type {
|
||||
ExtraReplyMessage,
|
||||
Message,
|
||||
User,
|
||||
} from "telegraf/typings/telegram-types";
|
||||
import type { Convenience, Message, MessageId, User } from "telegraf/types";
|
||||
import type { Context } from "telegraf";
|
||||
import type { TgHtml } from "../utils/html";
|
||||
|
||||
@ -10,6 +6,8 @@ interface DbUser {
|
||||
status: "member" | "admin" | "banned";
|
||||
}
|
||||
|
||||
type ExtraReplyMessage = Convenience.ExtraReplyMessage;
|
||||
|
||||
export interface ContextExtensions {
|
||||
ban(
|
||||
this: ExtendedContext,
|
||||
@ -17,6 +15,7 @@ export interface ContextExtensions {
|
||||
admin: User;
|
||||
reason: string;
|
||||
userToBan: User;
|
||||
msg?: Message;
|
||||
}
|
||||
): Promise<Message>;
|
||||
batchBan(
|
||||
@ -35,24 +34,16 @@ export interface ContextExtensions {
|
||||
reason: string;
|
||||
userToWarn: User;
|
||||
mode: "auto" | "manual";
|
||||
msg?: Message;
|
||||
}
|
||||
): Promise<Message>;
|
||||
|
||||
loggedReply(
|
||||
this: ExtendedContext,
|
||||
html: TgHtml,
|
||||
msg?: Message,
|
||||
extra?: ExtraReplyMessage
|
||||
): Promise<Message>;
|
||||
replyWithHTML(
|
||||
this: void,
|
||||
html: string | TgHtml,
|
||||
extra?: ExtraReplyMessage
|
||||
): Promise<Message>;
|
||||
replyWithCopy(
|
||||
this: ExtendedContext,
|
||||
content: Message,
|
||||
options?: ExtraReplyMessage
|
||||
): Promise<Message>;
|
||||
}
|
||||
|
||||
export type ExtendedContext = ContextExtensions &
|
||||
|
Loading…
x
Reference in New Issue
Block a user