commit
This commit is contained in:
parent
2a5130cbda
commit
1e6c425444
1 changed files with 23 additions and 1 deletions
24
app.js
24
app.js
|
@ -1,6 +1,7 @@
|
|||
//Importing libs
|
||||
const { Telegraf } = require('telegraf');
|
||||
const fs = require('fs');
|
||||
const discord = require('discord.js');
|
||||
|
||||
//Importing other files
|
||||
const { getJoke } = require('./libs/dadJokes');
|
||||
|
@ -12,7 +13,18 @@ const { generateImage, answerQuestion } = require('./libs/openAi');
|
|||
//bot initialization
|
||||
const bot = new Telegraf(process.env.TELEGRAM);
|
||||
|
||||
//bot commands
|
||||
const client = new discord.Client({
|
||||
intents: [
|
||||
discord.GatewayIntentBits.Guilds,
|
||||
discord.GatewayIntentBits.GuildMessages,
|
||||
discord.GatewayIntentBits.MessageContent,
|
||||
discord.GatewayIntentBits.GuildMembers,
|
||||
],
|
||||
});
|
||||
|
||||
client.login(process.env.DISCORD);
|
||||
|
||||
//Telegram commands
|
||||
bot.command('start', ctx => {
|
||||
bot.telegram.sendMessage(ctx.chat.id, 'hello there! Welcome to my new telegram bot.\nType /help for help.', {})
|
||||
console.log("--> sent the start message to " + ctx.message.from.username);
|
||||
|
@ -90,5 +102,15 @@ bot.command('sb' , ctx => {
|
|||
bot.telegram.sendAudio(ctx.chat.id, "./src/audio/Spider-Bigard.mp3", {})
|
||||
})
|
||||
|
||||
//Discord commands
|
||||
|
||||
client.on('ready', () => {
|
||||
console.log(`Logged in as ${client.user.tag}!`);
|
||||
});
|
||||
|
||||
client.on('message', msg => {
|
||||
console.log(msg);
|
||||
});
|
||||
|
||||
//bot launch
|
||||
bot.launch()
|
Loading…
Add table
Add a link
Reference in a new issue