mirror of
https://github.com/arthur-pbty/gestion.git
synced 2026-06-10 02:44:10 +02:00
grand commit que tutur attend ( marche pas le raidmode en dev)
sinon il y a pleins de truc comme les anti raid , des coorectif ect
This commit is contained in:
@@ -0,0 +1,48 @@
|
||||
const axios = require('axios');
|
||||
const fs = require('fs');
|
||||
const { send } = require('process');
|
||||
|
||||
module.exports = {
|
||||
name: 'setbanner',
|
||||
description: "Changer la bannire du bot",
|
||||
emote: '🚪',
|
||||
utilisation: 'setbanner [banner]',
|
||||
category: 'botcontrol',
|
||||
|
||||
async execute(message, args, client) {
|
||||
const sendmessage = await message.reply("\`🔃\` La banniere est entrain de ce mettre sur le bot")
|
||||
//if (message.attachments.size > 0 && /\.gif\s*$/i.test(message.attachments.first().url)) {
|
||||
const attachment = message.attachments.first();
|
||||
try {
|
||||
const responses = await axios.get(attachment.url, { responseType: 'arraybuffer' });
|
||||
const buffer = Buffer.from(responses.data, 'binary');
|
||||
const base64Image = buffer.toString('base64');
|
||||
|
||||
let response = await axios("https://discord.com/api/v9/users/@me", {
|
||||
method: "PATCH",
|
||||
headers: {
|
||||
Authorization: `Bot ${client.token}`,
|
||||
"Content-Type": "application/json"
|
||||
},
|
||||
data: JSON.stringify({
|
||||
banner: `data:image/gif;base64,${base64Image}`
|
||||
})
|
||||
});
|
||||
|
||||
if (response.status === 200) {
|
||||
sendmessage.edit("\`✅\`Le bot a bien mis à jour sa bannière");
|
||||
} else {
|
||||
sendmessage.edit("\`❌\`Un problème est survenu durant la mise à jour de la bannière du bot.");
|
||||
console.log(`Unable to update banner : ${response.statusText}`);
|
||||
let responseBody = await response.text();
|
||||
console.log(`Response : ${responseBody}`);
|
||||
}
|
||||
} catch (err) {
|
||||
console.error(`An error occurred while updating the banner : ${err}`);
|
||||
sendmessage.edit("\`❌\`Un problème est survenu durant la mise à jour de la bannière du bot.");
|
||||
}
|
||||
//} else {
|
||||
// console.log("Please attach a .gif file to use as the new banner.");
|
||||
//}
|
||||
},
|
||||
};
|
||||
Reference in New Issue
Block a user