better voice pt1
This commit is contained in:
parent
390ca1c00b
commit
e506567064
@ -1,7 +1,7 @@
|
|||||||
// Cokoliv co má něco společnýho s vojsem
|
// Cokoliv co má něco společnýho s vojsem
|
||||||
|
|
||||||
import { getVoiceConnection, VoiceConnection, VoiceConnectionStatus } from "@discordjs/voice";
|
import { getVoiceConnection, VoiceConnection, VoiceConnectionStatus } from "@discordjs/voice";
|
||||||
import { ChannelType, GuildMember, VoiceChannel, VoiceState } from "discord.js";
|
import { ChannelType, GuildMember, Message, VoiceChannel, VoiceState } from "discord.js";
|
||||||
import { emouty } from "../utils/emotes";
|
import { emouty } from "../utils/emotes";
|
||||||
import { Modul, MuzikaFace, SRecord } from "../utils/types";
|
import { Modul, MuzikaFace, SRecord } from "../utils/types";
|
||||||
import { canAnounceTime, handlePrevVoice, joinVoice, log, play } from "../utils/utils";
|
import { canAnounceTime, handlePrevVoice, joinVoice, log, play } from "../utils/utils";
|
||||||
@ -60,6 +60,20 @@ const vytahnout = (member: GuildMember, patro: number) => {
|
|||||||
setTimeout(() => vytahnout(member, patro), 1e3);
|
setTimeout(() => vytahnout(member, patro), 1e3);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
async function playAndFukOff(mes: Message, jinak: string, zvuk: string) {
|
||||||
|
const channel = mes.member?.voice.channel;
|
||||||
|
if (!channel) return jinak;
|
||||||
|
|
||||||
|
const { conn, prev } = await joinVoice(channel);
|
||||||
|
|
||||||
|
await play(conn, zvuk)
|
||||||
|
.catch(e => {
|
||||||
|
log("Pičo chyba při fukofování", e);
|
||||||
|
});
|
||||||
|
|
||||||
|
handlePrevVoice(channel.guild, prev);
|
||||||
|
}
|
||||||
|
|
||||||
const exp: Modul = {
|
const exp: Modul = {
|
||||||
more_komandy: {
|
more_komandy: {
|
||||||
|
|
||||||
@ -117,14 +131,9 @@ const exp: Modul = {
|
|||||||
|
|
||||||
krkacek: {
|
krkacek: {
|
||||||
als: ["krk", "grg", "grgnisi", "krknisi", "grgacek"],
|
als: ["krk", "grg", "grgnisi", "krknisi", "grgacek"],
|
||||||
run: async mes => {
|
run: async mes =>
|
||||||
const channel = mes.member?.voice.channel;
|
playAndFukOff(mes, "***grrrrrrrrg***", "zvuky/grg.mp3")
|
||||||
if (!channel) return "***grrrrrrrrg***";
|
|
||||||
|
|
||||||
const { conn, prev } = await joinVoice(channel);
|
|
||||||
await play(conn, "zvuky/grg.mp3");
|
|
||||||
handlePrevVoice(mes.guild!, prev);
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
|
|
||||||
cas: {
|
cas: {
|
||||||
@ -164,33 +173,27 @@ const exp: Modul = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const { conn, prev } = await joinVoice(channel);
|
const { conn, prev } = await joinVoice(channel);
|
||||||
await play(conn, zvuky);
|
await play(conn, zvuky)
|
||||||
|
.catch(e => {
|
||||||
|
log("chyba tady, si to najdi", e);
|
||||||
|
});
|
||||||
handlePrevVoice(mes.guild!, prev);
|
handlePrevVoice(mes.guild!, prev);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
outro: {
|
outro: {
|
||||||
hidden: true,
|
hidden: true,
|
||||||
run: async mes => {
|
run: async mes =>
|
||||||
const channel = mes.member?.voice.channel;
|
playAndFukOff(mes, "co to znamena ti gadzovko", "zvuky/pocasi/outro.mp3")
|
||||||
if (!channel) return "co to znamena ti gadzovko";
|
|
||||||
|
|
||||||
const { conn, prev } = await joinVoice(channel);
|
|
||||||
await play(conn, { name: "zvuky/pocasi/outro.mp3", volume: 30 });
|
|
||||||
handlePrevVoice(mes.guild!, prev);
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
|
|
||||||
auto: {
|
auto: {
|
||||||
run: async mes => {
|
run: async mes =>
|
||||||
const channel = mes.member?.voice.channel;
|
playAndFukOff(mes, "vžum", "zvuky/auto.ogg")
|
||||||
if (!channel) return "vžum";
|
|
||||||
|
|
||||||
const { conn, prev } = await joinVoice(channel);
|
|
||||||
await play(conn, "zvuky/auto.ogg");
|
|
||||||
handlePrevVoice(mes.guild!, prev);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
// Neodposlouchávej
|
// Neodposlouchávej
|
||||||
@ -204,6 +207,9 @@ const exp: Modul = {
|
|||||||
if (!aft.selfMute) return;
|
if (!aft.selfMute) return;
|
||||||
aft.setDeaf(true, "otposlouchávala ta gadza");
|
aft.setDeaf(true, "otposlouchávala ta gadza");
|
||||||
if (!muty.includes(aft.member!.id)) muty.push(aft.member!.id);
|
if (!muty.includes(aft.member!.id)) muty.push(aft.member!.id);
|
||||||
|
})
|
||||||
|
.catch(e => {
|
||||||
|
log("chyb při neodposlouchavej", e);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user