Add site breaker ping
This commit is contained in:
@@ -0,0 +1,9 @@
|
|||||||
|
--------------------------------------------------------------------------------
|
||||||
|
-- Up
|
||||||
|
--------------------------------------------------------------------------------
|
||||||
|
ALTER TABLE settings ADD site_breaker_role_id TEXT;
|
||||||
|
|
||||||
|
--------------------------------------------------------------------------------
|
||||||
|
-- Down
|
||||||
|
--------------------------------------------------------------------------------
|
||||||
|
ALTER TABLE settings DROP COLUMN site_breaker_role_id;
|
||||||
@@ -122,6 +122,12 @@ export default {
|
|||||||
.setName('github-release-channel')
|
.setName('github-release-channel')
|
||||||
.setDescription('Set the github release channel.')
|
.setDescription('Set the github release channel.')
|
||||||
.setRequired(false)
|
.setRequired(false)
|
||||||
|
)
|
||||||
|
.addRoleOption(option =>
|
||||||
|
option
|
||||||
|
.setName('site-breaker-role')
|
||||||
|
.setDescription('Set the site breaker role.')
|
||||||
|
.setRequired(false)
|
||||||
),
|
),
|
||||||
handler: async function (client: Client, interaction: ChatInputCommandInteraction) {
|
handler: async function (client: Client, interaction: ChatInputCommandInteraction) {
|
||||||
if (!interaction.guildId) return; // This shouldn't occur, but TypeScript doesn't know that.
|
if (!interaction.guildId) return; // This shouldn't occur, but TypeScript doesn't know that.
|
||||||
@@ -262,6 +268,12 @@ export default {
|
|||||||
response.push(`**github_release_channel** has been set to ${githubReleaseChannel}.`);
|
response.push(`**github_release_channel** has been set to ${githubReleaseChannel}.`);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const siteBreakerRole = interaction.options.getRole('site-breaker-role');
|
||||||
|
if (siteBreakerRole) {
|
||||||
|
await Database.updateGuildSettings(interaction.guildId, 'site_breaker_role_id', siteBreakerRole.id);
|
||||||
|
response.push(`**site_breaker_role_id** has been set to ${siteBreakerRole}.`);
|
||||||
|
}
|
||||||
|
|
||||||
if (response.length == 0) return interaction.editReply({ content: 'No settings have been modified.' });
|
if (response.length == 0) return interaction.editReply({ content: 'No settings have been modified.' });
|
||||||
interaction.editReply({ content: response.join('\n') });
|
interaction.editReply({ content: response.join('\n') });
|
||||||
}
|
}
|
||||||
|
|||||||
Vendored
+2
-1
@@ -28,8 +28,9 @@ export type GuildSettings = {
|
|||||||
link_skip_channels?: string
|
link_skip_channels?: string
|
||||||
github_release_channel?: string
|
github_release_channel?: string
|
||||||
moderator_channel_id?: string
|
moderator_channel_id?: string
|
||||||
private_help_channel_id?: string,
|
private_help_channel_id?: string
|
||||||
appeals_channel_id?: string
|
appeals_channel_id?: string
|
||||||
|
site_breaker_role_id?: string
|
||||||
}
|
}
|
||||||
|
|
||||||
type GuildSetting = Exclude<keyof GuildSettings, 'guild_id'>
|
type GuildSetting = Exclude<keyof GuildSettings, 'guild_id'>
|
||||||
|
|||||||
@@ -220,7 +220,7 @@ async function handleGithubRelease(client: Client, req: Request, res: Response):
|
|||||||
|
|
||||||
const date = new Date();
|
const date = new Date();
|
||||||
|
|
||||||
let message = `## [${months[date.getUTCMonth()]} ${date.getUTCDate()}, ${date.getUTCFullYear()}](<${data.release.html_url}>)\n\n${await fixPings(removeIssueLinks(data.release.body))}`;
|
let message = `## [${months[date.getUTCMonth()]} ${date.getUTCDate()}, ${date.getUTCFullYear()}](<${data.release.html_url}>)\n\n${settings.site_breaker_role_id ? `<@&${settings.site_breaker_role_id}>\n` : ''}${await fixPings(removeIssueLinks(data.release.body))}`;
|
||||||
|
|
||||||
logDebug('Sending github release message');
|
logDebug('Sending github release message');
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user