Skip to content

Commit d881681

Browse files
author
Vivien Mouret
committed
🏗️ many many command for ?
1 parent 35289aa commit d881681

9 files changed

Lines changed: 199 additions & 0 deletions

File tree

core/subcommands/backseat.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
'use.strict'
2+
3+
module.exports = {
4+
data: {
5+
name: 'backseat',
6+
description: 'a dynamic backseat'
7+
},
8+
async execute(client, channel, message, userstate) {
9+
client.reply(channel, 'pas de conseil si le daft n\'en demandes pas', userstate.id)
10+
.catch(e => console.log(e));
11+
}
12+
};

core/subcommands/command.js

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
'use.strict'
2+
3+
const fs = require('fs'),
4+
path = require('path');
5+
6+
module.exports = {
7+
data: {
8+
name: 'command',
9+
description: 'a dynamic command'
10+
},
11+
async execute(client, channel, message, userstate) {
12+
let commandsPath = path.join(__dirname, '../subcommands'),
13+
commandFiles = fs.readdirSync(commandsPath).filter(file => file.endsWith('.js')),
14+
commands = []
15+
16+
for (let file of commandFiles) { commands.push(file.split('.')[0]) };
17+
18+
client.reply(channel, `toutes les commandes : ${commands.join(', ')} !`, userstate.id)
19+
.catch(e => console.log(e));
20+
}
21+
};

core/subcommands/discord.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
'use.strict'
2+
3+
module.exports = {
4+
data: {
5+
name: 'discord',
6+
description: 'a dynamic discord'
7+
},
8+
async execute(client, channel, message, userstate) {
9+
client
10+
.reply(channel,
11+
'Cliques sur le lien suivant pour sortir de la bordure et rejoindre le serveur du daft : https://discord.gg/ucwnMKKxZe',
12+
userstate.id)
13+
.catch(e => console.log(e));
14+
}
15+
};

core/subcommands/followage.js

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
'use.strict'
2+
3+
const axios = require('axios'),
4+
{ identity, clientId } = require('../config.json'),
5+
{ getCurrentDatetime } = require('../utils.js');
6+
7+
const params = {
8+
headers: {
9+
Authorization: `Bearer ${identity.password}`,
10+
'Client-ID': clientId
11+
}
12+
};
13+
14+
module.exports = {
15+
data: {
16+
name: 'followage',
17+
description: 'a dynamic followage'
18+
},
19+
async execute(client, channel, message, userstate) {
20+
if (userstate.username === 'daftmob') {
21+
client.reply(channel, `debilus...`, userstate.id)
22+
.catch(e => console.log(e));
23+
return;
24+
};
25+
26+
let fe = await axios.get(`https://api.twitch.tv/helix/channels/followed?user_id=${userstate.id}` + params)
27+
.catch(err => { console.log(`[${getCurrentDatetime('comm')}] Error FETCH ${err}`); }),
28+
timeSince = new Date(fe.data.data[0].followed_at).toLocaleString('fr-FR', { timeZone: 'Europe/Paris' }),
29+
day = timeSince.split('/')[0],
30+
months = timeSince.split('/')[1],
31+
years = new Date(fe.data.data[0].followed_at).getUTCFullYear();
32+
33+
switch (months) {
34+
case '01':
35+
months = months.replace('01', 'janvier');
36+
break;
37+
case '02':
38+
months = months.replace('02', 'février');
39+
break;
40+
case '03':
41+
months = months.replace('03', 'mars');
42+
break;
43+
case '04':
44+
months = months.replace('04', 'avril');
45+
break;
46+
case '05':
47+
months = months.replace('05', 'mai');
48+
break;
49+
case '06':
50+
months = months.replace('06', 'juin');
51+
break;
52+
case '07':
53+
months = months.replace('07', 'juillet');
54+
break;
55+
case '08':
56+
months = months.replace('08', 'août');
57+
break;
58+
case '09':
59+
months = months.replace('09', 'septembre');
60+
break;
61+
case '10':
62+
months = months.replace('10', 'octobre');
63+
break;
64+
case '11':
65+
months = months.replace('11', 'novembre');
66+
break;
67+
case '12':
68+
months = months.replace('12', 'décembre');
69+
break;
70+
};
71+
72+
client.reply(channel, `${userstate.username} follow le ptit daft depuis ${day} ${months} ${years}`, userstate.id)
73+
.catch(e => console.log(e));
74+
}
75+
};

core/subcommands/mods.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
'use.strict'
2+
3+
module.exports = {
4+
data: {
5+
name: 'ping',
6+
description: 'a dynamic ping'
7+
},
8+
async execute(client, channel, message, userstate) {
9+
client
10+
.reply(channel,
11+
'ptit lien des mods de stalker gamma : https://github.com/Grokitach/Stalker_GAMMA/blob/main/G.A.M.M.A/modpack_data/modlist.txt',
12+
userstate.id)
13+
.catch(e => console.log(e));
14+
}
15+
};

core/subcommands/timer.js

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
'use.strict'
2+
3+
const { randomIntFromInterval } = require('../utils.js');
4+
5+
module.exports = {
6+
data: {
7+
name: 'timer',
8+
description: 'a dynamic timer'
9+
},
10+
async execute(client, channel, message, userstate, urI, timestamp, autoPost) {
11+
if (autoPost) {
12+
let mtpPhrases = [
13+
'passes rejoindre son discord https://discord.gg/ucwnMKKxZe',
14+
`penses à aller voir la dernière vidéo https://www.youtube.com/watch?v=${urI}`,
15+
'check quand je passe en live avec le twitter https://twitter.com/daftm0b'
16+
];
17+
18+
client.say(channel, `daft est en live depuis ${timestamp}, ` + mtpPhrases[randomIntFromInterval(0, mtpPhrases.length - 1)])
19+
.catch(e => console.log(e));
20+
} else {
21+
client.reply(channel, `daft est en live depuis ${timestamp}`, userstate.id)
22+
.catch(e => console.log(e));
23+
};
24+
}
25+
};

core/subcommands/twitter.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
'use.strict'
2+
3+
module.exports = {
4+
data: {
5+
name: 'twitter',
6+
description: 'a dynamic twitter'
7+
},
8+
async execute(client, channel, message, userstate) {
9+
client.reply(channel, 'le profil vide du daft sur twitter : https://twitter.com/daftm0b', userstate.id)
10+
.catch(e => console.log(e));
11+
}
12+
};

core/subcommands/uptime.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
'use.strict'
2+
3+
module.exports = {
4+
data: {
5+
name: 'uptime',
6+
description: 'a dynamic uptime'
7+
},
8+
async execute(client, channel, message, userstate, urI, timestamp) {
9+
client.reply(channel, `le stream est en live depuis ${timestamp}`, userstate.id)
10+
.catch(e => console.log(e));
11+
}
12+
};

core/subcommands/youtube.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
'use.strict'
2+
3+
module.exports = {
4+
data: {
5+
name: 'youtube',
6+
description: 'a dynamic youtube'
7+
},
8+
async execute(client, channel, message, userstate, urI) {
9+
client.reply(channel, `voici un ptit lien vers le youtube game https://www.youtube.com/watch?v=${urI}`, userstate.id)
10+
.catch(e => console.log(e));
11+
}
12+
};

0 commit comments

Comments
 (0)