Skip to content

Commit

Permalink
lint
Browse files Browse the repository at this point in the history
  • Loading branch information
Rdeisenroth committed Dec 6, 2023
1 parent d8f2bd8 commit e3ad0f7
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 21 deletions.
4 changes: 2 additions & 2 deletions src/commands/coach/session/quit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { Command } from "../../../../typings";
import { GuildModel } from "../../../models/guilds";
import { UserModel } from "../../../models/users";
import moment from "moment";
import {removeRoleFromUser} from "../../../utils/general";
import { removeRoleFromUser } from "../../../utils/general";

const command: Command = {
name: "quit",
Expand Down Expand Up @@ -34,7 +34,7 @@ const command: Command = {
return await client.utils.embeds.SimpleEmbed(interaction, { title: "Coaching System", text: "You Have no Active Coaching Session.", empheral: true });
}

await removeRoleFromUser(g, user, 'active_session')
await removeRoleFromUser(g, user, "active_session");

//TODO: Terminate Rooms

Expand Down
4 changes: 2 additions & 2 deletions src/commands/coach/session/start.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { UserModel } from "../../../models/users";
import { SessionModel, sessionRole } from "../../../models/sessions";
import { Queue } from "../../../models/queues";
import { DocumentType } from "@typegoose/typegoose";
import {assignRoleToUser} from "../../../utils/general";
import { assignRoleToUser } from "../../../utils/general";

const command: Command = {
name: "start",
Expand Down Expand Up @@ -60,7 +60,7 @@ const command: Command = {
userEntry.sessions.push(session._id);
await userEntry.save();

await assignRoleToUser(g, user, 'active_session')
await assignRoleToUser(g, user, "active_session");

client.utils.embeds.SimpleEmbed(interaction, { title: "Coaching System", text: "The Session was started.", empheral: true });
},
Expand Down
28 changes: 14 additions & 14 deletions src/models/queues.ts
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ export class Queue {
* Put an Entry into the Queue
* @param entry The Queue Entry
*/
public async join(this: DocumentType<Queue>, entry: QueueEntry): Promise<QueueEntry>{
public async join(this: DocumentType<Queue>, entry: QueueEntry): Promise<QueueEntry> {
if (this.entries.find(x => x.discord_id === entry.discord_id)) {
throw new Error("Dublicate Entry");
}
Expand All @@ -120,7 +120,7 @@ export class Queue {
* Leaves the queue
* @param discord_id The Discord ID of the entry
*/
public async leave(this: DocumentType<Queue>, discord_id: string): Promise<QueueEntry>{
public async leave(this: DocumentType<Queue>, discord_id: string): Promise<QueueEntry> {
const entry = this.entries.find(x => x.discord_id === discord_id);
if (!entry) {
throw new Error("Not Found");
Expand All @@ -133,7 +133,7 @@ export class Queue {
* Gets the Sorted Entries with the First ones being the ones with the highest Importance
* @param limit How many entries should we get at most?
*/
public getSortedEntries(this: DocumentType<Queue>, limit?: number | undefined): DocumentType<QueueEntry>[]{
public getSortedEntries(this: DocumentType<Queue>, limit?: number | undefined): DocumentType<QueueEntry>[] {
const entries = this.entries.sort((x, y) => {
const x_importance = (Date.now() - (+x.joinedAt)) * (x.importance || 1);
const y_importance = (Date.now() - (+y.joinedAt)) * (y.importance || 1);
Expand All @@ -145,7 +145,7 @@ export class Queue {
* Returns true if the ID is contained in the queue
* @param discord_id the Discord ID to check if it's contained
*/
public contains(this:DocumentType<Queue>, discord_id: string): boolean {
public contains(this: DocumentType<Queue>, discord_id: string): boolean {
return this.entries.some(x => x.discord_id === discord_id);
}
/**
Expand All @@ -159,7 +159,7 @@ export class Queue {
* Gets the Position in the Current Queue
* @param discord_id the Discord ID of the entry
*/
public getPosition(this: DocumentType<Queue>, discord_id: string): number{
public getPosition(this: DocumentType<Queue>, discord_id: string): number {
return this.getSortedEntries().findIndex(x => x.discord_id === discord_id);
}
/**
Expand Down Expand Up @@ -190,7 +190,7 @@ export class Queue {
* @param string The String to Interpolate
* @param entry_resolvable The Entry Resolvable
*/
public interpolateQueueString(this: DocumentType<Queue>, string:string, entry_resolvable?: string | QueueEntry | undefined): string | null{
public interpolateQueueString(this: DocumentType<Queue>, string: string, entry_resolvable?: string | QueueEntry | undefined): string | null {
try {
const replacements: StringReplacements = {
"limit": this.limit,
Expand Down Expand Up @@ -245,7 +245,7 @@ export class Queue {
* Gets the leave Message of the Queue
* @param entry_resolvable The Entry Resolvable
*/
public getLeaveMessage(this: DocumentType<Queue>, entry_resolvable?: string | QueueEntry | undefined): string{
public getLeaveMessage(this: DocumentType<Queue>, entry_resolvable?: string | QueueEntry | undefined): string {
const default_leave_message = "You left the Queue.";
if (this.leave_message) {
const leave_msg = this.interpolateQueueString(this.leave_message!, entry_resolvable);
Expand Down Expand Up @@ -273,7 +273,7 @@ export class Queue {
* Gets the leave Room Message of the Queue
* @param entry_resolvable The Entry Resolvable
*/
public getLeaveRoomMessage(this: DocumentType<Queue>, entry_resolvable?: string | QueueEntry | undefined): string{
public getLeaveRoomMessage(this: DocumentType<Queue>, entry_resolvable?: string | QueueEntry | undefined): string {
const default_leave_message = `You left the Room. Please confirm your stay or you will be removed from the queue after the Timeout of ${(this.disconnect_timeout ?? 0) / 1000}s.`;
if (this.leave_room_message) {
const leave_msg = this.interpolateQueueString(this.leave_room_message, entry_resolvable);
Expand Down Expand Up @@ -301,7 +301,7 @@ export class Queue {
* Gets the leave Message of the Queue
* @param entry_resolvable The Entry Resolvable
*/
public getJoinMessage(this: DocumentType<Queue>, entry_resolvable?: string | QueueEntry | undefined): string{
public getJoinMessage(this: DocumentType<Queue>, entry_resolvable?: string | QueueEntry | undefined): string {
const default_join_message = "You left the Queue.";
if (this.join_message) {
const join_msg = this.interpolateQueueString(this.join_message, entry_resolvable);
Expand All @@ -314,34 +314,34 @@ export class Queue {
/**
* Returns `true` if the Queue is Empty
*/
public isEmpty(this: DocumentType<Queue>): boolean{
public isEmpty(this: DocumentType<Queue>): boolean {
return this.entries.length < 1;
}
/**
* Locks the queue. This removes the voice Channel Permissions and disallows the queue from the /queue join command
*/
public async lock(this: DocumentType<Queue>): Promise<void>{
public async lock(this: DocumentType<Queue>): Promise<void> {
this.locked = true;
await this.$parent()?.save();
}
/**
* Unlocks the queue. This restores the voice Channel Permissions and allows the queue from the /queue join command
*/
public async unlock(this: DocumentType<Queue>): Promise<void>{
public async unlock(this: DocumentType<Queue>): Promise<void> {
this.locked = false;
await this.$parent()?.save();
}
/**
* Locks or Unlocks the queue (opposite State).
*/
public async toggleLock(this: DocumentType<Queue>): Promise<void>{
public async toggleLock(this: DocumentType<Queue>): Promise<void> {
this.locked = !this.locked;
await this.$parent()?.save();
}
/**
* Resolves all Waiting rooms for the current Queue
*/
public getWaitingRooms(this: DocumentType<Queue>, guild: Guild): DocumentType<VoiceChannel>[]{
public getWaitingRooms(this: DocumentType<Queue>, guild: Guild): DocumentType<VoiceChannel>[] {
return guild.voice_channels?.filter(x => x.queue?._id.equals(this._id!)) ?? [];
}
}
Expand Down
6 changes: 3 additions & 3 deletions src/utils/general.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import ChannelType, {
Message,
RoleResolvable,
User,
UserResolvable
UserResolvable,
} from "discord.js";
import moment from "moment";
import { Command, StringReplacements } from "../../typings";
Expand Down Expand Up @@ -408,7 +408,7 @@ export async function assignRoleToUser(g: Guild, user: User, roleName: string) {
if (role && member && !member.roles.cache.has(role.id)) {
await member.roles.add(role);
} else {
console.error(`Could not assign role: ${roleName} to ${user.username} on guild: ${g.name}`)
console.error(`Could not assign role: ${roleName} to ${user.username} on guild: ${g.name}`);
}
}

Expand All @@ -425,6 +425,6 @@ export async function removeRoleFromUser(g: Guild, user: User, roleName: string)
if (role && member && member.roles.cache.has(role.id)) {
await member.roles.remove(role);
} else {
console.error(`Could not remove role: ${roleName} from ${user.username} on guild: ${g.name}`)
console.error(`Could not remove role: ${roleName} from ${user.username} on guild: ${g.name}`);
}
}

0 comments on commit e3ad0f7

Please sign in to comment.