Adds icons to group list and adds new playdate
This commit is contained in:
parent
2f826fbf36
commit
8ac59567b9
4 changed files with 55 additions and 6 deletions
|
|
@ -3,7 +3,13 @@ import {
|
|||
Interaction,
|
||||
CommandInteraction,
|
||||
ChatInputCommandInteraction,
|
||||
MessageFlags, GuildMemberRoleManager, InteractionReplyOptions, GuildMember, EmbedBuilder, AutocompleteInteraction
|
||||
MessageFlags,
|
||||
GuildMemberRoleManager,
|
||||
InteractionReplyOptions,
|
||||
GuildMember,
|
||||
EmbedBuilder,
|
||||
AutocompleteInteraction,
|
||||
formatEmoji, roleMention, time
|
||||
} from "discord.js";
|
||||
import {AutocompleteCommand, ChatInteractionCommand, Command} from "./Command";
|
||||
import {GroupModel} from "../../Models/GroupModel";
|
||||
|
|
@ -17,6 +23,9 @@ import {GroupConfigurationRenderer} from "../../Groups/GroupConfigurationRendere
|
|||
import {GroupConfigurationHandler} from "../../Groups/GroupConfigurationHandler";
|
||||
import {GroupConfigurationTransformers} from "../../Groups/GroupConfigurationTransformers";
|
||||
import {GroupConfigurationRepository} from "../../Repositories/GroupConfigurationRepository";
|
||||
import {IconCache} from "../../Icons/IconCache";
|
||||
import {PlaydateRepository} from "../../Repositories/PlaydateRepository";
|
||||
import playdate from "../../Database/tables/Playdate";
|
||||
|
||||
export class GroupCommand implements Command, ChatInteractionCommand, AutocompleteCommand {
|
||||
private static GOODBYE_MESSAGES: string[] = [
|
||||
|
|
@ -109,15 +118,29 @@ export class GroupCommand implements Command, ChatInteractionCommand, Autocomple
|
|||
const repo = Container.get<GroupRepository>(GroupRepository.name);
|
||||
const groups = repo.findGroupsByMember(<GuildMember>interaction.member);
|
||||
|
||||
const playdateRepo = Container.get<PlaydateRepository>(PlaydateRepository.name);
|
||||
|
||||
const iconCache = Container.get<IconCache>(IconCache.name);
|
||||
|
||||
const embed = new EmbedBuilder()
|
||||
.setTitle("Your groups on this server:")
|
||||
.setFields(
|
||||
groups.map(group => {
|
||||
const nextPlaydate = playdateRepo.getNextPlaydateForGroup(group);
|
||||
|
||||
const values = [
|
||||
`${iconCache.getEmoji("people_group_solid")} ${roleMention(group.role.roleid)}`
|
||||
];
|
||||
|
||||
if (nextPlaydate) {
|
||||
values.push(
|
||||
`${iconCache.getEmoji("calendar_days_solid")} ${time(nextPlaydate.from_time, "F")}`
|
||||
)
|
||||
}
|
||||
|
||||
return {
|
||||
name: group.name,
|
||||
value: `
|
||||
Role: <@&${group.role.roleid}>
|
||||
`
|
||||
value: values.join("\n")
|
||||
}
|
||||
})
|
||||
)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue