-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
45 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,34 @@ | ||
/* eslint-disable global-require */ | ||
import { Composer } from 'telegraf'; | ||
import start from './t.start'; | ||
import drug from './t.drug'; | ||
import topic from './t.topic'; | ||
import combo from './t.combo'; | ||
import breathe from './t.breathe'; | ||
import combochart from './t.combochart'; | ||
import irc from './t.irc'; | ||
import ban from './t.ban'; | ||
import moderateChat from './t.moderateChat'; | ||
import gban from './t.gban'; | ||
import about from './t.about'; | ||
import recovery from './t.recovery'; | ||
import calcMushrooms from './t.calc-mushrooms'; | ||
import calcLsd from './t.calc-lsd'; | ||
|
||
export default Composer.compose([ | ||
require('./t.start'), | ||
require('./t.drug'), | ||
require('./t.topic'), | ||
require('./t.combo'), | ||
require('./t.breathe'), | ||
require('./t.combochart'), | ||
require('./t.irc'), | ||
require('./t.ban'), | ||
require('./t.moderateChat'), | ||
require('./t.gban'), | ||
// require('./t.eightball'), | ||
require('./t.about'), | ||
require('./t.recovery'), | ||
require('./t.calc-mushrooms'), | ||
require('./t.calc-lsd'), | ||
]); | ||
|
||
export default [ | ||
start, | ||
drug, | ||
topic, | ||
combo, | ||
breathe, | ||
combochart, | ||
irc, | ||
ban, | ||
moderateChat, | ||
gban, | ||
// eightball, | ||
about, | ||
recovery, | ||
calcMushrooms, | ||
calcLsd, | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,28 @@ | ||
import { Telegraf as TelegramClient } from 'telegraf'; | ||
|
||
const commands = require('./commands/t.index'); | ||
import { Telegraf } from 'telegraf'; | ||
import commands from './commands/t.index'; | ||
|
||
const F = f(__filename); | ||
|
||
export default async function telegramConnect() { | ||
log.debug(F, 'Connecting to Telegram...'); | ||
|
||
const bot = new TelegramClient(env.TELEGRAM_TOKEN); | ||
const bot = new Telegraf(env.TELEGRAM_TOKEN); | ||
|
||
// load bot commands | ||
bot.use(commands); | ||
bot.use(...commands); | ||
|
||
bot.launch(); | ||
|
||
bot.catch((err: any) => { | ||
log.error(F, `Error in Telegram bot: ${err}`); | ||
}); | ||
|
||
global.telegramClient = bot; | ||
|
||
process.once('SIGINT', () => bot.stop('SIGINT')); | ||
process.once('SIGTERM', () => bot.stop('SIGTERM')); | ||
} | ||
|
||
declare global { | ||
var telegramClient: TelegramClient; // eslint-disable-line | ||
var telegramClient: Telegraf; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters