-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.js
More file actions
32 lines (25 loc) · 945 Bytes
/
index.js
File metadata and controls
32 lines (25 loc) · 945 Bytes
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
const gizoogleAPI = require('gizoogle');
const discordAPI = require('discord.js');
const discordToken = "token";
const discordClient = new discordAPI.Client();
discordClient.login(discordToken);
// Discord Event Handling
discordClient.on('ready', () => {
console.log('Bot is now connected');
});
discordClient.on('message', (message) =>{
if (message.author.id !== discordClient.user.id && message.content){
gizoogleAPI.string(message.content,function(error, translation) {
processTranslationMessage(message, translation)
});
}
});
// Functons
function processTranslationMessage(message, translation) {
message.delete();
message.channel.send(new discordAPI.RichEmbed()
.setColor('#ffffff')
.setDescription(translation)
.addField("Translation:", message.content, false)
.setAuthor(message.guild.member(message.author).displayName, message.author.avatarURL))
}