Move custom command files into own directory

This commit is contained in:
SileNce5k 2022-04-05 16:36:32 +02:00
parent e6bf4045ed
commit 4e41a035ed
No known key found for this signature in database
GPG key ID: C507260E7F2583AD
9 changed files with 8 additions and 8 deletions

View file

@ -0,0 +1,23 @@
const getNickname = require('../getNickname')
module.exports = function(customMessage, message, prefix, globalPrefix){
let user = message.guild.members.cache.get(message.author.id);
let nickname = getNickname(user, message.guild)
let username = user.user.username
let userID = user.user.id
let discriminator = user.user.discriminator
let guildName = message.guild.name
let guildID = message.guild.id
let variables = ["<prefix>", "<globalPrefix>", "<username>", "<nickname>", "<user_id>", "<discriminator>", "<guild_name>", "<guild_id>"]
let replacer = [prefix, globalPrefix, username, nickname, userID, discriminator, guildName, guildID]
for (let i = 0; i < variables.length; i++){
const regex = new RegExp(variables[i], 'g')
customMessage = customMessage.replace(regex, replacer[i])
}
return customMessage
}