@codebam/cf-workers-telegram-bot 12.4.0 → 12.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -7,8 +7,6 @@ export default class TelegramExecutionContext {
|
|
|
7
7
|
private static businessOwners;
|
|
8
8
|
/** Cache for dead business connections */
|
|
9
9
|
private static poisonedConnections;
|
|
10
|
-
/** Cache for self-response counts to prevent infinite loops */
|
|
11
|
-
private static selfResponseCount;
|
|
12
10
|
/** an instance of the telegram bot */
|
|
13
11
|
bot: TelegramBot;
|
|
14
12
|
/** an instance of the telegram update */
|
|
@@ -5,8 +5,6 @@ export default class TelegramExecutionContext {
|
|
|
5
5
|
static businessOwners = new Map();
|
|
6
6
|
/** Cache for dead business connections */
|
|
7
7
|
static poisonedConnections = new Set();
|
|
8
|
-
/** Cache for self-response counts to prevent infinite loops */
|
|
9
|
-
static selfResponseCount = new Map();
|
|
10
8
|
/** an instance of the telegram bot */
|
|
11
9
|
bot;
|
|
12
10
|
/** an instance of the telegram update */
|
|
@@ -85,16 +83,6 @@ export default class TelegramExecutionContext {
|
|
|
85
83
|
*/
|
|
86
84
|
async shouldProcess() {
|
|
87
85
|
if (this.update_type !== 'business_message') {
|
|
88
|
-
if (this.userId === this.bot.botId) {
|
|
89
|
-
const chatId = this.getChatId();
|
|
90
|
-
const count = TelegramExecutionContext.selfResponseCount.get(chatId) || 0;
|
|
91
|
-
if (count < this.bot.ttl) {
|
|
92
|
-
TelegramExecutionContext.selfResponseCount.set(chatId, count + 1);
|
|
93
|
-
return true;
|
|
94
|
-
}
|
|
95
|
-
return false;
|
|
96
|
-
}
|
|
97
|
-
TelegramExecutionContext.selfResponseCount.delete(this.getChatId());
|
|
98
86
|
return true;
|
|
99
87
|
}
|
|
100
88
|
const connectionId = this.update.business_message?.business_connection_id?.toString();
|
|
@@ -132,16 +120,6 @@ export default class TelegramExecutionContext {
|
|
|
132
120
|
console.warn('Failed to fetch business connection info:', e);
|
|
133
121
|
}
|
|
134
122
|
}
|
|
135
|
-
if (ownerId !== undefined && (this.getChatId() === ownerId.toString() || this.userId === ownerId)) {
|
|
136
|
-
const chatId = this.getChatId();
|
|
137
|
-
const count = TelegramExecutionContext.selfResponseCount.get(chatId) || 0;
|
|
138
|
-
if (count < this.bot.ttl) {
|
|
139
|
-
TelegramExecutionContext.selfResponseCount.set(chatId, count + 1);
|
|
140
|
-
return true;
|
|
141
|
-
}
|
|
142
|
-
return false;
|
|
143
|
-
}
|
|
144
|
-
TelegramExecutionContext.selfResponseCount.delete(this.getChatId());
|
|
145
123
|
return true;
|
|
146
124
|
}
|
|
147
125
|
determineUpdateType() {
|