11 |
import { fetchEmojiStr } from '../../utils/Emoji'; |
import { fetchEmojiStr } from '../../utils/Emoji'; |
12 |
import ms from 'ms'; |
import ms from 'ms'; |
13 |
import { clearTimeoutv2, getTimeouts, setTimeoutv2 } from '../../utils/setTimeout'; |
import { clearTimeoutv2, getTimeouts, setTimeoutv2 } from '../../utils/setTimeout'; |
14 |
|
import { hasPermission, shouldNotModerate } from '../../utils/util'; |
15 |
|
|
16 |
export default class tempBanCommand extends BaseCommand { |
export default class TempBanCommand extends BaseCommand { |
17 |
supportsInteractions: boolean = true; |
supportsInteractions: boolean = true; |
18 |
|
|
19 |
constructor() { |
constructor() { |
133 |
time = ms(time); |
time = ms(time); |
134 |
|
|
135 |
try { |
try { |
136 |
|
try { |
137 |
|
const member = await msg.guild?.members.fetch(user.id); |
138 |
|
|
139 |
|
if (member && !(await hasPermission(client, member, msg, null, "You don't have permission to tempban this user."))) { |
140 |
|
return; |
141 |
|
} |
142 |
|
|
143 |
|
if (member && shouldNotModerate(client, member)) { |
144 |
|
await msg.reply({ |
145 |
|
embeds: [ |
146 |
|
new MessageEmbed() |
147 |
|
.setColor('#f14a60') |
148 |
|
.setDescription(`This user cannot be tempbanned.`) |
149 |
|
] |
150 |
|
}); |
151 |
|
|
152 |
|
return; |
153 |
|
} |
154 |
|
} |
155 |
|
catch (e) { |
156 |
|
console.log(e); |
157 |
|
} |
158 |
|
|
159 |
await msg.guild?.bans.create(user, banOptions); |
await msg.guild?.bans.create(user, banOptions); |
160 |
|
|
161 |
const punishment = await Punishment.create({ |
const punishment = await Punishment.create({ |
228 |
return; |
return; |
229 |
} |
} |
230 |
} |
} |
|
} |
|
231 |
|
} |