Skip to content

Commit 307616d

Browse files
chore: remove debug logging
1 parent 2e28654 commit 307616d

File tree

5 files changed

+8
-53
lines changed

5 files changed

+8
-53
lines changed

lib/cron.ts

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -50,15 +50,11 @@ const exit = async () => {
5050
last_block: currentBlock
5151
}
5252

53-
console.log(history.last_timestamp)
54-
console.log(history.last_block)
55-
5653
let timestampLastUpdated = history.last_timestamp
57-
console.log('##LASTUPDATED')
58-
console.log(timestampLastUpdated)
54+
55+
5956
timestampLastUpdated = await update(currentTime, timestampLastUpdated, botaddress);
60-
console.log('##LASTUPDATED')
61-
console.log(timestampLastUpdated)
57+
6258
const updateBlock = Math.min(history.last_block+1000, currentBlock)
6359

6460
history.last_block = updateBlock

lib/telegram/commands/addEvidence.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,12 @@
11
import * as TelegramBot from "node-telegram-bot-api";
2-
import {Wallet} from "@ethersproject/wallet";
3-
import { BigNumber} from "@ethersproject/bignumber";
42
import {ipfsPublish, ipfsPublishBuffer} from "../../utils/ipfs-publish";
53
import { setAllowance, getAllowance, getActiveEvidenceGroupId , existsQuestionId} from "../../db";
64
import fetch from 'node-fetch';
7-
import { getQuestionsNotFinalized } from "../../graph";
85
import { groupSettings } from "../../../types";
96
import langJson from "../assets/langNew.json";
107
const _contract = require('../../abi/Realitio_v2_1_ArbitratorWithAppeals.json')
118
const Web3 = require('web3')
129
const web3 = new Web3(process.env.WEB3_PROVIDER_URL)
13-
const ob = require('urbit-ob')
1410

