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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
|
import { Argument, Constants } from 'discord-akairo';
import { MessageEmbed, User } from 'discord.js';
import { AllowedMentions, BushCommand, BushMessage } from '../../lib';
const rules = [
{
title: "1.) Follow Discord's TOS",
description:
"Be sure to follow discord's TOS found at <https://discordapp.com/tos>, you must be 13 to use discord so if you admit to being under 13 you will be banned from the server."
},
{
title: '2.) Be Respectful',
description:
'Racist, sexist, homophobic, xenophobic, transphobic, ableist, hate speech, slurs, or any other derogatory, toxic, or discriminatory behavior will not be tolerated.'
},
{
title: '3.) No Spamming',
description:
'Including but not limited to: any messages that do not contribute to the conversation, repeated messages, randomly tagging users, and chat flood.'
},
{
title: '4.) English',
description: 'The primary language of the server is English, please keep all discussions in English.'
},
{
title: '5.) Safe for Work',
description:
'Please keep NSFW and NSFL content out of this server, avoid borderline images as well as keeping your status, profile picture, and banner SFW.'
},
{
title: '6.) No Advertising',
description: 'Do not promote anything without prior approval from a staff member, this includes DM advertising.'
},
{
title: '7.) Impersonation',
description:
'Do not try to impersonate others for the express intent of being deceitful, defamation , and/or personal gain.'
},
{ title: '8.) Swearing', description: 'Swearing is allowed only when not used as an insult.' },
{
title: "9.) Sending media that are able to crash a user's Discord",
description:
"Sending videos, GIFs, emojis, etc. that are able to crash someone's discord will result in a **permanent** ban that cannot be appealed."
},
{
title: '10.) No Backseat Moderating',
description: 'If you see a rule being broken be broken, please report it using: `-report <user> [evidence]`.'
},
{
title: '11.) Staff may moderate at their discretion',
description:
'If there are loopholes in our rules, the staff team may moderate based on what they deem appropriate. The staff team holds final discretion.'
}
];
export default class RuleCommand extends BushCommand {
public constructor() {
super('rule', {
aliases: ['rule', 'rules'],
category: "Moulberry's Bush",
description: {
content: 'A command to state a rule.',
usage: 'rule <rule> [user]',
examples: ['rule 1 IRONM00N', 'rule 2', 'rules']
},
args: [
{
id: 'rule',
type: Argument.range(Constants.ArgumentTypes.INTEGER, 1, rules.length, true),
match: Constants.ArgumentMatches.PHRASE,
prompt: {
start: 'What rule would you like to have cited?',
retry: '{error} Choose a valid rule.',
optional: true
}
},
{
id: 'user',
type: 'user',
match: Constants.ArgumentMatches.PHRASE,
prompt: {
start: 'What user would you like to mention?',
retry: '{error} Choose a valid user to mention.',
optional: true
}
}
],
clientPermissions: ['EMBED_LINKS', 'SEND_MESSAGES'],
channel: 'guild',
restrictedGuilds: ['516977525906341928'],
slash: true,
slashOptions: [
{
name: 'rule',
description: 'The rule you would you like to have cited',
type: 'INTEGER',
required: false
},
{
name: 'user',
description: 'The user you would like to mention.',
type: 'USER',
required: false
}
],
slashGuilds: ['516977525906341928']
});
}
public async exec(message: BushMessage, { rule, user }: { rule: undefined | number; user: User }): Promise<unknown> {
const rulesEmbed = new MessageEmbed()
.setColor('#ef3929')
.setFooter(`Triggered by ${message.author.tag}`, message.author.avatarURL({ dynamic: true }))
.setTimestamp();
if (rule > 12 || rule < 1) {
rule = undefined;
}
if (rule) {
if (rules[rule - 1]?.title && rules[rule - 1]?.description)
rulesEmbed.addField(rules[rule - 1].title, rules[rule - 1].description);
} else {
for (let i = 0; i < rules.length; i++) {
if (rules[i]?.title && rules[i]?.description) rulesEmbed.addField(rules[i].title, rules[i].description);
}
}
await respond();
if (!message.util.isSlash) {
await message.delete().catch(() => {});
}
return;
async function respond(): Promise<unknown> {
if (!user) {
return (
// If the original message was a reply -> imitate it
message.reference?.messageId && !message.util.isSlash
? await message.channel.messages.fetch(message.reference.messageId).then(async (message) => {
await message.util.reply({ embeds: [rulesEmbed], allowedMentions: AllowedMentions.users() });
})
: await message.util.send({ embeds: [rulesEmbed], allowedMentions: AllowedMentions.users() })
);
} else {
return message.reference?.messageId && !message.util.isSlash
? await message.util.send({
content: `<@!${user.id}>`,
embeds: [rulesEmbed],
allowedMentions: AllowedMentions.users(),
reply: { messageReference: message.reference.messageId }
})
: await message.util.send({
content: `<@!${user.id}>`,
embeds: [rulesEmbed],
allowedMentions: AllowedMentions.users()
});
}
}
}
}
|