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
|
||||
|
||||
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 { Modul, MuzikaFace, SRecord } from "../utils/types";
|
||||
import { canAnounceTime, handlePrevVoice, joinVoice, log, play } from "../utils/utils";
|
||||
@ -60,6 +60,20 @@ const vytahnout = (member: GuildMember, patro: number) => {
|
||||
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 = {
|
||||
more_komandy: {
|
||||
|
||||
@ -117,14 +131,9 @@ const exp: Modul = {
|
||||
|
||||
krkacek: {
|
||||
als: ["krk", "grg", "grgnisi", "krknisi", "grgacek"],
|
||||
run: async mes => {
|
||||
const channel = mes.member?.voice.channel;
|
||||
if (!channel) return "***grrrrrrrrg***";
|
||||
run: async mes =>
|
||||
playAndFukOff(mes, "***grrrrrrrrg***", "zvuky/grg.mp3")
|
||||
|
||||
const { conn, prev } = await joinVoice(channel);
|
||||
await play(conn, "zvuky/grg.mp3");
|
||||
handlePrevVoice(mes.guild!, prev);
|
||||
}
|
||||
},
|
||||
|
||||
cas: {
|
||||
@ -164,33 +173,27 @@ const exp: Modul = {
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
},
|
||||
|
||||
outro: {
|
||||
hidden: true,
|
||||
run: async mes => {
|
||||
const channel = mes.member?.voice.channel;
|
||||
if (!channel) return "co to znamena ti gadzovko";
|
||||
run: async mes =>
|
||||
playAndFukOff(mes, "co to znamena ti gadzovko", "zvuky/pocasi/outro.mp3")
|
||||
|
||||
const { conn, prev } = await joinVoice(channel);
|
||||
await play(conn, { name: "zvuky/pocasi/outro.mp3", volume: 30 });
|
||||
handlePrevVoice(mes.guild!, prev);
|
||||
}
|
||||
},
|
||||
|
||||
auto: {
|
||||
run: async mes => {
|
||||
const channel = mes.member?.voice.channel;
|
||||
if (!channel) return "vžum";
|
||||
run: async mes =>
|
||||
playAndFukOff(mes, "vžum", "zvuky/auto.ogg")
|
||||
|
||||
const { conn, prev } = await joinVoice(channel);
|
||||
await play(conn, "zvuky/auto.ogg");
|
||||
handlePrevVoice(mes.guild!, prev);
|
||||
}
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
// Neodposlouchávej
|
||||
@ -204,6 +207,9 @@ const exp: Modul = {
|
||||
if (!aft.selfMute) return;
|
||||
aft.setDeaf(true, "otposlouchávala ta gadza");
|
||||
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