k44Eqha/util.js

12 lines
371 B
JavaScript
Raw Normal View History

global.random = function (array) {
2023-10-11 01:14:42 +02:00
return array[Math.floor(Math.random() * array.length)]
}
global.sanitizeName = function sanitizeName(str){ // for showing names in discord
str = str.replace(/[_~*\\]/g,"\\$&"); // formatting
2023-10-11 01:14:42 +02:00
str = str.replace(/discord.gg\//g, 'discord.gg\\/'); // invites
str = str.replace(/(http|https):\/\//g, "$1\\://"); // urls
return str;
}