autoautospink
This commit is contained in:
parent
8e4d75f664
commit
e67dd8d856
@ -1,6 +1,6 @@
|
||||
// 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 { emouty } from "../utils/emotes";
|
||||
import { Modul, Spinkackar, SRecord } from "../utils/types";
|
||||
@ -8,7 +8,7 @@ import { formatCas, formatter, oddiakritikovat, ping } from "../utils/utils";
|
||||
|
||||
let spinkacky: SRecord<Spinkackar>;
|
||||
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 options = `heslo=${process.env.spinkPass}&akce=${akce}&id=${id}&nick=${encodeURIComponent(nick)}&avatar=${encodeURIComponent(avatar ?? "")}`;
|
||||
@ -74,7 +74,7 @@ const exp: Modul = {
|
||||
|
||||
spinkacek: {
|
||||
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 (await handleSpink("spinkacek", mes.member!)) {
|
||||
mes.react(emouty.spinkacek);
|
||||
@ -86,7 +86,7 @@ const exp: Modul = {
|
||||
|
||||
vstavacek: {
|
||||
als: ["vstavcacek", "gm", "unspinkacek"],
|
||||
run: async (mes) => {
|
||||
run: async mes => {
|
||||
if (mes.author.bot) return emouty.sjeta;
|
||||
|
||||
return tovjemamvolepreceroliky(mes.member!);
|
||||
@ -149,14 +149,20 @@ const exp: Modul = {
|
||||
|
||||
zruspgn: {
|
||||
als: ["zpgn", "cancelpgn", "cpgn", "unpgn", `unp${emouty.gn}`],
|
||||
run: (mes) => {
|
||||
run: mes => {
|
||||
if (!ifUzRemove(mes)) return `spinkacek ale nemas naplanovanej ty kkte ${mes.author}`;
|
||||
return "to bylo teda trapny debile";
|
||||
}
|
||||
},
|
||||
|
||||
autospink: (mes) =>
|
||||
`autospink je ${autoSpinky[mes.author.id] ? (delete autoSpinky[mes.author.id], "vypnut") : (autoSpinky[mes.author.id] = mes.channelId, "zapnut")}`
|
||||
autospink: mes =>
|
||||
`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) => {
|
||||
@ -218,19 +224,17 @@ const exp: Modul = {
|
||||
if (!bef) return;
|
||||
const befoff = bef.status == "offline";
|
||||
const aftoff = aft.status == "offline";
|
||||
const mamrdovinka = autoSpinky[aft.userId];
|
||||
if (mamrdovinka) {
|
||||
const prop = autoSpinky[aft.userId];
|
||||
if (!prop) return;
|
||||
if (!befoff && aftoff) {
|
||||
handleSpink("spinkacek", aft.member!);
|
||||
}
|
||||
if (befoff && !aftoff) {
|
||||
const client: Client = module.exports.client;
|
||||
const kanel = client.channels.cache.get(mamrdovinka);
|
||||
delete autoSpinky[aft.userId];
|
||||
if (prop[0]) delete autoSpinky[aft.userId];
|
||||
const kanel = prop[1];
|
||||
if (kanel?.isText()) kanel.send(await tovjemamvolepreceroliky(aft.member!));
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
module.exports = exp;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user