Skip to content

Commit 5e3d016

Browse files
committed
OOP: Fix Mentions, SeedMeta, events
1 parent dbd32ee commit 5e3d016

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+1038
-281
lines changed

src/classes/command/modcommand.class.js

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
* inlineCode
1313
* bold
1414
* italic
15+
* userMention
1516
*/
1617
const {
1718
ChatInputCommandInteraction,
@@ -22,7 +23,8 @@ const {
2223
codeBlock,
2324
inlineCode,
2425
bold,
25-
italic
26+
italic,
27+
userMention
2628
} = require('discord.js')
2729
// Admin Command
2830
const { AdminCommand } = require('./admincommand.class')
@@ -298,9 +300,9 @@ class ModCommand extends AdminCommand {
298300
roles,
299301
reason
300302
) || false
301-
this.props.description = `${this.profile.emojis.prod} <@${user.id}> has been ${voice}d`
303+
this.props.description = `${this.profile.emojis.prod} ${userMention(user.id)} has been ${voice}d`
302304
} else {
303-
this.props.description = `${this.profile.emojis.dev} <@${user.id}> ${italic('would be')} ${bold(voice + 'd')} if this wasn't in DEV Mode`
305+
this.props.description = `${this.profile.emojis.dev} ${userMention(user.id)} ${italic('would be')} ${bold(voice + 'd')} if this wasn't in DEV Mode`
304306
}
305307

