-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathreset_channel_game_score.js
43 lines (35 loc) · 1001 Bytes
/
reset_channel_game_score.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
require('dotenv').config();
const TelegramBot = require('node-telegram-bot-api');
const config = require('./config');
const bot = new TelegramBot(config.telegram.token, {
polling: false,
});
const user = '528354447'; // morion4000
// const message = '8900'; // hauntedtower channel
const message = '595575'; // webdollar channel
// const chat = '-1001510982248'; // hauntedtower channel
const chat = '-1001347111227'; // webdollar channel
async function run() {
const scores = await bot.getGameHighScores(user, {
chat_id: chat,
message_id: message,
});
for (const score of scores) {
console.log(
`${score.position}\t${score.user.id} (${score.user.username})\t\t\t${score.score}`
);
if (score.user.id !== 1169198680) {
continue;
}
try {
await bot.setGameScore(score.user.id, 0, {
chat_id: chat,
message_id: message,
force: true,
});
} catch (error) {
console.error(error.message);
}
}
}
run();