-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcommands.ts
230 lines (215 loc) · 5.34 KB
/
commands.ts
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
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
import * as CONSTANTS from './constants';
import * as functions from './functions';
import { User } from './classes';
export const commands = new discord.command.CommandGroup({
defaultPrefix: CONSTANTS.PREFIX
});
commands.on(
{
name: 'decode',
filters: CONSTANTS.FILTER,
onError: (ctx, error) => {
return;
}
},
(args) => ({ text: args.text() }),
async (message, { text }) => {
await message.reply(await functions.textify(message, text));
}
);
commands.on(
{
name: 'encode',
filters: CONSTANTS.FILTER,
onError: (ctx, error) => {
return;
}
},
(args) => ({ text: args.text() }),
async (message, { text }) => {
await message.reply(await functions.codify(message, text));
}
);
commands.on(
{
name: 'equip',
filters: CONSTANTS.FILTER,
onError: (ctx, error) => {
return;
}
},
(args) => ({ item: args.integer() }),
async (message, { item }) => {
return await functions.equip(message, item);
}
);
commands.on(
{
name: 'info',
filters: CONSTANTS.FILTER,
onError: (ctx, error) => {
return;
}
},
(args) => ({ item: args.integer() }),
async (message, { item }) => {
return await message.reply((await functions.info(message, item)) as any);
}
);
// Sneaky hidden command
commands.raw(
{
name: 'ZGVtb25z',
filters: CONSTANTS.FILTER,
onError: (ctx, error) => {
return;
}
},
async (message) => {
let u = await new User(message.author.id).getData();
if (!u.hasItem(8) || !u.isAuthorised(1) || u.hasItem(10)) {
return await message.delete(); // Ensuring the command stays a secret
}
u.addItem(10);
await message.reply(
'With a smile an executive welcomes you to the exucutive area. Happy you walk to your bigger office. "You can say goodbye to testing now", the executive says and shows you your new workspace'
);
}
);
commands.on(
{
name: 'r',
filters: CONSTANTS.FILTER,
onError: (ctx, error) => {
return;
}
},
(args) => ({ text: args.textOptional() }),
async (message, { text }) => {
if (!text) {
return await functions.unknownCommand(message);
}
if (text !== 'e l a x . t a k e a l o a d o f f .') {
return await functions.unknownCommand(message);
// Stupid way to do it but works Ig
}
await functions.relax(message);
}
);
commands.raw(
{
name: 'mail',
filters: CONSTANTS.FILTER
},
async (message) => {
let u = await new User(message.author.id).getData();
if (u.used_mail) {
return await message.reply(
'you glance into your mailbox, finding nothing but a bunch of cobwebs, the mailbox reminds you of yourself - empty inside'
);
}
let resp = await u.emptyMailbox();
await message.reply(resp);
}
);
commands.raw(
{
name: 'equipment',
filters: CONSTANTS.FILTER
},
async (message) => {
let embed = await functions.equipment(message);
await message.reply(embed);
}
);
//open.spotify.com/track/4ciaNqHWA2IzHphZaVRzHI?si=a7be8d8003d4471b
https: commands.raw(
{
name: 'directory',
filters: CONSTANTS.FILTER
},
async (message) => {
let u = await new User(message.author.id).getData();
await message.reply(
new discord.Embed({
title: 'Test Facility Directory',
description: `**Testing Area: A**
The main testing area. Basic and advanced tests may be conducted here.
**The Stockwell**
Run by a rather grumpy, and also mute shopkeeper. Don't bother showing up if you don't have any coin.
**Employee Break Room**
https://www.youtube.com/watch?v=WYUOKnZkgko
**Testing Area: Level 1 Clearance**
${
u.isAuthorised(1)
? 'Everyone here is listening to the newest hit song https://open.spotify.com/track/4ciaNqHWA2IzHphZaVRzHI?si=a7be8d8003d4471b though you prefer the number one song "test- 1-2-3 test"'
: `||[redacted]||
Required Items: [Clearance Badge: Level 1]
*not all zones visible`
}`
})
);
}
);
commands.raw(
{
name: 'craft',
filters: CONSTANTS.FILTER
},
async (message) => {
let u = await new User(message.author.id).getData();
try {
await u.craft();
} catch (_) {
return await message.reply('Not enough widgets to craft.');
}
await message.reply('A new item has been crafted.');
}
);
commands.raw(
{
name: 'inventory',
filters: CONSTANTS.FILTER
},
async (message) => {
let embed = await functions.constructInventory(message);
await message.reply(embed);
}
);
commands.on(
{
name: 'sell',
filters: CONSTANTS.FILTER,
onError: (ctx, error) => {
ctx.message.reply(functions.randomChoice(CONSTANTS.SELL_RESPONSES));
}
},
(args) => ({ item: args.integer(), amount: args.integerOptional() }),
async (message, { item, amount }) => {
await functions.sellItem(message, item, amount ?? 1);
}
);
commands.on(
{
name: 'buy',
filters: CONSTANTS.FILTER,
onError: (ctx, error) => {
ctx.message.reply('the shopkeeper looks at you curiously');
}
},
(args) => ({ item: args.number() }),
async (message, { item }) => {
await functions.buyItem(message, item);
}
);
// Handles if the command is unknown
commands.defaultRaw(async (message) => {
if (
![CONSTANTS.SHOP_CHANNEL, CONSTANTS.EXECUTIVE_CHANNEL].includes(
message.channelId
)
) {
return;
}
await functions.unknownCommand(message);
});