Change instruction for use docker-compose #4
|
@ -3,7 +3,7 @@
|
||||||
This bot allows you to automatically assign the top1/top10/top50 roles on the 42CTF Discord server.
|
This bot allows you to automatically assign the top1/top10/top50 roles on the 42CTF Discord server.
|
||||||
|
|
||||||
|
|
||||||
Create an `env.list` file containing :
|
Create an `env_file` file containing :
|
||||||
```
|
```
|
||||||
DISCORD_TOKEN=<token_discord>
|
DISCORD_TOKEN=<token_discord>
|
||||||
AUTH_TOKEN=<api_42CTF_token>
|
AUTH_TOKEN=<api_42CTF_token>
|
||||||
|
|
24
src/bot.js
24
src/bot.js
|
@ -15,7 +15,7 @@ async function get_guildID()
|
||||||
async function remove_notlogged(){
|
async function remove_notlogged(){
|
||||||
let guild = CLIENT.guilds.resolve(await get_guildID());
|
let guild = CLIENT.guilds.resolve(await get_guildID());
|
||||||
let token = O_TOKEN;
|
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(() => {
|
await (guild.members.fetch()).then(() => {
|
||||||
console.log("Cache reloaded !");
|
console.log("Cache reloaded !");
|
||||||
|
@ -27,7 +27,15 @@ async function remove_notlogged(){
|
||||||
['top50', guild.roles.cache.get("803729539145924649")]
|
['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 = "";
|
let body = "";
|
||||||
|
|
||||||
res.on("data", (chunk) => {
|
res.on("data", (chunk) => {
|
||||||
|
@ -65,7 +73,7 @@ async function remove_notlogged(){
|
||||||
}
|
}
|
||||||
|
|
||||||
async function rank(token = O_TOKEN){
|
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());
|
let guild = CLIENT.guilds.resolve(await get_guildID());
|
||||||
|
|
||||||
const rolesCollection = new Map([
|
const rolesCollection = new Map([
|
||||||
|
@ -74,7 +82,15 @@ async function rank(token = O_TOKEN){
|
||||||
['top50', guild.roles.cache.get("803729539145924649")]
|
['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 = "";
|
var body = "";
|
||||||
|
|
||||||
res.on("data", (chunk) => {
|
res.on("data", (chunk) => {
|
||||||
|
|
Loading…
Reference in New Issue