mirror of
https://github.com/arthur-pbty/gestion-perso.git
synced 2026-06-03 23:36:35 +02:00
add command
This commit is contained in:
@@ -1,12 +1,12 @@
|
||||
import { Message, Client } from 'discord.js';
|
||||
|
||||
module.exports = {
|
||||
name: 'set',
|
||||
aliases: ['changer'],
|
||||
description: 'Modifier divers paramètres du bot.',
|
||||
emote: '⚙️',
|
||||
utilisation: 'set <name/pic> <nom/lien>',
|
||||
category: 'botcontrol',
|
||||
|
||||
async execute(message, args, client) {
|
||||
async execute(message: Message, args: string[], client: Client) {
|
||||
if (args.length < 2) {
|
||||
return message.reply('Veuillez fournir un paramètre parmis `name` ou `pic` pour sa valeur.');
|
||||
}
|
||||
@@ -17,6 +17,7 @@ module.exports = {
|
||||
const value = args.slice(1).join(' ');
|
||||
if (value) {
|
||||
try {
|
||||
if (!message.guild || !client.user) return;
|
||||
const botMember = await message.guild.members.fetch(client.user.id);
|
||||
await botMember.setNickname(value);
|
||||
return message.reply(`Mon nouveau pseudo est maintenant **${value}**.`);
|
||||
@@ -31,7 +32,8 @@ module.exports = {
|
||||
const value = args[1];
|
||||
if (value && value.startsWith('http')) {
|
||||
try {
|
||||
await client.user.setAvatar(value);
|
||||
if (!client.user) return;
|
||||
await client.user.edit({avatar: value});
|
||||
return message.reply('Mon avatar a été mis à jour avec succès.');
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
Reference in New Issue
Block a user