Change instruction for use docker-compose #4

Merged
Starthur merged 2 commits from docker-compose into main 2022-05-28 13:36:27 +02:00
2 changed files with 25 additions and 13 deletions

View File

@ -2,12 +2,8 @@
This bot allows you to automatically assign the top1/top10/top50 roles on the 42CTF Discord server.
To use it you just have to create the docker container :
```
docker build -t discord_bot .
```
Create an `env.list` file containing :
Create an `env_file` file containing :
```
DISCORD_TOKEN=<token_discord>
AUTH_TOKEN=<api_42CTF_token>
@ -15,5 +11,5 @@ AUTH_TOKEN=<api_42CTF_token>
And then run it with :
```
docker run -d --env-file env.list --name discord_bot
docker-compose up -d
```

View File

@ -15,7 +15,7 @@ async function get_guildID()
async function remove_notlogged(){
let guild = CLIENT.guilds.resolve(await get_guildID());
let token = O_TOKEN;
let url = `https://www.42ctf.org/api/bot/discord?token=${token}`;
let url = `https://www.42ctf.local/api/bot/discord?token=${token}`;
await (guild.members.fetch()).then(() => {
console.log("Cache reloaded !");
@ -27,9 +27,17 @@ async function remove_notlogged(){
['top50', guild.roles.cache.get("803729539145924649")]
]);
https.get(url,(res) => {
const options = {
path: '/',
method: 'GET',
rejectUnauthorized: false,
requestCert: true,
agent: false
};
https.get(url, options, (res) => {
let body = "";
res.on("data", (chunk) => {
body += chunk;
});
@ -54,7 +62,7 @@ async function remove_notlogged(){
await user.roles.remove(rolesCollection.get('top50'));
}
})
}
}
catch (error) {
console.error(error.message);
};
@ -65,7 +73,7 @@ async function remove_notlogged(){
}
async function rank(token = O_TOKEN){
let url = `https://www.42ctf.org/api/bot/discord?token=${token}`;
let url = `https://www.42ctf.local/api/bot/discord?token=${token}`;
let guild = CLIENT.guilds.resolve(await get_guildID());
const rolesCollection = new Map([
@ -74,9 +82,17 @@ async function rank(token = O_TOKEN){
['top50', guild.roles.cache.get("803729539145924649")]
]);
https.get(url,(res) => {
const options = {
path: '/',
method: 'GET',
rejectUnauthorized: false,
requestCert: true,
agent: false
};
https.get(url,options,(res) => {
var body = "";
res.on("data", (chunk) => {
body += chunk;
});