Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve queue join messages #53

Open
Rdeisenroth opened this issue Dec 31, 2023 · 0 comments
Open

Improve queue join messages #53

Rdeisenroth opened this issue Dec 31, 2023 · 0 comments
Assignees
Labels
enhancement New feature or request priority: medium An issue with medium priority

Comments

@Rdeisenroth
Copy link
Owner

This is where the interpolation options for the queue join messages are currently defined:

Rubot2/src/models/queues.ts

Lines 204 to 241 in b06fd7b

public interpolateQueueString(this: DocumentType<Queue>, string: string, entry_resolvable?: string | QueueEntry | undefined): string | null {
try {
const replacements: StringReplacements = {
"limit": this.limit,
"name": this.name,
"description": this.description,
"eta": "null",
"timeout": (this.disconnect_timeout ?? 0) / 1000,
"total": this.entries.length,
};
if (entry_resolvable) {
let entry: QueueEntry | null;
if (typeof entry_resolvable === "string") {
entry = this.getEntry(entry_resolvable);
} else {
entry = entry_resolvable;
}
if (entry && this.contains(entry.discord_id)) {
const entryReplacements: StringReplacements = {
"member_id": entry.discord_id,
"user": `<@${entry.discord_id}>`,
"pos": this.getPosition(entry.discord_id) + 1,
"time_spent": (moment.duration(Date.now() - (+entry.joinedAt)) as unknown as { format: (arg0: string) => string; })
.format("d[d ]h[h ]m[m ]s.S[s]"),
};
for (const [key, value] of Object.entries(entryReplacements)) {
replacements[key] = value;
}
}
}
// Interpolate String
return utils.general.interpolateString(string, replacements);
} catch (error) {
console.log(error);
return null;
}
}

As you can see, we are missing interpolation options for active_coaches, closing_time and possibly more. Also it is currently not possible to set the message with just commands. You have to manually edit the db.

Furthermore, we should use QueueModel.interpolateQueueString() here
https://github.com/Rdeisenroth/Rubot2/blob/b06fd7b825cc63053bd5556ee48f7117c7737489/src/events/VoiceStateUpdateEvent.ts#L98-L108C23

Actually the entire file could use some refactoring...

@Rdeisenroth Rdeisenroth added enhancement New feature or request priority: medium An issue with medium priority labels Dec 31, 2023
@AlphaKevin01 AlphaKevin01 self-assigned this Jan 9, 2024
AlphaKevin01 pushed a commit that referenced this issue Jan 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request priority: medium An issue with medium priority
Projects
None yet
Development

No branches or pull requests

2 participants