diff options
Diffstat (limited to 'commands')
-rw-r--r-- | commands/games/battleship.js | 3 | ||||
-rw-r--r-- | commands/mod/defaults/strip-roles.js.json | 2 | ||||
-rw-r--r-- | commands/mod/strip-roles.js | 35 | ||||
-rw-r--r-- | commands/util/emote.js | 20 |
4 files changed, 58 insertions, 2 deletions
diff --git a/commands/games/battleship.js b/commands/games/battleship.js index 2d71f03..136124a 100644 --- a/commands/games/battleship.js +++ b/commands/games/battleship.js @@ -164,7 +164,8 @@ module.exports = { if(bttl_db.length==0) return args.message.reply({content:"id not found!",ephemeral:true}) } - let game_test = db.BattleShip.findAll({where:{p1_id:args.message.author.id,status:"open"}}) + let game_test = await db.BattleShip.findAll({where:{p1_id:args.message.author.id,status:"open"}}) + if(game_test.length!=0) return args.message.reply({content:"you are already in a game!",ephemeral:true}) diff --git a/commands/mod/defaults/strip-roles.js.json b/commands/mod/defaults/strip-roles.js.json new file mode 100644 index 0000000..ef0c9a2 --- /dev/null +++ b/commands/mod/defaults/strip-roles.js.json @@ -0,0 +1,2 @@ +{"cooldown":-1,"desc":"Remove all roles from a user","restrict":[],"restricted":[], +"usage":"{command} [user, ...]"}
\ No newline at end of file diff --git a/commands/mod/strip-roles.js b/commands/mod/strip-roles.js new file mode 100644 index 0000000..6432919 --- /dev/null +++ b/commands/mod/strip-roles.js @@ -0,0 +1,35 @@ +const Discord = require("discord.js") +const { EmbedBuilder } = require("discord.js"); +const { PermissionsBitField } = require('discord.js'); +const settings = require("../../src/settings") +const fs = require('fs') +let config_loc = __filename+".json" +let config = JSON.parse(fs.readFileSync(config_loc)) +module.exports = { + name: "strip-roles", + command: ["strip-roles"], + mod_only:true, + config:config, + config_loc:config_loc, + async main(client,Discord,message,args) { + let mentioned = []; + let failed = 0; + message.mentions.users.map( o => { + try{ + message.guild.members.cache.get(o.id).roles.remove(member.roles.cache) + }catch(e){ + failed++ + } + }) + if(failed!=0) message.reply("failed "+failed+" modifications (permission error)") + //this.exec(client,{message:message,user:user}) + }, + exec(client,param){ + const motw = new EmbedBuilder() + .setTitle("Member of the Week") + .setColor(settings.defaultColor) + .setDescription(param.name) + .setImage(param.image); + param.message.channel.send({ embeds: [motw] }); + } +};
\ No newline at end of file diff --git a/commands/util/emote.js b/commands/util/emote.js index a6f4430..1b69c95 100644 --- a/commands/util/emote.js +++ b/commands/util/emote.js @@ -25,6 +25,24 @@ module.exports = { else interaction.reply({content:"invalid emote!", ephemeral: true}) }, + async get_pronouns(message, userid){ + let pronoun = null + let count = 0 + /* + would add more pronouns, but we dont have any pronoun roles + */ + message.member.roles.cache.some((r) => { + switch(r.name.toLowerCase()){ + case "she/her": + pronoun = "herself"; count++ + break; + case "he/him": + pronoun = "himself"; count++ + break; + } + }) + return count == 1? pronoun : "themselves" + }, async exec(client,param){ let msg = ""; if(Object.keys(config.avaliable_multi.value).includes(param.emote)){ @@ -32,7 +50,7 @@ module.exports = { if(!param.mentioned) return param.message.reply({content:"please mention someone", ephemeral: true}) if(param.mentioned.id==param.message.author.id) - msg="<@"+param.message.author.id+"> "+config.avaliable_multi.value[param.emote]+" themselves" + msg="<@"+param.message.author.id+"> "+config.avaliable_multi.value[param.emote]+" "+await this.get_pronouns(param.message, param.message.author.id) else if(param.mentioned.id=="762561860150362142") msg="<@"+param.message.author.id+"> "+config.avaliable_multi.value[param.emote]+" me!" else |