Skip to content

Commit 7a87c6d

Browse files
author
Vivien Mouret
committed
πŸ”€ Merge branch 'dev'
2 parents 421282d + 328bb77 commit 7a87c6d

76 files changed

Lines changed: 926 additions & 165 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

β€Ž.gitattributesβ€Ž

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,4 @@
11
*.csv filter=lfs diff=lfs merge=lfs -text
2+
*.png filter=lfs diff=lfs merge=lfs -text
3+
*.gif filter=lfs diff=lfs merge=lfs -text
4+
*.webp filter=lfs diff=lfs merge=lfs -text

β€ŽREADME.mdβ€Ž

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,63 @@ npm install
2828
node main.js
2929
```
3030

31+
### Petit plus
32+
33+
Voici un petit lien [trello](https://trello.com/b/kdy25wXP/daftbot-mobbot) afin de suivre l'avancΓ©e des bots
34+
35+
36+
## Prerequisites
37+
38+
- Token of your Discord bot
39+
- Token of your Twitch bot (optional)
40+
- Nodejs and npm
41+
42+
## Usage
43+
44+
After cloning the repo, simply go to the root of the project and copy the `config.json.example` file to `config.json` and put in your secret discord bot token and the prefix you will use.
45+
46+
You can then run the following commands:
47+
48+
```bash
49+
# To install the necessary packages
50+
npm install
51+
52+
# To launch the bot
53+
node main.js
54+
```
55+
56+
### Little extra
57+
58+
Here is a small link [trello](https://trello.com/b/kdy25wXP/daftbot-mobbot) to follow the progress of the bots
59+
60+
### Petit plus
61+
62+
Voici un petit lien [trello](https://trello.com/b/kdy25wXP/daftbot-mobbot) afin de suivre l'avancΓ©e des bots
63+
64+
65+
## Prerequisites
66+
67+
- Token of your Discord bot
68+
- Token of your Twitch bot (optional)
69+
- Nodejs and npm
70+
71+
## Usage
72+
73+
After cloning the repo, simply go to the root of the project and copy the `config.json.example` file to `config.json` and put in your secret discord bot token and the prefix you will use.
74+
75+
You can then run the following commands:
76+
77+
```bash
78+
# To install the necessary packages
79+
npm install
80+
81+
# To launch the bot
82+
node main.js
83+
```
84+
85+
### Little extra
86+
87+
Here is a small link [trello](https://trello.com/b/kdy25wXP/daftbot-mobbot) to follow the progress of the bots
3188
## Prerequisites
3289

3390
- Token of your Discord bot

β€Žappdata/command.jsβ€Ž

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,9 @@ module.exports = {
1616
description: 'a dynamic tchat',
1717
args: true,
1818
execute(message, args) {
19-
var sayMessage = args.join(" ");
20-
message.delete().catch(O_o => { })
19+
var sayMessage = args.args.join(' ');
20+
21+
message.delete().catch(O_o => { });
2122
message.channel.send(sayMessage);
2223
}
2324
},
@@ -26,27 +27,28 @@ module.exports = {
2627
description: 'a dynamic prune',
2728
args: true,
2829
execute(message, args) {
29-
if (message.author.id === owner) return message.channel.send(args.languageChoosen.restricted); // TODO: check this out
30+
if (message.author.id === owner) return message.channel.send(args.language.restricted); // TODO: check this out
3031

3132
var amount = parseInt(args.args[0]);
33+
3234
if (isNaN(amount)) {
33-
message.reply(args.languageChoosen.pruneInvalid);
35+
message.reply(args.language.pruneInvalid);
3436
} else if (amount > 0 && amount < 101) {
3537
message.channel.bulkDelete(amount, true).catch(err => {
3638
console.error(err);
37-
message.channel.send(args.languageChoosen.pruneError);
39+
message.channel.send(args.language.pruneError);
3840
});
3941
} else {
40-
message.reply(args.languageChoosen.pruneOut);
42+
message.reply(args.language.pruneOut);
4143
};
4244
}
4345
},
4446
ping: {
4547
name: 'ping',
4648
description: 'a dynamic ping',
4749
async execute(message, args) {
48-
const wait = await message.channel.send(args.languageChoosen.pingWait);
49-
wait.edit(`Bip. ${args.languageChoosen.pingEdit} ${wait.createdTimestamp - message.createdTimestamp}ms.. Bip Boup..`);
50+
const wait = await message.channel.send(args.language.pingWait);
51+
wait.edit(`Bip. ${args.language.pingEdit} ${wait.createdTimestamp - message.createdTimestamp}ms.. Bip Boup..`);
5052
}
5153
}
5254
};

β€Žappdata/openai.jsβ€Ž

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
'use.strict'
2+
3+
const config = require("../config.json"),
4+
{ Configuration, OpenAIApi } = require("openai"),
5+
configuration = new Configuration({ apiKey: config.openAI }),
6+
openaiAPI = new OpenAIApi(configuration);
7+
8+
module.exports = {
9+
openai: {
10+
name: 'openai',
11+
description: 'a dynamic tchat bot from openai',
12+
execute(message) {
13+
const completion = openaiAPI.createCompletion({
14+
model: "text-davinci-003",
15+
prompt: message.content,
16+
max_tokens: 1024,
17+
n: 1,
18+
stop: undefined,
19+
temperature: 0.9
20+
});
21+
22+
completion.then((result) => {
23+
message.reply(result.data.choices[0].text);
24+
});
25+
}
26+
}
27+
};

β€Žappdata/reply.jsβ€Ž

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ module.exports = {
88
description: 'a dynamic reply',
99
execute(message, args) {
1010
let reply = new EmbedBuilder()
11-
.setDescription(args.languageChoosen.replyBot)
11+
.setDescription(args.language.replyBot)
1212
.setImage('https://i.skyrock.net/7297/93457297/pics/3273728730_1_2_yrHEcA4w.gif');
1313

1414
message.channel.send({ embeds: [reply] });
@@ -18,7 +18,7 @@ module.exports = {
1818
name: 'hahaha',
1919
description: 'a dynamic reply',
2020
execute(message, args) {
21-
message.channel.send(args.languageChoosen.replyAgg);
21+
message.channel.send(args.language.replyAgg);
2222
}
2323
},
2424
no: {
@@ -47,7 +47,7 @@ module.exports = {
4747
name: 'tqt',
4848
description: 'a dynamic reply',
4949
execute(message, args) {
50-
message.reply(args.languageChoosen.replyWorried);
50+
message.reply(args.language.replyWorried);
5151
}
5252
}
5353
};

β€Žconfig.json.exampleβ€Ž

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
{
2-
"prefix" : "!",
3-
"token" : "YOUR-TOKEN-HERE",
4-
"owner" : "your_discord_id"
2+
"prefix" : "YOUR_PREFIX_HERE",
3+
"token" : "YOUR_TOKEN_HERE",
4+
"owner" : "YOUR_DISCORD_HERE",
5+
"openAI" : "YOUR_OPENAI_API_KEY_HERE",
56
}

0 commit comments

Comments
Β (0)