Added very fekal version of more zahraj
This commit is contained in:
parent
4a49094844
commit
96e083deac
4
package-lock.json
generated
4
package-lock.json
generated
@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "denim_3001",
|
||||
"version": "3001.24.0",
|
||||
"version": "3001.25.0",
|
||||
"lockfileVersion": 2,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "denim_3001",
|
||||
"version": "3001.24.0",
|
||||
"version": "3001.25.0",
|
||||
"license": "ISC",
|
||||
"dependencies": {
|
||||
"@discordjs/opus": "github:discordjs/opus",
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "denim_3001",
|
||||
"version": "3001.24.0",
|
||||
"version": "3001.25.0",
|
||||
"description": "Toto je velmi kvalitní bot.",
|
||||
"repository": {
|
||||
"url": "https://github.com/Histmy/Denim-Bot/"
|
||||
|
||||
17
src/modules/muzika.ts
Normal file
17
src/modules/muzika.ts
Normal file
@ -0,0 +1,17 @@
|
||||
// Tady bude muzika, vole
|
||||
|
||||
import { Message } from "discord.js";
|
||||
import * as ytdl from "ytdl-core";
|
||||
import { joinVoice, play } from "../utils/utils";
|
||||
|
||||
module.exports = {
|
||||
more_komandy: {
|
||||
zahraj: async (url: string, mes: Message) => {
|
||||
if (!ytdl.validateURL(url)) return "tuto neni validni youtube url a to je zatim jedini co hodlam hrat";
|
||||
const kanel = mes.member?.voice.channel;
|
||||
if (!kanel) return "nejsi ve vojsu ty kkt";
|
||||
const { conn } = await joinVoice(kanel, mes.guild!);
|
||||
play(conn, ytdl(url));
|
||||
}
|
||||
}
|
||||
};
|
||||
@ -3,6 +3,7 @@ import { Guild, StageChannel, VoiceChannel } from "discord.js";
|
||||
import { once } from "events";
|
||||
import { MuzikaFace } from "./types";
|
||||
import { existsSync } from "fs";
|
||||
import { Readable } from "node:stream";
|
||||
|
||||
const pripojeni: Record<string, PlayerSubscription> = {};
|
||||
|
||||
@ -97,14 +98,14 @@ export const joinVoice = async (channel: VoiceChannel | StageChannel | string, g
|
||||
return { conn, prev };
|
||||
};
|
||||
|
||||
const makeAudioPlayer = (co: string | MuzikaFace) => {
|
||||
if (typeof co === "string") return createAudioResource(co);
|
||||
const makeAudioPlayer = (co: string | MuzikaFace | Readable) => {
|
||||
if (typeof co == "string" || co instanceof Readable) return createAudioResource(co);
|
||||
const res = createAudioResource(co.name, { inlineVolume: true });
|
||||
res.volume?.setVolume(co.volume);
|
||||
return res;
|
||||
};
|
||||
|
||||
export const play = (conn: VoiceConnection, co: string | string[] | MuzikaFace | MuzikaFace[]) => new Promise<void>(async (res, rej) => {
|
||||
export const play = (conn: VoiceConnection, co: string | string[] | MuzikaFace | MuzikaFace[] | Readable) => new Promise<void>(async (res, rej) => {
|
||||
if (conn.state.status !== VoiceConnectionStatus.Ready) return rej("conn není ready");
|
||||
|
||||
const player = pripojeni[conn.joinConfig.guildId].player;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user