-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathkick.coffee
59 lines (54 loc) · 1.91 KB
/
kick.coffee
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#! ========================================
#! Kick
handler = (msg, match, Haruka) ->
members = msg.mentions.members
if not members.size
return msg.reply [
"Do you even know how to use this command...?"
"Don’t use such a powerful command if you
don’t know how to use it."
].choose()
canKickAll = members.every (member) ->
# Override permissions if the executor is an op.
member.kickable or (msg.author.id in Haruka.config.ops)
if canKickAll
members.tap (member) ->
member.kick()
.then ->
msg.channel.send [
"Nice, I kicked #{member} successfully."
"Cool, #{member} was kicked."
"Bye bye, #{member}, you've been kicked."
].choose()
.catch (err) ->
msg.reply [
"Heck, I couldn't do that."
"Something happened."
"Dang, I wasn't able to do that."
].choose() + "\n```#{err}```"
else
msg.reply [
"You think you can do that? Nice try."
"I refuse to run that command."
"Who do you think you are, a mod?"
].choose()
module.exports = {
name: "Kick"
regex: /^(kick|eject)(\s+|$)/i
handler: handler
help:
short: "-h kick ::
Kicks mentioned users."
hidden: true
long: """
```asciidoc
=== Help for kick ===
*Aliases*: kick, eject
-h kick <user...> :: Kicks all the mentioned users.
Example:
-h kick @MindfulMinun @Haruka
Note: Both you and I must be able to kick *all* mentioned users.
This function fails even if only 1 member can't be kicked.
```
"""
}