if you spink you get role spink
This commit is contained in:
parent
44329ce277
commit
7141da4c58
4
package-lock.json
generated
4
package-lock.json
generated
@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "denim_3001",
|
||||
"version": "3001.28.0",
|
||||
"version": "3001.29.0",
|
||||
"lockfileVersion": 2,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "denim_3001",
|
||||
"version": "3001.28.0",
|
||||
"version": "3001.29.0",
|
||||
"license": "ISC",
|
||||
"dependencies": {
|
||||
"@discordjs/opus": "github:discordjs/opus",
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "denim_3001",
|
||||
"version": "3001.28.0",
|
||||
"version": "3001.29.0",
|
||||
"description": "Toto je velmi kvalitní bot.",
|
||||
"repository": {
|
||||
"url": "https://github.com/Histmy/Denim-Bot/"
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
// Modul dedikovaný funkci spinkáček
|
||||
|
||||
import { Message, VoiceState } from "discord.js";
|
||||
import { Guild, GuildMember, Message, VoiceState } from "discord.js";
|
||||
import fetch from "node-fetch";
|
||||
import { emouty } from "../utils/emotes";
|
||||
import { Spinkackar } from "../utils/types";
|
||||
@ -33,6 +33,28 @@ const syncSpink = () => {
|
||||
|
||||
syncSpink();
|
||||
|
||||
const handleSpink = async (act: "spinkacek" | "vstavacek", member: GuildMember, guild: Guild) => {
|
||||
const spink = act == "spinkacek";
|
||||
const ok = spink
|
||||
? await contactSpinkServer(act, member.id, member.user.username, member.user.avatarURL())
|
||||
: await contactSpinkServer(act, member.id);
|
||||
if (!ok.startsWith("OK")) return false;
|
||||
|
||||
const c = guild.roles.cache;
|
||||
const spinkRole = c.find(r => r.name == "spink");
|
||||
const adminRole = c.find(r => r.name == "admin");
|
||||
|
||||
if (spink) {
|
||||
if (spinkRole) member.roles.add(spinkRole);
|
||||
if (adminRole) member.roles.remove(adminRole);
|
||||
} else {
|
||||
if (spinkRole) member.roles.remove(spinkRole);
|
||||
if (adminRole) member.roles.add(adminRole);
|
||||
}
|
||||
|
||||
return ok;
|
||||
};
|
||||
|
||||
module.exports = {
|
||||
more_komandy: {
|
||||
|
||||
@ -40,7 +62,7 @@ module.exports = {
|
||||
als: ["spink", "spoink", "spinkake", "spoinkacek", "gn", "<:spinkacek:761652251966046208>", "<:gn:887124590583746590>"],
|
||||
run: async (_: any, mes: Message) => {
|
||||
if (mes.author.bot) return `až někdy${emouty.kapp}`;
|
||||
if (await contactSpinkServer('spinkacek', mes.author.id, mes.author.username, mes.author.avatarURL()) === "OK") {
|
||||
if (await handleSpink("spinkacek", mes.member!, mes.guild!)) {
|
||||
mes.react(emouty.spinkacek);
|
||||
const uz = budouciSpinky[mes.author.id];
|
||||
if (uz) {
|
||||
@ -57,10 +79,9 @@ module.exports = {
|
||||
run: async (_: any, mes: Message) => {
|
||||
if (mes.author.bot) return emouty.sjeta;
|
||||
|
||||
const odpoved = await contactSpinkServer('vstavacek', mes.author.id);
|
||||
const [ok, casTxt] = odpoved.split(" ");
|
||||
const cas = Number(casTxt);
|
||||
if (ok !== "OK") return "uz jsi vzhuru ty hajzle";
|
||||
const odpoved = await handleSpink("vstavacek", mes.member!, mes.guild!);
|
||||
if (!odpoved) return "uz jsi vzhuru ty hajzle";
|
||||
const cas = Number(odpoved.slice(3));
|
||||
const formatedCas = formatCas(cas);
|
||||
let zpr = "";
|
||||
if (cas >= 57600) zpr = "mas dat more vstavacek uz kdyz vstanes retarde";
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user