Compare commits

..

No commits in common. "a72a1dbaeb4c5266521ca189b5fef7e1bd4b5a34" and "8c6e538421f791a796527343eafe19b681c2ea1a" have entirely different histories.

4 changed files with 9 additions and 26 deletions

View File

@ -1,30 +1,30 @@
{ {
"oui": { "oui": {
"prefix": "👍", "prefix": ":thumbsup:",
"description": "Je suis daccord" "description": "Je suis daccord"
}, },
"non": { "non": {
"prefix": "👎", "prefix": ":thumbsdown:",
"description": "Je ne suis pas daccord" "description": "Je ne suis pas daccord"
}, },
"parole": { "parole": {
"prefix": "", "prefix": ":raised_hand:",
"description": "Je veux parler" "description": "Je veux parler"
}, },
"réponse": { "réponse": {
"prefix": "🙌", "prefix": ":raised_hands:",
"description": "Je veux répondre rapidement" "description": "Je veux répondre rapidement"
}, },
"suffit": { "suffit": {
"prefix": "🛑", "prefix": ":octagonal_sign:",
"description": "On tourne en rond" "description": "On tourne en rond"
}, },
"écoute": { "écoute": {
"prefix": "🙉", "prefix": ":hear_no_evil:",
"description": "On ne sécoute pas" "description": "On ne sécoute pas"
}, },
"love": { "love": {
"prefix": "😍", "prefix": ":heart_eyes:",
"description": "Jadore" "description": "Jadore"
}, },
"dab": { "dab": {

View File

@ -10,7 +10,6 @@
<main id="educbot-status"> <main id="educbot-status">
<p v-if="connection">Connecté !</p> <p v-if="connection">Connecté !</p>
<p v-else="">Non connecté !</p> <p v-else="">Non connecté !</p>
<p>{{message}}</p>
<ul> <ul>
<li v-for="(value, key) in reactions"> <li v-for="(value, key) in reactions">
<!--<img src="https://discordapp.com/assets/08c0a077780263f3df97613e58e71744.svg" width="30px" /> <!--<img src="https://discordapp.com/assets/08c0a077780263f3df97613e58e71744.svg" width="30px" />

View File

@ -2,9 +2,6 @@
require('dotenv').config(); require('dotenv').config();
const fs = require('fs'); const fs = require('fs');
/* Catch evry unhandled promise rejection */
process.on('unhandledRejection', error => console.error('Uncaught Promise Rejection', error));
/* Deep clone of objects */ /* Deep clone of objects */
const clonedeep = require('lodash.clonedeep') const clonedeep = require('lodash.clonedeep')
@ -150,14 +147,9 @@ 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')
}); });
/* Discord message center */ /* Discord message center */
client.on('message', msg => { client.on('message', msg => {
//TODO
//const prefixRegex = new RegExp(`^(<@!?${client.user.id}>|${escapeRegex(prefix)})\\s*`);
//if (!prefixRegex.test(message.content)) return;
if (msg.content === '!educpop-enable') { if (msg.content === '!educpop-enable') {
if (msg.channel.id in channels) { if (msg.channel.id in channels) {
msg.reply('Jécoute déjà ce canal texte.') msg.reply('Jécoute déjà ce canal texte.')

12
main.js
View File

@ -8,7 +8,6 @@ window.onload = function () {
ws_url: 'ws://localhost:8080', ws_url: 'ws://localhost:8080',
reactions: {}, reactions: {},
connection: false, connection: false,
message: '',
}, },
created: function () { created: function () {
var url = new URL(location.href) var url = new URL(location.href)
@ -20,15 +19,8 @@ window.onload = function () {
} }
this.ws = new WebSocket(this.ws_url) this.ws = new WebSocket(this.ws_url)
this.ws.onmessage = (data) => { this.ws.onmessage = (data) => {
var reactions = JSON.parse(data.data) this.reactions = JSON.parse(data.data)
if ('error' in reactions) { console.log(this.reactions)
this.message = 'Erreur ! '
if (reactions.error === "bad channel") {
this.message += 'Les identifiants sont incorrect ! Redemandez les à Educ-Bot avec la commande "!educpop-web"'
}
return
}
this.reactions = reactions
} }
this.ws.onopen = () => { this.ws.onopen = () => {
this.sendWs('init') this.sendWs('init')