This commit is contained in:
Lukian LEIZOUR 2023-01-31 11:04:43 +01:00
parent 1e6c425444
commit aab02829cf
2 changed files with 11 additions and 13 deletions

2
.gitignore vendored Normal file
View file

@ -0,0 +1,2 @@
tests.js

20
app.js
View file

@ -13,16 +13,7 @@ const { generateImage, answerQuestion } = require('./libs/openAi');
//bot initialization //bot initialization
const bot = new Telegraf(process.env.TELEGRAM); const bot = new Telegraf(process.env.TELEGRAM);
const client = new discord.Client({ const client = new discord.Client({intents: 3276799});
intents: [
discord.GatewayIntentBits.Guilds,
discord.GatewayIntentBits.GuildMessages,
discord.GatewayIntentBits.MessageContent,
discord.GatewayIntentBits.GuildMembers,
],
});
client.login(process.env.DISCORD);
//Telegram commands //Telegram commands
bot.command('start', ctx => { bot.command('start', ctx => {
@ -108,9 +99,14 @@ client.on('ready', () => {
console.log(`Logged in as ${client.user.tag}!`); console.log(`Logged in as ${client.user.tag}!`);
}); });
client.on('message', msg => { client.on('messageCreate', msg => {
console.log(msg); console.log(msg.content);
if (msg.content === 'ping') {
msg.reply('Pong!');
}
}); });
//bot launch //bot launch
bot.launch() bot.launch()
client.login(process.env.DISCORD);