NEODPOSLOUCHAVEJ!!-§§-§§!
This commit is contained in:
parent
a677eb16e9
commit
7ca353fc7f
4
package-lock.json
generated
4
package-lock.json
generated
@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "denim_3001",
|
||||
"version": "3001.42.4",
|
||||
"version": "3001.43.0",
|
||||
"lockfileVersion": 2,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "denim_3001",
|
||||
"version": "3001.42.4",
|
||||
"version": "3001.43.0",
|
||||
"license": "ISC",
|
||||
"dependencies": {
|
||||
"@discordjs/voice": "^0.11.0",
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "denim_3001",
|
||||
"version": "3001.42.4",
|
||||
"version": "3001.43.0",
|
||||
"description": "Toto je velmi kvalitní bot.",
|
||||
"repository": {
|
||||
"url": "https://github.com/Histmy/Denim-Bot/"
|
||||
|
||||
@ -1,12 +1,13 @@
|
||||
// Cokoliv co má něco společnýho s vojsem
|
||||
|
||||
import { getVoiceConnection, VoiceConnection, VoiceConnectionStatus } from "@discordjs/voice";
|
||||
import { ChannelType, GuildMember, VoiceChannel } from "discord.js";
|
||||
import { ChannelType, GuildMember, 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";
|
||||
|
||||
const timeouty: SRecord<NodeJS.Timeout> = {};
|
||||
const muty: string[] = [];
|
||||
|
||||
const vypocitatCas = (guild: string, conn: VoiceConnection) => {
|
||||
const c = new Date();
|
||||
@ -179,6 +180,27 @@ const exp: Modul = {
|
||||
handlePrevVoice(mes.guild!, prev);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
// Neodposlouchávej
|
||||
on_voiceStateUpdate: (bef: VoiceState, aft: VoiceState) => {
|
||||
const conn = getVoiceConnection(aft.guild.id);
|
||||
if (!aft.channel || !conn || aft.member?.user.id == aft.client.user?.id) return;
|
||||
|
||||
if (aft.selfMute && !aft.deaf) {
|
||||
play(conn, { name: "./zvuky/neodposlouchavej.ogg", volume: 0.38 })
|
||||
.then(() => {
|
||||
if (!aft.selfMute) return;
|
||||
aft.setDeaf(true, "otposlouchávala ta gadza");
|
||||
if (!muty.includes(aft.member!.id)) muty.push(aft.member!.id);
|
||||
});
|
||||
}
|
||||
|
||||
if (!bef.channel) return;
|
||||
if (bef.mute && bef.deaf && !aft.mute && aft.serverDeaf && muty.includes(aft.member!.id)) {
|
||||
aft.setDeaf(false, "us muze poslouchat gadza");
|
||||
muty.splice(muty.indexOf(aft.member!.id), 1);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@ -125,11 +125,7 @@ export const play = (conn: VoiceConnection, co: string | string[] | MuzikaFace |
|
||||
if (!Array.isArray(co)) {
|
||||
const aud = makeAudioPlayer(co);
|
||||
player.play(aud);
|
||||
const funkce = () => {
|
||||
res();
|
||||
player.removeListener(AudioPlayerStatus.Idle, funkce);
|
||||
};
|
||||
player.on(AudioPlayerStatus.Idle, funkce);
|
||||
player.once(AudioPlayerStatus.Idle, () => res());
|
||||
return;
|
||||
}
|
||||
|
||||
@ -241,3 +237,5 @@ export const statusOnFoun = (bef: FakePresence | null, aft: FakePresence) => {
|
||||
|
||||
return predAPo;
|
||||
};
|
||||
|
||||
export const getGuildConnection = (guildId: string) => pripojeni[guildId]?.connection;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user