306308
return success
@@ -661,7 +663,7 @@ class ModCommand extends AdminCommand {
661663
}
662664
// Do link user
663665
props.mod.description = [
664-
`${this.profile.emojis.check} User <@${targetUserId}> successfully ${bold(tenses.past)} via DMs!`,
666+
`${this.profile.emojis.check} User ${userMention(targetUserId)} successfully ${bold(tenses.past)} via DMs!`,
665667
]
666668
props.mod.description.push(
667669
"",
@@ -685,7 +687,7 @@ class ModCommand extends AdminCommand {
685687
color: this.profile.colors.error,
686688
title: { text: "[YouPost] Error" },
687689
description: [
688-
`${this.profile.emojis.fail} I couldn't send the DM to the user (ID: ${targetUserId}).`,
690+
`${this.profile.emojis.fail} I couldn't send the DM to the user [${targetUserId}].`,
689691
`They might have DMs disabled.`
690692
],
691693
ephemeral: true
@@ -740,15 +742,15 @@ class ModCommand extends AdminCommand {
740742
name: 'User ' + tenses.past.ucfirst(),
741743
value: [
742744
targetUser,
743-
`(ID: ${inlineCode(targetUserId)})`
745+
`[${inlineCode(targetUserId)}]`
744746
]
745747
},
746748
// Whodunnit?
747749
{
748750
name: tenses.past.ucfirst() + ' By',
749751
value: [
750752
interaction.user,
751-
`(ID: ${inlineCode(interaction.user.id)})`
753+
`[${inlineCode(interaction.user.id)}]`
752754
]
753755
}
754756
],
@@ -757,7 +759,7 @@ class ModCommand extends AdminCommand {
757759
{
758760
name: 'Guild',
759761
value: interaction.guild.name + "\n" +
760-
`(ID: ${inlineCode(interaction.guild.id)})`
762+
`[${inlineCode(interaction.guild.id)}]`
761763
}
762764
]
763765
)
@@ -903,7 +905,7 @@ class ModCommand extends AdminCommand {
903905
props.mod.title = { text: "[YouPost]" }
904906
props.mod.error = true
905907
props.mod.ephemeral = true
906-
props.mod.description = `${this.profile.emojis.fail} I couldn't ${tenses.present} ${targetUser} (ID: ${inlineCode(targetUserId)}).`
908+
props.mod.description = `${this.profile.emojis.fail} I couldn't ${tenses.present} ${targetUser} [${inlineCode(targetUserId)}].`
907909
embeds.mod = await new RookEmbed(client, props.mod)
908910
await this.send(
909911
client,

src/classes/command/salutation.class.js

Lines changed: 21 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// @ts-nocheck
22

3-
// Formatters: codeBlock, inlineCode, hyperlink
4-
const { codeBlock, inlineCode, hyperlink } = require('discord.js')
3+
// Formatters: codeBlock, inlineCode, hyperlink, userMention
4+
const { codeBlock, inlineCode, hyperlink, userMention } = require('discord.js')
55
// Base Rook Command
66
const { RookCommand } = require('./rcommand.class')
77
// Base Rook Embed
@@ -85,13 +85,21 @@ class SalutationCommand extends RookCommand {
8585
}
8686
mode_msg = `${mode_tag} ${mode_msg} ${mode_tag}`
8787

88-
// Git Repository info
89-
// FIXME: Extrapolate
90-
let git_info = {
91-
user: "mysterypaintwo",
92-
repo: "rookbot"
93-
}
94-
git_info.root = `https://github.com/${git_info.user}/${git_info.repo}`
88+
let ci_data = require(
89+
path.join(
90+
__dirname,
91+
"..",
92+
"..",
93+
"..",
94+
"resources",
95+
"app",
96+
"meta",
97+
"manifests",
98+
"ci"
99+
)
100+
)
101+
let git_info = ci_data.common.common.repo
102+
git_info.root = `https://github.com/${git_info.username}/${git_info.repository}`
95103

96104
// Get Branch
97105
try {
@@ -148,13 +156,13 @@ class SalutationCommand extends RookCommand {
148156
// Development Mode
149157
console_output.push(
150158
mode_msg,
151-
`Footer Tag: "${this.profile.name}"`
159+
`Footer Tag: "${this.profile.name}"`
152160
)
153161
} else {
154162
// Production Mode
155163
console_output.push(
156164
mode_msg,
157-
'Footer Tag: "' + (user ? user.username : "") + '"'
165+
'Footer Tag: "' + (user ? user.username : "") + '"'
158166
)
159167
}
160168

@@ -227,7 +235,7 @@ class SalutationCommand extends RookCommand {
227235
.replace(
228236
this.profile.name,
229237
this.profile?.discord?.user?.id ?
230-
`<@${this.profile.discord.user.id}>` :
238+
userMention(this.profile.discord.user.id) :
231239
this.profile.name
232240
)
233241
},
@@ -321,7 +329,7 @@ class SalutationCommand extends RookCommand {
321329
console_output[8]
322330
.replace(
323331
"Bot",
324-
`<@${user.id}>`
332+
userMention(user.id)
325333
) :
326334
console_output[8]
327335
}

src/commands/app/exit.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
// @ts-nocheck
22

3+
// Formatters: userMention
4+
const { userMention } = require('discord.js')
35
// BotDevCommand
46
const { BotDevCommand } = require('../../classes/command/botdevcommand.class')
57
// UptimeCommand
@@ -53,7 +55,7 @@ module.exports = class ExitCommand extends BotDevCommand {
5355

5456
// Log who called Exit
5557
console.log(`!!! Bot Exit by: ${interaction.member.user.tag} !!!`)
56-
this.props.description = `Exiting <@${client.user.id}>`
58+
this.props.description = `Exiting ${userMention(client.user.id)}`
5759

5860
// Call UptimeCommand
5961
let uptime = await new UptimeCommand(client)

src/commands/app/install.js

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,22 @@ module.exports = class InstallCommand extends BotDevCommand {
5555
"---"
5656
]
5757

58+
let ci_data = require(
59+
path.join(
60+
__dirname,
61+
"..",
62+
"..",
63+
"..",
64+
"resources",
65+
"app",
66+
"meta",
67+
"manifests",
68+
"ci"
69+
)
70+
)
71+
let git_info = ci_data.common.common.repo
72+
git_info.root = `https://github.com/${git_info.username}/${git_info.repository}`
73+
5874
// Print Name & Version number
5975
console_output.push(
6076
"Installing " +
@@ -63,7 +79,7 @@ module.exports = class InstallCommand extends BotDevCommand {
6379
)
6480
this.props.title = {
6581
text: "💿 " + console_output[1],
66-
url: "https://github.com/mysterypaintwo/rookbot"
82+
url: git_info.root
6783
}
6884

6985
// console.log(console_output)

src/commands/app/pull.js

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -141,11 +141,27 @@ module.exports = class PullCommand extends BotDevCommand {
141141
(user ? user.username : "") +
142142
` v${this.profile.PACKAGE.version}!`
143143
)
144+
let ci_data = require(
145+
path.join(
146+
__dirname,
147+
"..",
148+
"..",
149+
"..",
150+
"resources",
151+
"app",
152+
"meta",
153+
"manifests",
154+
"ci"
155+
)
156+
)
157+
let git_info = ci_data.common.common.repo
158+
git_info.root = `https://github.com/${git_info.username}/${git_info.repository}`
159+
144160
this.props = {
145161
title: {
146162
text: console_output[1],
147163
emoji: "⏫",
148-
url: "https://github.com/mysterypaintwo/rookbot"
164+
url: git_info.root
149165
}
150166
}
151167

@@ -157,14 +173,6 @@ module.exports = class PullCommand extends BotDevCommand {
157173
""
158174
)
159175

160-
// Git Repository info
161-
// FIXME: Extrapolate
162-
let git_info = {
163-
user: "mysterypaintwo",
164-
repo: "rookbot"
165-
}
166-
git_info.root = `https://github.com/${git_info.user}/${git_info.repo}`
167-
168176
// console.log(console_output)
169177

170178
/*

src/commands/app/say.js

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -94,12 +94,12 @@ module.exports = class SayCommand extends ModCommand {
9494
let message = null
9595

9696
if (!client) {
97-
console.log("No client sent")
97+
// console.log("No client sent")
9898
return false
9999
}
100100

101101
if (!messageURL || (messageURL == "")) {
102-
// No message URL sent
102+
// console.log("No message URL sent")
103103
return false
104104
}
105105

@@ -193,7 +193,7 @@ module.exports = class SayCommand extends ModCommand {
193193
webhooks = await interaction.guild.fetchWebhooks()
194194
if (!webhooks) {
195195
this.error = true
196-
this.props.description = `Couldn't load webhooks for ${italic(interaction.guild.name)} (ID: ${inlineCode(interaction.guild.id)})`
196+
this.props.description = `Couldn't load webhooks for ${italic(interaction.guild.name)} [${inlineCode(interaction.guild.id)}]`
197197
return false
198198
}
199199

@@ -219,7 +219,7 @@ module.exports = class SayCommand extends ModCommand {
219219

220220
if (!rookhook) {
221221
this.error = true
222-
this.props.description = `rookhook not found for ${italic(interaction.guild.name)} (ID: ${inlineCode(interaction.guild.id)})`
222+
this.props.description = `rookhook not found for ${italic(interaction.guild.name)} [${inlineCode(interaction.guild.id)}]`
223223
return false
224224
}
225225

@@ -257,7 +257,7 @@ module.exports = class SayCommand extends ModCommand {
257257

258258
if (!rookhookEdit) {
259259
this.error = true
260-
this.props.description = `Couldn't edit rookhook (ID: ${inlineCode(webhookID)})`
260+
this.props.description = `Couldn't edit rookhook [${inlineCode(webhookID)}]`
261261
return false
262262
}
263263

@@ -432,7 +432,7 @@ module.exports = class SayCommand extends ModCommand {
432432
)
433433

434434
if (!rookhookEdit) {
435-
console.log("Couldn't reset rookhook!")
435+
// console.log("Couldn't reset rookhook!")
436436
}
437437
}
438438
}
@@ -463,7 +463,7 @@ module.exports = class SayCommand extends ModCommand {
463463
// Whodunnit?
464464
{
465465
name: "User",
466-
value: `${interaction.user} (ID: ${inlineCode(interaction.user.id)})`
466+
value: `${interaction.user} [${inlineCode(interaction.user.id)}]`
467467
}
468468
],
469469
[
@@ -487,7 +487,7 @@ module.exports = class SayCommand extends ModCommand {
487487
value:
488488
[
489489
interaction?.guild?.name,
490-
`(ID: ${inlineCode(interaction?.guild?.id)})`
490+
`[${inlineCode(interaction?.guild?.id)}]`
491491
]
492492
},
493493
// Sent to what Channel?
@@ -496,15 +496,15 @@ module.exports = class SayCommand extends ModCommand {
496496
value:
497497
[
498498
`<#${result?.channel?.id}>`,
499-
`(ID: ${inlineCode(channel?.id)})`
499+
`[${inlineCode(channel?.id)}]`
500500
]
501501
}
502502
],
503503
[
504504
// Message Link
505505
{
506506
name: "Message",
507-
value: `${result.url} (ID: ${inlineCode(result?.id)})`
507+
value: `${result.url} [${inlineCode(result?.id)}]`
508508
}
509509
],
510510
[

src/commands/app/shutdown.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
// @ts-nocheck
22

3+
// Formatters: userMention
4+
const { userMention } = require('discord.js')
35
// BotDevCommand
46
const { BotDevCommand } = require('../../classes/command/botdevcommand.class')
57
// UptimeCommand
@@ -95,7 +97,7 @@ module.exports = class ShutdownCommand extends BotDevCommand {
9597
target: "guild"
9698
}
9799

98-
this.props.description = `${action} <@${client.user?.id}>`
100+
this.props.description = `${action} ${userMention(client.user?.id)}`
99101

100102
// Post action taking place
101103
let this_embed = await new RookEmbed(client, this.props)

src/commands/app/update.js

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,22 @@ module.exports = class UpdateCommand extends BotDevCommand {
4545
"---"
4646
]
4747

48+
let ci_data = require(
49+
path.join(
50+
__dirname,
51+
"..",
52+
"..",
53+
"..",
54+
"resources",
55+
"app",
56+
"meta",
57+
"manifests",
58+
"ci"
59+
)
60+
)
61+
let git_info = ci_data.common.common.repo
62+
git_info.root = `https://github.com/${git_info.username}/${git_info.repository}`
63+
4864
// Print Name & Version number
4965
console_output.push(
5066
"Updating " +
@@ -53,7 +69,7 @@ module.exports = class UpdateCommand extends BotDevCommand {
5369
)
5470
this.props.title = {
5571
text: "💿 " + console_output[1],
56-
url: "https://github.com/mysterypaintwo/rookbot"
72+
url: git_info.root
5773
}
5874

5975
// console.log(console_output)

0 commit comments

Comments
 (0)