Add replace method to messages variable

This commit is contained in:
Christer Warén committed 2023-06-06 06:04:28 +03:00
1 parent 3686cd1b0e
commit 78d6b92dbd
11 files changed
+57 -41

No files matched your search

+12
View File
@@ -1,4 +1,16 @@
export const messages = {
replace(message: string, variables: { [key: string]: string }){
for(let variable in variables){
if(variable.includes('%')){
message = message.replace(variable, variables[variable]);
} else if(variable.includes(':')){
message = message.replace(variable.split(':')[0], variables[variable]);
} else {
message = message.replace(variable, variables[variable]);
}
}
return message;
},
wrongVoiceChannel: "You need to be in the same voice channel as RadioX to use this command!",
noPerms: "You need the %command.permission% permission to use this command!",
notPlaying: "There is nothing playing!",