Skip to content

Commit

Permalink
fixed LF eslint
Browse files Browse the repository at this point in the history
  • Loading branch information
Reynard-G committed Jan 10, 2024
1 parent 79002ca commit 3f5ae21
Showing 1 changed file with 42 additions and 42 deletions.
84 changes: 42 additions & 42 deletions src/commands/loop-queue.ts
Original file line number Diff line number Diff line change
@@ -1,42 +1,42 @@
import {ChatInputCommandInteraction} from 'discord.js';
import {TYPES} from '../types.js';
import {inject, injectable} from 'inversify';
import PlayerManager from '../managers/player.js';
import Command from '.';
import {SlashCommandBuilder} from '@discordjs/builders';
import {STATUS} from '../services/player.js';

@injectable()
export default class implements Command {
public readonly slashCommand = new SlashCommandBuilder()
.setName('loop-queue')
.setDescription('toggle looping the entire queue');

public requiresVC = true;

private readonly playerManager: PlayerManager;

constructor(@inject(TYPES.Managers.Player) playerManager: PlayerManager) {
this.playerManager = playerManager;
}

public async execute(interaction: ChatInputCommandInteraction): Promise<void> {
const player = this.playerManager.get(interaction.guild!.id);

if (player.status === STATUS.IDLE) {
throw new Error('no songs to loop!');
}

if (player.queueSize() < 2) {
throw new Error('not enough songs to loop a queue!');
}

if (player.loopCurrentSong) {
player.loopCurrentSong = false;
}

player.loopCurrentQueue = !player.loopCurrentQueue;

await interaction.reply((player.loopCurrentQueue ? 'looped queue :)' : 'stopped looping queue :('));
}
}
import {ChatInputCommandInteraction} from 'discord.js';
import {TYPES} from '../types.js';
import {inject, injectable} from 'inversify';
import PlayerManager from '../managers/player.js';
import Command from '.';
import {SlashCommandBuilder} from '@discordjs/builders';
import {STATUS} from '../services/player.js';

@injectable()
export default class implements Command {
public readonly slashCommand = new SlashCommandBuilder()
.setName('loop-queue')
.setDescription('toggle looping the entire queue');

public requiresVC = true;

private readonly playerManager: PlayerManager;

constructor(@inject(TYPES.Managers.Player) playerManager: PlayerManager) {
this.playerManager = playerManager;
}

public async execute(interaction: ChatInputCommandInteraction): Promise<void> {
const player = this.playerManager.get(interaction.guild!.id);

if (player.status === STATUS.IDLE) {
throw new Error('no songs to loop!');
}

if (player.queueSize() < 2) {
throw new Error('not enough songs to loop a queue!');
}

if (player.loopCurrentSong) {
player.loopCurrentSong = false;
}

player.loopCurrentQueue = !player.loopCurrentQueue;

await interaction.reply((player.loopCurrentQueue ? 'looped queue :)' : 'stopped looping queue :('));
}
}

0 comments on commit 3f5ae21

Please sign in to comment.