Compare commits
2 Commits
1ccf4b3c5c
...
c759779135
Author | SHA1 | Date | |
---|---|---|---|
|
c759779135 | ||
|
094ace0d2f |
3
.dockerignore
Normal file
3
.dockerignore
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
Dockerfile
|
||||||
|
node_modules
|
||||||
|
npm-debug.log
|
11
Dockerfile
Normal file
11
Dockerfile
Normal 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" ]
|
8
index.js
8
index.js
@ -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
18
package.json
Normal 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"
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user