autoautospink
This commit is contained in:
parent
8e4d75f664
commit
e67dd8d856
@ -1,6 +1,6 @@
|
|||||||
// Modul dedikovaný funkci spinkáček
|
// Modul dedikovaný funkci spinkáček
|
||||||
|
|
||||||
import { Client, GuildMember, Message, Presence, Role, VoiceState } from "discord.js";
|
import { GuildMember, Message, Presence, Role, TextBasedChannel, VoiceState } from "discord.js";
|
||||||
import fetch from "node-fetch";
|
import fetch from "node-fetch";
|
||||||
import { emouty } from "../utils/emotes";
|
import { emouty } from "../utils/emotes";
|
||||||
import { Modul, Spinkackar, SRecord } from "../utils/types";
|
import { Modul, Spinkackar, SRecord } from "../utils/types";
|
||||||
@ -8,7 +8,7 @@ import { formatCas, formatter, oddiakritikovat, ping } from "../utils/utils";
|
|||||||
|
|
||||||
let spinkacky: SRecord<Spinkackar>;
|
let spinkacky: SRecord<Spinkackar>;
|
||||||
const budouciSpinky: SRecord<NodeJS.Timeout> = {};
|
const budouciSpinky: SRecord<NodeJS.Timeout> = {};
|
||||||
const autoSpinky: SRecord<string> = {};
|
const autoSpinky: SRecord<[boolean, TextBasedChannel]> = {};
|
||||||
|
|
||||||
const contactSpinkServer = async (akce: string, id: string, nick: string = "", avatar: string | null = "") => {
|
const contactSpinkServer = async (akce: string, id: string, nick: string = "", avatar: string | null = "") => {
|
||||||
const options = `heslo=${process.env.spinkPass}&akce=${akce}&id=${id}&nick=${encodeURIComponent(nick)}&avatar=${encodeURIComponent(avatar ?? "")}`;
|
const options = `heslo=${process.env.spinkPass}&akce=${akce}&id=${id}&nick=${encodeURIComponent(nick)}&avatar=${encodeURIComponent(avatar ?? "")}`;
|
||||||
@ -74,7 +74,7 @@ const exp: Modul = {
|
|||||||
|
|
||||||
spinkacek: {
|
spinkacek: {
|
||||||
als: ["spink", "spoink", "spinkake", "spoinkacek", "gn", emouty.spinkacek, emouty.gn],
|
als: ["spink", "spoink", "spinkake", "spoinkacek", "gn", emouty.spinkacek, emouty.gn],
|
||||||
run: async (mes) => {
|
run: async mes => {
|
||||||
if (mes.author.bot) return `až někdy${emouty.kapp}`;
|
if (mes.author.bot) return `až někdy${emouty.kapp}`;
|
||||||
if (await handleSpink("spinkacek", mes.member!)) {
|
if (await handleSpink("spinkacek", mes.member!)) {
|
||||||
mes.react(emouty.spinkacek);
|
mes.react(emouty.spinkacek);
|
||||||
@ -86,7 +86,7 @@ const exp: Modul = {
|
|||||||
|
|
||||||
vstavacek: {
|
vstavacek: {
|
||||||
als: ["vstavcacek", "gm", "unspinkacek"],
|
als: ["vstavcacek", "gm", "unspinkacek"],
|
||||||
run: async (mes) => {
|
run: async mes => {
|
||||||
if (mes.author.bot) return emouty.sjeta;
|
if (mes.author.bot) return emouty.sjeta;
|
||||||
|
|
||||||
return tovjemamvolepreceroliky(mes.member!);
|
return tovjemamvolepreceroliky(mes.member!);
|
||||||
@ -149,14 +149,20 @@ const exp: Modul = {
|
|||||||
|
|
||||||
zruspgn: {
|
zruspgn: {
|
||||||
als: ["zpgn", "cancelpgn", "cpgn", "unpgn", `unp${emouty.gn}`],
|
als: ["zpgn", "cancelpgn", "cpgn", "unpgn", `unp${emouty.gn}`],
|
||||||
run: (mes) => {
|
run: mes => {
|
||||||
if (!ifUzRemove(mes)) return `spinkacek ale nemas naplanovanej ty kkte ${mes.author}`;
|
if (!ifUzRemove(mes)) return `spinkacek ale nemas naplanovanej ty kkte ${mes.author}`;
|
||||||
return "to bylo teda trapny debile";
|
return "to bylo teda trapny debile";
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
autospink: (mes) =>
|
autospink: mes =>
|
||||||
`autospink je ${autoSpinky[mes.author.id] ? (delete autoSpinky[mes.author.id], "vypnut") : (autoSpinky[mes.author.id] = mes.channelId, "zapnut")}`
|
`autospink je ${autoSpinky[mes.author.id] ? (delete autoSpinky[mes.author.id], "vypnut") : (autoSpinky[mes.author.id] = [true, mes.channel], "zapnut")}`,
|
||||||
|
|
||||||
|
autoautospink: {
|
||||||
|
als: ["🚗🚗spink"],
|
||||||
|
run: mes =>
|
||||||
|
`autoautospink je ${autoSpinky[mes.author.id] ? (delete autoSpinky[mes.author.id], "vypnut") : (autoSpinky[mes.author.id] = [false, mes.channel], "zapnut")}`
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
on_voiceStateUpdate: (bef: VoiceState, aft: VoiceState) => {
|
on_voiceStateUpdate: (bef: VoiceState, aft: VoiceState) => {
|
||||||
@ -218,17 +224,15 @@ const exp: Modul = {
|
|||||||
if (!bef) return;
|
if (!bef) return;
|
||||||
const befoff = bef.status == "offline";
|
const befoff = bef.status == "offline";
|
||||||
const aftoff = aft.status == "offline";
|
const aftoff = aft.status == "offline";
|
||||||
const mamrdovinka = autoSpinky[aft.userId];
|
const prop = autoSpinky[aft.userId];
|
||||||
if (mamrdovinka) {
|
if (!prop) return;
|
||||||
if (!befoff && aftoff) {
|
if (!befoff && aftoff) {
|
||||||
handleSpink("spinkacek", aft.member!);
|
handleSpink("spinkacek", aft.member!);
|
||||||
}
|
}
|
||||||
if (befoff && !aftoff) {
|
if (befoff && !aftoff) {
|
||||||
const client: Client = module.exports.client;
|
if (prop[0]) delete autoSpinky[aft.userId];
|
||||||
const kanel = client.channels.cache.get(mamrdovinka);
|
const kanel = prop[1];
|
||||||
delete autoSpinky[aft.userId];
|
if (kanel?.isText()) kanel.send(await tovjemamvolepreceroliky(aft.member!));
|
||||||
if (kanel?.isText()) kanel.send(await tovjemamvolepreceroliky(aft.member!));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user