Compare commits

..

2 Commits

Author SHA1 Message Date
Adrian Amaglio
c759779135 docker 2020-04-02 19:44:17 +02:00
Adrian Amaglio
094ace0d2f 🐛 name and msg save 2020-04-02 19:44:09 +02:00
4 changed files with 36 additions and 4 deletions

3
.dockerignore Normal file
View File

@ -0,0 +1,3 @@
Dockerfile
node_modules
npm-debug.log

11
Dockerfile Normal file
View File

@ -0,0 +1,11 @@
from node:alpine3.10
WORKDIR /usr/src/app
COPY package*.json ./
RUN npm install
COPY index.js avatar.jpg
EXPOSE 8080
CMD [ "node", "index.js" ]

View File

@ -150,7 +150,7 @@ const client = new Discord.Client();
client.on('ready', () => { client.on('ready', () => {
console.log('Connected to Discord as ' + client.user.tag); console.log('Connected to Discord as ' + client.user.tag);
client.user.setAvatar('avatar.png') client.user.setAvatar('avatar.png')
client.user.setUsername('Educ-Bot') client.user.setUsername(process.env.BOT_USERNAME)
}); });
/* Discord message center */ /* Discord message center */
client.on('message', msg => { client.on('message', msg => {
@ -203,21 +203,21 @@ client.on('message', msg => {
} }
/* save and ignore own messages */ /* save and ignore own messages */
else if(msg.author.username === process.env.BOT_USERNAME){ else if(msg.author.username === process.env.BOT_USERNAME){
if (msg.content.startsWith(':')) /* Save if its educpop summary */ if (!msg.content.startsWith('<')) /* Save if its educpop summary */
channel.last_msg = msg; channel.last_msg = msg;
} }
/* Educ pop stuff */ /* Educ pop stuff */
else if(msg.content.startsWith('-')) { else if(msg.content.startsWith('-')) {
const content = msg.content.slice(1) const content = msg.content.slice(1)
if (content.toLowerCase() in reactions) { if (content.toLowerCase() in reactions) {
educpopDelPerson(channel, msg.author.username, content.toLowerCase()) educpopDelPerson(channel, msg.member.nickname, content.toLowerCase())
msg.delete() msg.delete()
reply(channel) reply(channel)
} }
} }
else if (msg.content.toLowerCase() in reactions) { else if (msg.content.toLowerCase() in reactions) {
var reaction = msg.content.toLowerCase() var reaction = msg.content.toLowerCase()
educpopAddPerson(channel, msg.author.username, msg.content.toLowerCase()) educpopAddPerson(channel, msg.member.nickname, msg.content.toLowerCase())
msg.delete() msg.delete()
reply(channel) reply(channel)
} }

18
package.json Normal file
View File

@ -0,0 +1,18 @@
{
"name": "educ-bot",
"version": "1.0.0",
"description": "Un petit bot d'éduc pop pour Discord (WIP). Il permet de voir qui secoue les mains dans une discussion vocale.",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"repository": {
"type": "git",
"url": "ssh://git@git.jean-cloud.net:22529/theolem/educ-bot.git"
},
"author": "",
"license": "ISC",
"dependencies": {
"discord.js": "^12.1.1"
}
}