All New

user:thomas gists created by user

title:mygist gists with given title

description:sync gists with given description

filename:myfile.txt gists having files with given name

extension:yml gists having files with given extension

language:go gists having files with given language

topic:homelab gists with given topic

all:systemctl search all fields

Register

Login

All New Register Login

nuno

Joined 2 months ago

Recently created
Least recently created
Recently updated
Least recently updated
All gists 570

nuno / gistfile1.txt

0 likes
0 forks
1 files
Last active 3 weeks ago
1 import fs from "fs";
2 import path from "path";
3 import { CharacterMap, Character, ClassKey, Nation, AccountMap, AccountData } from "../types";
4
5 const CHARS_PATH = path.join(__dirname, "../../data/characters.json");
6 const ACCOUNTS_PATH = path.join(__dirname, "../../data/accounts.json");
7
8 let _chars: CharacterMap = {};
9 let _accounts: AccountMap = {};

nuno / gistfile1.txt

0 likes
0 forks
1 files
Last active 3 weeks ago
1 import fs from "fs";
2 import path from "path";
3
4 const IMPERSONATE_RESET_ON_POLL = process.env.IMPERSONATE_RESET_ON_POLL !== "false";
5 const IMPERSONATE_INDICATOR = process.env.IMPERSONATE_INDICATOR !== "false";
6
7 // realDiscordId → userKey being impersonated
8 const impersonations = new Map<string, string>();
9
10 export function setImpersonation(realDiscordId: string, userKey: string): void {

nuno / gistfile1.txt

0 likes
0 forks
1 files
Last active 3 weeks ago
1 import {
2 ChatInputCommandInteraction,
3 ButtonInteraction,
4 ButtonBuilder,
5 ButtonStyle,
6 ActionRowBuilder,
7 EmbedBuilder,
8 } from "discord.js";
9 import { cfg } from "@systems/config";
10 import { hasOfficerRole } from "@systems/users";

nuno / interactions.ts

0 likes
0 forks
1 files
Last active 3 weeks ago
1 import { Interaction, ChatInputCommandInteraction, ButtonInteraction, TextChannel, StringSelectMenuInteraction } from "discord.js";
2 import { handleButton, handleScoreSubmitButton } from "@handlers/buttons";
3 import { handleTgCommand } from "@commands/tg";
4 import { handleTgConfigCommand } from "@commands/tgConfig";
5 import { handleBorrowAcceptButton } from "@subcommands/char/accept";
6 import { handleBorrowDeclineButton } from "@subcommands/char/decline";
7 import { handleConflictButton } from "@systems/conflict";
8 import { handleImpersonateButton } from "@subcommands/impersonate";
9 import { handleAutocomplete } from "@handlers/autocomplete";
10 import { setActiveCharacter, getCharacterByName, getCharacters } from "@systems/characters";

nuno / gistfile1.txt

0 likes
0 forks
1 files
Last active 3 weeks ago
1 import fs from "fs";
2 import path from "path";
3
4 const IMPERSONATE_RESET_ON_POLL = process.env.IMPERSONATE_RESET_ON_POLL !== "false";
5 const IMPERSONATE_INDICATOR = process.env.IMPERSONATE_INDICATOR !== "false";
6
7 // realDiscordId → userKey being impersonated
8 const impersonations = new Map<string, string>();
9
10 export function setImpersonation(realDiscordId: string, userKey: string): void {

nuno / gistfile1.txt

0 likes
0 forks
1 files
Last active 3 weeks ago
1 import {
2 ChatInputCommandInteraction,
3 ButtonInteraction,
4 ButtonBuilder,
5 ButtonStyle,
6 ActionRowBuilder,
7 EmbedBuilder,
8 } from "discord.js";
9 import { cfg } from "@systems/config";
10 import { hasOfficerRole } from "@systems/users";

nuno / scheduler.ts

0 likes
0 forks
1 files
Last active 3 weeks ago
1 import cron from "node-cron";
2 import { TextChannel } from "discord.js";
3
4 // Lock poll at TG start (20:00), reveal Submit Score button at TG end (20:35)
5 // Runs daily — no-ops silently if no poll is active for that slot.
6
7 cron.schedule("0 20 * * *", async () => {
8 const slot = 20;
9 const state = polls.get(slot);
10 if (!state || state.locked) return;

nuno / slots.ts

0 likes
0 forks
1 files
Last active 3 weeks ago
1 import cron from "node-cron";
2 import { Client, TextChannel } from "discord.js";
3 import { cfg } from "./config";
4 import { TGSlot } from "../types";
5 import { polls, updatePollMessage } from "@systems/poll";
6
7 type PollCallback = (slot: TGSlot) => Promise<void>;
8 type CloseCallback = (slot: TGSlot) => Promise<void>;
9 type LockCallback = (slot: TGSlot) => Promise<void>;

nuno / autocomplete.ts

0 likes
0 forks
1 files
Last active 3 weeks ago
1 import { AutocompleteInteraction } from "discord.js";
2 import { resolveUser } from "@systems/users";
3 import { getCharacters } from "@systems/characters";
4 import { cfg } from "@systems/config";
5 import { getNationEmoji } from "@systems/emojis";
6 import fs from "fs";
7 import path from "path";
8 import { Nation } from "@types";
9 import { Paths } from "@helpers/paths";

nuno / wrank.ts

0 likes
0 forks
1 files
Last active 3 weeks ago
1 import fs from "fs";
2 import path from "path";
3 import { WRankData, WRankWeek, WRankEntry, Nation, ClassKey } from "../types";
4 import { cfg } from "./config";
5
6 const WRANK_PATH = path.join(__dirname, "../../data/wrank.json");
7 let _data: WRankData = {};
8
9 export function loadWRank(): void {
10 try { _data = JSON.parse(fs.readFileSync(WRANK_PATH, "utf8")); }
Newer Older

Powered by Opengist ⋅ Load: 150ms⋅

English
Čeština Deutsch English Español Français Magyar Italiano 日本語 Polski Português Русский Türkçe Українська 中文 繁體中文
⋅ KrilHub