Skip to content
This repository was archived by the owner on Apr 13, 2025. It is now read-only.

Commit a7f8159

Browse files
committed
Update typings for telegram lib and use upstreamed clear listener methods
1 parent 872d6fb commit a7f8159

File tree

3 files changed

+6
-22
lines changed

3 files changed

+6
-22
lines changed

nodecg-io-telegram/extension/index.ts

Lines changed: 2 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -4,22 +4,6 @@ import { ServiceBundle } from "nodecg-io-core/extension/serviceBundle";
44
import TelegramBot = require("node-telegram-bot-api");
55
import { ServiceClient } from "nodecg-io-core/extension/types";
66

7-
// TODO: These changes are now upstreamed (https://github.com/yagop/node-telegram-bot-api/commit/ec7e61e041a66a52a90be0849c3d4640a4806873) but typing still need updating
8-
class BetterTelegramBot extends TelegramBot {
9-
private declare _textRegexpCallbacks: Array<RegExp>;
10-
private declare _replyListeners: Array<unknown>;
11-
12-
clearTextListeners() {
13-
// The class currently doesn't have a way to reset all regex listeners.
14-
this._textRegexpCallbacks = [];
15-
}
16-
17-
clearReplyListeners() {
18-
// The class currently also doesn't have a way to reset all reply listeners.
19-
this._replyListeners = [];
20-
}
21-
}
22-
237
interface TelegramServiceConfig {
248
token: string;
259
polling?: boolean;
@@ -29,7 +13,7 @@ interface TelegramServiceConfig {
2913
filepath?: boolean;
3014
}
3115

32-
export type TelegramServiceClient = ServiceClient<BetterTelegramBot>;
16+
export type TelegramServiceClient = ServiceClient<TelegramBot>;
3317

3418
module.exports = (nodecg: NodeCG) => {
3519
new TelegramService(nodecg, "telegram", __dirname, "../telegram-schema.json").register();
@@ -52,7 +36,7 @@ class TelegramService extends ServiceBundle<TelegramServiceConfig, TelegramServi
5236
webHook: config.webHook,
5337
};
5438

55-
const bot = new BetterTelegramBot(config.token, options);
39+
const bot = new TelegramBot(config.token, options);
5640

5741
this.nodecg.log.info("Successfully connected to the telegram server.");
5842

nodecg-io-telegram/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
"typescript": "^4.1.3"
3636
},
3737
"dependencies": {
38-
"@types/node-telegram-bot-api": "^0.50.4",
38+
"@types/node-telegram-bot-api": "^0.51.0",
3939
"node-telegram-bot-api": "^0.51.0",
4040
"nodecg-io-core": "^0.1.0"
4141
}

package-lock.json

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)