You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/modules/helpchan.ts
+79-21
Original file line number
Diff line number
Diff line change
@@ -12,18 +12,21 @@ import {
12
12
Guild,
13
13
TextChannel,
14
14
GuildMember,
15
+
User,
15
16
}from'discord.js';
16
17
import{HelpUser}from'../entities/HelpUser';
17
18
import{
18
19
categories,
19
20
TS_BLUE,
20
21
GREEN,
22
+
HOURGLASS_ORANGE,
21
23
askCooldownRoleId,
22
24
channelNames,
23
25
dormantChannelTimeout,
24
26
dormantChannelLoop,
25
27
askHelpChannelId,
26
28
ongoingEmptyTimeout,
29
+
trustedRoleId,
27
30
}from'../env';
28
31
import{isTrustedMember}from'../util/inhibitors';
29
32
@@ -39,6 +42,26 @@ This channel will be dedicated to answering your question only. Others will try
39
42
For more tips, check out StackOverflow's guide on **[asking good questions](https://stackoverflow.com/help/how-to-ask)**.
40
43
`;
41
44
45
+
// The "empty" line has a braille pattern blank unicode character, in order to
46
+
// achieve a leading newline, since normally whitespace is stripped. This is a
47
+
// hack, but it works even on a system without the fonts to display Discord
48
+
// emoji, so it should work everywhere. https://www.compart.com/en/unicode/U+2800
49
+
constoccupiedMessage=(asker: User)=>`
50
+
⠀
51
+
**This channel is claimed by ${asker}.**
52
+
It is dedicated to answering their questions only. More info: <#${askHelpChannelId}>
53
+
54
+
**${asker} You'll get better and faster answers if you:**
55
+
• Describe the context. What are you trying to accomplish?
56
+
• Include any error messages, and the code that produce them (5-15 lines).
57
+
• Use code blocks, not screenshots. Start with ${'```ts'} for syntax highlighting.
58
+
• Also reproduce the issue in the **[TypeScript Playground](https://www.typescriptlang.org/play)**, if possible.
59
+
60
+
Usually someone will try to answer and help solve the issue within a few hours. If not, and you have followed the bullets above, you may ping the <@&${trustedRoleId}> role.
61
+
62
+
For more tips, check out StackOverflow's guide on **[asking good questions](https://stackoverflow.com/help/how-to-ask)**.
63
+
`;
64
+
42
65
constDORMANT_MESSAGE=`
43
66
This help channel has been marked as **dormant**, and has been moved into the **Help: Dormant** category at the bottom of the channel list. It is no longer possible to send messages in this channel until it becomes available again.
44
67
@@ -62,7 +85,22 @@ export class HelpChanModule extends Module {
62
85
} hours of inactivity or when you send !close.`,
63
86
);
64
87
88
+
OCCUPIED_EMBED_BASE=newMessageEmbed()
89
+
.setTitle('⌛ Occupied Help Channel')
90
+
.setColor(HOURGLASS_ORANGE);
91
+
92
+
occupiedEmbed(asker: User){
93
+
returnnewMessageEmbed(this.OCCUPIED_EMBED_BASE)
94
+
.setDescription(occupiedMessage(asker))
95
+
.setFooter(
96
+
`Closes after ${
97
+
dormantChannelTimeout/60/60/1000
98
+
} hours of inactivity or when ${asker.username} sends !close.`,
99
+
);
100
+
}
101
+
65
102
DORMANT_EMBED=newMessageEmbed()
103
+
.setTitle('💤 Dormant Help Channel')
66
104
.setColor(TS_BLUE)
67
105
.setDescription(DORMANT_MESSAGE);
68
106
@@ -117,9 +155,8 @@ export class HelpChanModule extends Module {
0 commit comments