Skip to content

Commit 7e50240

Browse files
authored
Merge branch 'master' into claim-command-return
2 parents 8746c0b + bd22f6f commit 7e50240

File tree

3 files changed

+16
-8
lines changed

3 files changed

+16
-8
lines changed

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
"scripts": {
3434
"start": "ts-node-dev --respawn src",
3535
"build": "tsc",
36-
"lint": "prettier --check 'src/**/*.ts'",
37-
"lint:fix": "prettier 'src/**/*.ts' --write "
36+
"lint": "prettier --check \"src/**/*.ts\"",
37+
"lint:fix": "prettier \"src/**/*.ts\" --write "
3838
}
3939
}

src/modules/helpchan.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ export class HelpChanModule extends Module {
6060

6161
private getChannelName(guild: Guild) {
6262
const takenChannelNames = guild.channels.cache
63-
.filter(channel => channel.name.startsWith('help-'))
63+
.filter(channel => channel.name.startsWith(this.CHANNEL_PREFIX))
6464
.map(channel => channel.name.replace(this.CHANNEL_PREFIX, ''));
6565
let decidedChannel = channelNames[0];
6666

@@ -174,10 +174,16 @@ export class HelpChanModule extends Module {
174174
if (dormant && dormant instanceof TextChannel) {
175175
await this.moveChannel(dormant, categories.ask);
176176

177-
const lastMessage = dormant.messages.cache
177+
let lastMessage = dormant.messages.cache
178178
.array()
179179
.reverse()
180180
.find(m => m.author.id === this.client.user?.id);
181+
182+
if (!lastMessage)
183+
lastMessage = (await dormant.messages.fetch({ limit: 5 }))
184+
.array()
185+
.find(m => m.author.id === this.client.user?.id);
186+
181187
if (lastMessage) {
182188
// If there is a last message (the dormant message) by the bot, just edit it
183189
await lastMessage.edit(this.AVAILABLE_EMBED);

src/modules/rep.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,7 @@ export class RepModule extends Module {
1919

2020
MAX_REP = 3;
2121

22-
// all messages have to be fully lowercase
23-
THANKS_REGEX = /\b(?:thanks|thx|cheers|thanx|ty|tks|tkx)\b/i;
22+
THANKS_REGEX = /\b(?:thanks|thx|cheers|thanx|thnks|ty|tks|tkx)\b/i;
2423

2524
async getOrMakeUser(user: User) {
2625
let ru = await RepUser.findOne(
@@ -158,6 +157,7 @@ export class RepModule extends Module {
158157
description: 'See who has the most reputation',
159158
})
160159
async leaderboard(msg: Message) {
160+
const topEmojis = [':first_place:', ':second_place:', ':third_place:'];
161161
const data = ((await RepGive.createQueryBuilder('give')
162162
.select(['give.to', 'COUNT(*)'])
163163
.groupBy('give.to')
@@ -173,8 +173,10 @@ export class RepModule extends Module {
173173
.setDescription(
174174
data
175175
.map(
176-
x =>
177-
`:white_small_square: **<@${x.id}>** with **${x.count}** points.`,
176+
(x, index) =>
177+
`${
178+
topEmojis[index] || ':white_small_square:'
179+
} **<@${x.id}>** with **${x.count}** points.`,
178180
)
179181
.join('\n'),
180182
);

0 commit comments

Comments
 (0)