1511
const contract_en = new web3.eth.Contract(
1612
_contract,

lib/telegram/commands/socialConsensus.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import * as TelegramBot from "node-telegram-bot-api";
2-
import { getQuestionId } from "../../graph";
32
import {getFederationChannel, getFederatedInviteURLChannel} from "../../db";
43
import {reportMsg} from "./report";
54
import langJson from "../assets/langNew.json";

lib/telegram/commands/toggleCaptcha.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ const callback = async (queue: any, db: any, settings: groupSettings, bot: any,
3535
// if toggling on captcha, turn on greetings
3636
if (!settings.captcha)
3737
setGreetingMode(db, 'telegram', String(msg.chat.id),1)
38-
const msgcaptcha = settings.captcha? langJson[settings.lang].off : langJson[settings.lang].captcha.on
38+
const msgcaptcha = settings.captcha? langJson[settings.lang].captcha.off : langJson[settings.lang].captcha.on
3939
queue.add(async () => {try{await bot.sendMessage(msg.chat.id, msgcaptcha, msg.chat.is_forum? {message_thread_id: msg.message_thread_id}: {})}catch{}});
4040
} catch(e){
4141
console.log(e)

lib/telegram/index.ts

Lines changed: 4 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ const delay = (delayInms) => {
9191
bot.on("my_chat_member", async function(myChatMember: any) {
9292
try{
9393
const lang_code = myChatMember?.from?.language_code
94-
console.log(myChatMember)
94+
9595
if(throttled(myChatMember.from.id))
9696
return
9797
if(myChatMember.new_chat_member.status === "left"){
@@ -101,7 +101,7 @@ bot.on("my_chat_member", async function(myChatMember: any) {
101101
}
102102

103103
const settings = validate(myChatMember.chat, lang_code);
104-
console.log('HMMMMMM')
104+
105105
if(myChatMember.chat.type === "channel"){
106106
await delay(2000);
107107
if( myChatMember.new_chat_member.status === "administrator"){
@@ -128,37 +128,10 @@ bot.on("my_chat_member", async function(myChatMember: any) {
128128
}
129129
});
130130

131-
/* Forward messages to Susie for appeal
132-
// include "member" in allowed updates to work
133-
134-
bot.on("message", async function (msg: TelegramBot.Message) {
135-
if (msg.chat.type !== "private")
136-
return;
137-
console.log(msg)
138-
})
139-
*/
140-
//invite_url only present in private groups
141-
// include "chat_member" in allowed updates to work
142-
/*
143-
bot.on("chat_member", async function (msg: any) {
144-
if (msg.new_chat_member){
145-
if(msg.invite_link?.creator?.is_bot){
146-
const options = {can_send_messages: false, can_send_media_messages: false, can_send_polls: false, can_send_other_messages: false, can_add_web_page_previews: false, can_change_info: false, can_pin_messages: false};
147-
bot.restrictChatMember(msg.chat.id, msg.new_chat_member.id, options)
148-
}
149-
else{
150-
const options = await bot.getChat(msg.chat.id).permissions
151-
bot.restrictChatMember(msg.chat.id, msg.new_chat_member.id, options)
152-
}
153-
}
154-
})
155-
*/
156-
157-
158131
bot.on("new_chat_members", async function (chatMemberUpdated: any) {
159132
if(!chatMemberUpdated.new_chat_member?.id)
160133
return;
161-
console.log(chatMemberUpdated)
134+
162135
if(!hasStarted(chatMemberUpdated.chat.id)||throttled(chatMemberUpdated.new_chat_member?.id)||chatMemberUpdated.chat.type !== "supergroup")
163136
return;
164137

@@ -224,14 +197,11 @@ bot.on('callback_query', async function onCallbackQuery(callbackQuery: TelegramB
224197
console.log(e)
225198
}
226199
} else if (Number(calldata[0]) === 5){
227-
console.log(calldata)
228-
console.log(callbackQuery.from.id)
229200
if (callbackQuery.from.id !== Number(calldata[1]))
230201
return;
231202
const penalized = checkHistory(callbackQuery.message.chat, callbackQuery.from.id)
232203
const permissions = await queue.add(async () => {try{const val = (await bot.getChat(callbackQuery.message.chat.id)).permissions
233204
return val}catch (e){console.log(e)}})
234-
console.log(permissions)
235205
if(!permissions)
236206
return
237207
if (!penalized)
@@ -247,8 +217,6 @@ bot.on('callback_query', async function onCallbackQuery(callbackQuery: TelegramB
247217
start.callback(queue, db, settings,bot,String(botId),callbackQuery.message,[],batchedSend, true)
248218
}
249219
} else if (Number(calldata[0]) === 7){
250-
console.log(callbackQuery.from.id)
251-
console.log(Number(calldata[1]))
252220
if (callbackQuery.from.id !== Number(calldata[1]))
253221
return;
254222
setWarn(db, 'telegram', String(callbackQuery.message.chat.id), Number(calldata[2]))
@@ -453,9 +421,7 @@ const checkHistory = (chat: TelegramBot.Chat, userid: number): boolean => {
453421

454422
const timestamp_forgiven = getForgiveness(db, 'telegram',String(chat.id), String(userid))
455423
const warnings = getWarn(db,'telegram',String(chat.id))
456-
console.log('hmmm1')
457424
const settings = validate(chat);
458-
console.log('hmmm2')
459425
let calculateHistory = []
460426
if (settings.federation_id)
461427
calculateHistory = getFederatedBanHistory(db, 'telegram', String(userid),settings.federation_id,true,timestamp_forgiven)
@@ -488,8 +454,6 @@ const checkHistory = (chat: TelegramBot.Chat, userid: number): boolean => {
488454
else
489455
calculateHistoryActive = getLocalBanHistory(db, 'telegram', String(userid),String(chat.id),false,timestamp_forgiven)
490456

491-
console.log('wtf')
492-
console.log(calculateHistoryActive)
493457
ban_level = Math.max(calculateHistoryActive.length - warnings, 0)
494458
if (ban_level > 0){
495459
var max_timestamp = 0
@@ -505,7 +469,7 @@ const checkHistory = (chat: TelegramBot.Chat, userid: number): boolean => {
505469
}
506470
}
507471
if (calculateHistoryActive.length > 0)
508-
return true
472+
return true;
509473
}
510474

511475
console.log('Telegram bot ready...');

0 commit comments

Comments
 (0)