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