-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add hidden group and competition moderation controls (#256)
* Add hidden group moderation controls * Add hidden competition moderation controls
- Loading branch information
Showing
14 changed files
with
600 additions
and
43 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
import { ChannelType, Client, EmbedBuilder, TextChannel } from 'discord.js'; | ||
import { encodeURL, Event } from '../../utils'; | ||
import { CompetitionListItem } from '@wise-old-man/utils'; | ||
import { createModerationButtons, ModerationType } from '../../utils/buttonInteractions'; | ||
import config from '../../config'; | ||
|
||
class HiddenCompetitionCreated implements Event { | ||
type: string; | ||
|
||
constructor() { | ||
this.type = 'HIDDEN_COMPETITION_CREATED'; | ||
} | ||
|
||
async execute(data: CompetitionListItem, client: Client) { | ||
const { id, title, groupId, participantCount } = data['competition']; | ||
|
||
const actions = createModerationButtons(ModerationType.COMPETITION, id); | ||
|
||
const message = new EmbedBuilder() | ||
.setColor(config.visuals.blue) | ||
.setTitle(`A hidden competition was created`) | ||
.setDescription( | ||
`Id: ${id}\nTitle: ${title}\nParticipants: ${participantCount}\nGroup Id: ${ | ||
groupId ? '[' + groupId + '](https://wiseoldman.net/groups/' + groupId + ')' : groupId | ||
}` | ||
) | ||
.setURL(encodeURL(`https://wiseoldman.net/competitions/${id}`)); | ||
|
||
const reviewChannel = client.channels?.cache.get(config.discord.channels.underAttackModeFeed); | ||
if (!reviewChannel) return; | ||
if (!((channel): channel is TextChannel => channel.type === ChannelType.GuildText)(reviewChannel)) | ||
return; | ||
|
||
await reviewChannel.send({ | ||
embeds: [message], | ||
components: [actions] | ||
}); | ||
} | ||
} | ||
|
||
export default new HiddenCompetitionCreated(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import { ChannelType, Client, EmbedBuilder, TextChannel } from 'discord.js'; | ||
import { Event } from '../../utils/events'; | ||
import { GroupListItem } from '@wise-old-man/utils'; | ||
import config from '../../config'; | ||
import { encodeURL } from '../../utils'; | ||
import { createModerationButtons, ModerationType } from '../../utils/buttonInteractions'; | ||
|
||
class HiddenGroupCreated implements Event { | ||
type: string; | ||
|
||
constructor() { | ||
this.type = 'HIDDEN_GROUP_CREATED'; | ||
} | ||
|
||
async execute(data: GroupListItem, client: Client) { | ||
const { id, name, description, memberCount } = data['group']; | ||
|
||
const actions = createModerationButtons(ModerationType.GROUP, id); | ||
|
||
const message = new EmbedBuilder() | ||
.setColor(config.visuals.blue) | ||
.setTitle(`A hidden group was created`) | ||
.setDescription(`Id: ${id}\nName: ${name}\nDescription: ${description}\nMembers: ${memberCount}`) | ||
.setURL(encodeURL(`https://wiseoldman.net/groups/${id}`)); | ||
|
||
const reviewChannel = client.channels?.cache.get(config.discord.channels.underAttackModeFeed); | ||
if (!reviewChannel) return; | ||
if (!((channel): channel is TextChannel => channel.type === ChannelType.GuildText)(reviewChannel)) | ||
return; | ||
|
||
await reviewChannel.send({ | ||
embeds: [message], | ||
components: [actions] | ||
}); | ||
} | ||
} | ||
|
||
export default new HiddenGroupCreated(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.