/[sudobot]/trunk/commands/mute.js
ViewVC logotype

Diff of /trunk/commands/mute.js

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 25 by rakin, Mon Jul 29 17:28:16 2024 UTC revision 37 by rakin, Mon Jul 29 17:28:18 2024 UTC
# Line 115  module.exports = { Line 115  module.exports = {
115      async mute(user, reason, msg, log, timeMs) {      async mute(user, reason, msg, log, timeMs) {
116          try {          try {
117              let mutedRole = await msg.guild.roles.cache.find(role => role.id === app.config.get('mute_role'));              let mutedRole = await msg.guild.roles.cache.find(role => role.id === app.config.get('mute_role'));
118              let generalRole = await msg.guild.roles.cache.find(role => role.id === app.config.get('gen_role'));              // let generalRole = await msg.guild.roles.cache.find(role => role.id === app.config.get('gen_role'));
119    
120              if (typeof mutedRole !== 'object' || mutedRole === null) {              if (typeof mutedRole !== 'object' || mutedRole === null) {
121                  await msg.reply({                  await msg.reply({
# Line 129  module.exports = { Line 129  module.exports = {
129                  return;                  return;
130              }              }
131    
132              if (typeof generalRole !== 'object' || generalRole === null) {              // if (typeof generalRole !== 'object' || generalRole === null) {
133                  await msg.reply({              //     await msg.reply({
134                      embeds: [              //         embeds: [
135                          new MessageEmbed()              //             new MessageEmbed()
136                          .setColor('#f14a60')              //             .setColor('#f14a60')
137                          .setDescription(`No general role is set.`)              //             .setDescription(`No general role is set.`)
138                      ]              //         ]
139                  });              //     });
140            
141                  return;              //     return;
142              }              // }
143    
144              if (!log)              if (!log)
145                  await History.create(user.id, msg.guild, 'mute', msg.author.id, async (data2) => {});                  await History.create(user.id, msg.guild, 'mute', msg.author.id, typeof reason === 'undefined' || reason.trim() === '' ? null : reason, async (data2) => {});
146    
147              await user.roles.add(mutedRole);              await user.roles.add(mutedRole);
148              await user.roles.remove(generalRole);              // await user.roles.remove(generalRole);
149    
150              if (timeMs !== false)              if (timeMs !== false)
151                  await app.logger.logMute(user, typeof reason === 'undefined' || reason.trim() === '' ? '*No reason provided*' : reason, timeMs, msg.author);                  await app.logger.logMute(user, typeof reason === 'undefined' || reason.trim() === '' ? '*No reason provided*' : reason, timeMs, msg.author);

Legend:
Removed from v.25  
changed lines
  Added in v.37

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26