-
-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
4.1.0 stable build | Merge pull request #23 from RainyXeon/dev
- Loading branch information
Showing
72 changed files
with
1,102 additions
and
657 deletions.
There are no files selected for viewing
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,20 @@ | ||
import { | ||
ButtonInteraction, | ||
CacheType, | ||
InteractionCollector, | ||
Message, | ||
} from "discord.js"; | ||
import { Manager } from "../manager.js"; | ||
import { KazagumoPlayer } from "kazagumo.mod"; | ||
|
||
export class PlayerButton { | ||
name: string = ""; | ||
async run( | ||
client: Manager, | ||
message: ButtonInteraction, | ||
language: string, | ||
player: KazagumoPlayer, | ||
nplaying: Message, | ||
collector: InteractionCollector<ButtonInteraction<"cached">> | ||
): Promise<any> {} | ||
} |
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
File renamed without changes.
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,35 @@ | ||
import { | ||
ButtonInteraction, | ||
CacheType, | ||
InteractionCollector, | ||
Message, | ||
} from "discord.js"; | ||
import { KazagumoPlayer } from "kazagumo.mod"; | ||
import { PlayerButton } from "../@types/Button.js"; | ||
import { Manager } from "../manager.js"; | ||
import { ReplyInteractionService } from "../utilities/ReplyInteractionService.js"; | ||
|
||
export default class implements PlayerButton { | ||
name = "clear"; | ||
async run( | ||
client: Manager, | ||
message: ButtonInteraction<CacheType>, | ||
language: string, | ||
player: KazagumoPlayer, | ||
nplaying: Message<boolean>, | ||
collector: InteractionCollector<ButtonInteraction<"cached">> | ||
): Promise<any> { | ||
if (!player) { | ||
collector.stop(); | ||
} | ||
player.queue.clear(); | ||
|
||
new ReplyInteractionService( | ||
client, | ||
message, | ||
`${client.i18n.get(language, "player", "clear_msg")}` | ||
); | ||
|
||
return; | ||
} | ||
} |
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,77 @@ | ||
import { | ||
ButtonInteraction, | ||
CacheType, | ||
InteractionCollector, | ||
Message, | ||
} from "discord.js"; | ||
import { KazagumoPlayer } from "kazagumo.mod"; | ||
import { PlayerButton } from "../@types/Button.js"; | ||
import { Manager } from "../manager.js"; | ||
import { KazagumoLoop } from "../@types/Lavalink.js"; | ||
import { ReplyInteractionService } from "../utilities/ReplyInteractionService.js"; | ||
|
||
export default class implements PlayerButton { | ||
name = "loop"; | ||
async run( | ||
client: Manager, | ||
message: ButtonInteraction<CacheType>, | ||
language: string, | ||
player: KazagumoPlayer, | ||
nplaying: Message<boolean>, | ||
collector: InteractionCollector<ButtonInteraction<"cached">> | ||
): Promise<any> { | ||
if (!player) { | ||
collector.stop(); | ||
} | ||
|
||
async function setLoop247(loop: string) { | ||
if (await client.db.autoreconnect.get(player.guildId)) { | ||
await client.db.autoreconnect.set( | ||
`${player.guildId}.config.loop`, | ||
loop | ||
); | ||
} | ||
} | ||
|
||
switch (player.loop) { | ||
case "none": | ||
await player.setLoop(KazagumoLoop.track); | ||
|
||
setLoop247(String(KazagumoLoop.none)); | ||
|
||
new ReplyInteractionService( | ||
client, | ||
message, | ||
`${client.i18n.get(language, "music", "loop_current")}` | ||
); | ||
|
||
break; | ||
|
||
case "track": | ||
await player.setLoop(KazagumoLoop.queue); | ||
|
||
setLoop247(String(KazagumoLoop.none)); | ||
|
||
new ReplyInteractionService( | ||
client, | ||
message, | ||
`${client.i18n.get(language, "music", "loop_all")}` | ||
); | ||
|
||
break; | ||
|
||
case "queue": | ||
await player.setLoop(KazagumoLoop.none); | ||
|
||
setLoop247(String(KazagumoLoop.none)); | ||
|
||
new ReplyInteractionService( | ||
client, | ||
message, | ||
`${client.i18n.get(language, "music", "unloopall")}` | ||
); | ||
|
||
break; | ||
} | ||
} | ||
} |
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,53 @@ | ||
import { | ||
ButtonInteraction, | ||
CacheType, | ||
InteractionCollector, | ||
Message, | ||
} from "discord.js"; | ||
import { KazagumoPlayer } from "kazagumo.mod"; | ||
import { PlayerButton } from "../@types/Button.js"; | ||
import { Manager } from "../manager.js"; | ||
import { | ||
playerRowOne, | ||
playerRowOneEdited, | ||
playerRowTwo, | ||
} from "../utilities/PlayerControlButton.js"; | ||
import { ReplyInteractionService } from "../utilities/ReplyInteractionService.js"; | ||
|
||
export default class implements PlayerButton { | ||
name = "pause"; | ||
async run( | ||
client: Manager, | ||
message: ButtonInteraction<CacheType>, | ||
language: string, | ||
player: KazagumoPlayer, | ||
nplaying: Message<boolean>, | ||
collector: InteractionCollector<ButtonInteraction<"cached">> | ||
): Promise<any> { | ||
if (!player) { | ||
collector.stop(); | ||
} | ||
await player.pause(!player.paused); | ||
const uni = player.paused | ||
? `${client.i18n.get(language, "player", "switch_pause")}` | ||
: `${client.i18n.get(language, "player", "switch_resume")}`; | ||
|
||
player.paused | ||
? nplaying.edit({ | ||
components: [playerRowOneEdited, playerRowTwo], | ||
}) | ||
: nplaying.edit({ | ||
components: [playerRowOne, playerRowTwo], | ||
}); | ||
|
||
await new ReplyInteractionService( | ||
client, | ||
message, | ||
`${client.i18n.get(language, "player", "pause_msg", { | ||
pause: uni, | ||
})}` | ||
); | ||
|
||
client.emit("playerPause", player); | ||
} | ||
} |
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,42 @@ | ||
import { | ||
ButtonInteraction, | ||
CacheType, | ||
InteractionCollector, | ||
Message, | ||
} from "discord.js"; | ||
import { KazagumoPlayer } from "kazagumo.mod"; | ||
import { PlayerButton } from "../@types/Button.js"; | ||
import { Manager } from "../manager.js"; | ||
import { ReplyInteractionService } from "../utilities/ReplyInteractionService.js"; | ||
|
||
export default class implements PlayerButton { | ||
name = "replay"; | ||
async run( | ||
client: Manager, | ||
message: ButtonInteraction<CacheType>, | ||
language: string, | ||
player: KazagumoPlayer, | ||
nplaying: Message<boolean>, | ||
collector: InteractionCollector<ButtonInteraction<"cached">> | ||
): Promise<any> { | ||
if (!player) { | ||
collector.stop(); | ||
} | ||
if (player.queue.previous.length == 0) | ||
return await new ReplyInteractionService( | ||
client, | ||
message, | ||
`${client.i18n.get(language, "music", "previous_notfound")}` | ||
); | ||
|
||
await player.queue.unshift(player.queue.previous[0]); | ||
await player.skip(); | ||
|
||
await new ReplyInteractionService( | ||
client, | ||
message, | ||
`${client.i18n.get(language, "music", "previous_msg")}` | ||
); | ||
return; | ||
} | ||
} |
Oops, something went wrong.