From 7293076ce9e003da5dd7a1f7d112d71a8ea08dba Mon Sep 17 00:00:00 2001 From: RoseFix7 Date: Wed, 20 Sep 2023 17:24:51 -0400 Subject: [PATCH] Stuff --- .vs/VSWorkspaceState.json | 10 - .vs/poixpixel-discord-bot-akhan/v16/.suo | Bin 73728 -> 0 bytes .vs/slnx.sqlite | Bin 90112 -> 0 bytes source/discord-bot.ts | 61 +++++- source/discord-bot/ping.ts | 7 + source/discord.ts | 268 ++++++++++++++++++++++- 6 files changed, 321 insertions(+), 25 deletions(-) delete mode 100644 .vs/VSWorkspaceState.json delete mode 100644 .vs/poixpixel-discord-bot-akhan/v16/.suo delete mode 100644 .vs/slnx.sqlite create mode 100644 source/discord-bot/ping.ts diff --git a/.vs/VSWorkspaceState.json b/.vs/VSWorkspaceState.json deleted file mode 100644 index 386b3fa..0000000 --- a/.vs/VSWorkspaceState.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "ExpandedNodes": [ - "", - "\\config", - "\\source", - "\\source\\discord-bot" - ], - "SelectedNode": "\\.gitignore", - "PreviewInSolutionExplorer": false -} \ No newline at end of file diff --git a/.vs/poixpixel-discord-bot-akhan/v16/.suo b/.vs/poixpixel-discord-bot-akhan/v16/.suo deleted file mode 100644 index 864fc8903878521be174d70c096cfe7cbcc96d26..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 73728 zcmeHQ378wjm2Tk++Zf{m1F-?y*kHgt=$aV`6XTiD3>bT`@z@RqacHETv6w@HG-HqP z3=j_E*u*#-YY2pOh#`a{OGpBQBLoA%?6N>MB!Mg;PRK!a1Dh|9gztmE{;v;px75;9 zw^}U;tMonfRbBP!y*l1|RsHJKSElU$`gcC}8!jU(=08GF4y-|P}09;l>g-~D>m%y)|o6R+Iy*MVhO~gv(FoPSD=J)6k-g-5$@Xycw z=?&L>#9MN_6nQ0bOmLTQOObmA&YHQw5mM1Vo`D*uCAI#k@zt%kjp{1~C4b7dkLv~o zNlpN?fff;fAjivfm}epXgOON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<8;*befn7=j++OZoao>5wN1-gBT5|(tent} zSUIc3F%0QO*)N7X@4Q)Jjl-xTOSz@9QsF~avR2{LRSz-(yVqr zAllo@3H?#uI9<;JRz&=|8&^A^=8cpDw^okzH zrlf|Kl{yVc_kjQyD-uvVHdwmItSp)~q*V5}K{Jxkrwa3MHbwY%k7301Ybsg`X?$0bW@ zz8yogn$u_9?pD4QE+;f*)%M0}5iB>m+Yd+RxAm3@YnJ=M`)z5Kf@U$O_l`nmP-Kb| z(RY`hC9d+UnU!XvD_2`*rC7wA=pFU#UOOskZFP#Bj_ir$XnC#L4(%8N$gW8}cNhN2 z;;voGK(<3C`X7CL)R&4ye^ADp1;Dp-wod2Q2WsaP^M4z}aVLW|RcowSjUjj2s9IxD Ip(;H5KT!NlL;wH) diff --git a/.vs/slnx.sqlite b/.vs/slnx.sqlite deleted file mode 100644 index ab5fa811229b00e9d34600e555d86d1fabdf2a51..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 90112 zcmeI54{RIPdBE>PniMJWo@803WZBl)t|M{w=?^KAQi80dDavLnQ?f|e@l-}Ql1G^_ zMJgoaSc%(Cc9Lz$;2|qEbOqKRE6@fTuw=lBde{&QXqN(8v2@GO1WWzBgG?vGvdpJ= zo?)1q@P9A-*IwQ5#jYK|U)Jz_v#&Rq;c<8p#-gdX|H=D3PM;vKPYZQ1Tav6*w;p>{Wzx|T zGw~KR_qvA^E=>><`3&$)$4|!R`MLSTndtll{&f5TA6-b#CX$ftnRqe{TEYK?nVI8i zE_2n&+6}JMgU~t*ONfIEzC_(5P%^T zor;^Hrs6YkJxWtX0hl}&osXT0&JP7bA%8<*3s)`4^jfL3es)bP6$?cv-zo!hduZuS zgO%vKv>I!%(Ogcd)r#3-iB_?J)hcGO!6rGq%0__HQBv!*y0p?jXbqw$c|G;*u$-yn zMCzaOl}9(PfF=~Hl-5?t&2nD1e`BP>>01K7T9W-r)-)%U%ThHa<}ON0&8jP2W)<|9 zz04ZDX+8#@v!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ord-bot.ts +++ b/source/discord-bot.ts @@ -7,24 +7,71 @@ import * as c_discord_bot from "../config/discord-bot"; export class DiscordBot extends l_discord.Bot { public static config: l_config.Config; public static discord_bot: l_discord.Bot; + public static polling_interval: 50; // ms + public static guild: l_discord.Guild; static main( p_config: config.Config_Interface ) { + console.log("Running bot tasks") + + console.log("-- Loading configuration"); this.config = new l_config.Config( config.defaulted, p_config ); this.discord_bot = new l_discord.Bot(this.config.real.discord); - console.log("Starting"); - this.discord_bot.running = true; - console.log("READY") - setTimeout(() => { - this.discord_bot.running = false; - console.log("offline"); - }, 2000); + try { + console.log("-- Logging into bot API"); + this.discord_bot.running = true; + } catch (error: any) { + DiscordBot.error_stop(error); + } + + try { + console.log("-- Fetching guild"); + this.guild = this.discord_bot.get_guild({ + id: this.config.real.discord.guild_id + })[0]; + } catch (error: any) { + DiscordBot.error_stop(error); + } + + try { + const channel_id = "1043280866744488067"; + console.log("-- Fetching test channel"); + + const channel = this.guild.get_channel({ + id: channel_id + })[0]; + + console.log(channel, this.guild); + const msg = new l_discord.Message(); + msg.text = "HELLO TEXT"; + + const message_stream = channel.messages; + + const embed = new l_discord.Embed(); + embed.title = "Hello"; + embed.description = "IDK"; + msg.embeds = [ embed ]; + + message_stream.push(msg); + } catch (error: any) { + DiscordBot.error_stop(error); + } + + + console.log("All tasks completed"); + } + + static error_stop(error: Error) { + console.error("Fatal Error: Failed to execute bot tasks"); + console.error(error); + + process.exit(1); } } diff --git a/source/discord-bot/ping.ts b/source/discord-bot/ping.ts new file mode 100644 index 0000000..9849fe3 --- /dev/null +++ b/source/discord-bot/ping.ts @@ -0,0 +1,7 @@ +import * as l_discord from "../discord"; + +export class Ping extends l_discord.Command { + constructor() { + super("ping"); + } +} \ No newline at end of file diff --git a/source/discord.ts b/source/discord.ts index 0d0e4d0..9bb0e22 100644 --- a/source/discord.ts +++ b/source/discord.ts @@ -2,6 +2,7 @@ import * as discord from "discord.js"; import * as l_config from "./config"; import * as l_util from "./util"; import * as deasync from "deasync"; +import * as discord_bot from "./discord-bot"; export interface Config_Interface { api_key?: string; @@ -9,15 +10,43 @@ export interface Config_Interface { guild_id?: string; } -const defaulted_config: Config_Interface = { +export interface RecordFilter { + id?: string; // First ->-v + name?: string; // Second <-v + filter?: (element: Guild | Channel) => boolean; // Third <- +} + +export const defaulted_config: Config_Interface = { api_key: "", application_client_id: "", guild_id: "" } +export class InvalidToken_Error extends Error { + constructor() { + super("The token provided is invalid"); + this.name = "InvalidToken_Error" + } +} + +export class BotNotReady_Error extends Error { + constructor() { + super("The bot is not ready for API actions"); + this.name = "BotNotReady_Error" + } +} + +export class InvalidNetwork_Error extends Error { + constructor() { + super("The bot failed to perform any actions that relied on the network. Possible reasons are no network is connected, the API URL has changed, or the OS firewall is blocking the connection"); + this.name = "InvalidNetwork_Error" + } +} + export class Bot extends l_util.Runable { public readonly config: l_config.Config; public readonly client: discord.Client; + #ready = false; constructor( config: Config_Interface @@ -39,21 +68,31 @@ export class Bot extends l_util.Runable { on_run(): void { let done = false; - let error = false; + let error = null as any; this.client.once(discord.Events.ClientReady, () => { done = true; }); - this.client.login(this.config.real.api_key); + this.client.login(this.config.real.api_key) + .catch((sub_error) => { + error = sub_error; + done = true; + }); - while (!done) { deasync.sleep(100); } + while (!done) { deasync.sleep(discord_bot.DiscordBot.polling_interval); } if (error) { - console.error("FAILED TO LOGIN"); - } else { - console.log("ONLINE"); + if (error.name == "Error [TokenInvalid]") { + throw new InvalidToken_Error(); + } else if (error.message.includes("getaddrinfo")) { + throw new InvalidNetwork_Error(); + } else { + throw error; + } } + + this.#ready = true; } on_terminate(): void { @@ -65,9 +104,222 @@ export class Bot extends l_util.Runable { }); while (!done) { deasync.sleep(100); } + this.#ready = false; + } + + public get ready() { + return this.#ready; + } + + public get_guild(filter: RecordFilter) { + if (!this.#ready) { + throw new BotNotReady_Error(); + } + + if ( + filter.id + && !filter.filter + && !filter.name + ) { + let guild = null as any; + let done = false; + let error = null as any; + + this.client.guilds.fetch(filter.id) + .then((api_build) => { + done = true; + guild = api_build; + }) + .catch((api_error) => { + done = true; + error = api_error; + }); + + while (!done) { deasync.sleep(discord_bot.DiscordBot.polling_interval); } + + if (guild) { + return [ new Guild(this, guild) ]; + } + + if (error) { + throw error; + } + } + + const api_guilds = this.client.guilds.cache; + + // Filter by name + let layer_1_filtered: discord.Guild[] = []; + + api_guilds.forEach((guild) => { + if (guild.name == filter.name) { + layer_1_filtered.push(guild); + } else if (!filter.name) { + layer_1_filtered.push(guild); + } + }); + + // Filter with function + let layer_2_filtered: Guild[] = []; + + layer_1_filtered.forEach((guild) => { + const custom_guild = new Guild(this, guild); + if (filter.filter && filter.filter(custom_guild)) { + layer_2_filtered.push(custom_guild) + } else if (!filter.filter) { + layer_2_filtered.push(custom_guild); + } + }); + + return layer_2_filtered; } } -export class Command { +export class Guild { + public readonly inner_guild: discord.Guild; + public readonly bot: Bot; + + constructor(bot: Bot, guild: discord.Guild) { + this.bot = bot; + this.inner_guild = guild; + } + + public get name() { + return this.inner_guild.name; + } + + public get_channel(filter: RecordFilter) { + if (!this.bot.ready) { + throw new BotNotReady_Error(); + } + + if ( + filter.id + && !filter.filter + && !filter.name + ) { + let channel = null as any; + let done = false; + let error = null as any; + + this.bot.client.channels.fetch(filter.id) + .then((api_build) => { + done = true; + channel = api_build; + }) + .catch((api_error) => { + done = true; + error = api_error; + }); + + while (!done) { deasync.sleep(discord_bot.DiscordBot.polling_interval); } + + if (channel) { + return [ new Channel(this, channel) ]; + } + + if (error) { + throw error; + } + } + + const api_channels = this.bot.client.channels.cache; + + // Filter by name + let layer_1_filtered: discord.Channel[] = []; + + api_channels.forEach((channel) => { + if ((channel as any).name == filter.name) { + layer_1_filtered.push(channel); + } else if (!filter.name) { + layer_1_filtered.push(channel); + } + }); + + // Filter with function + let layer_2_filtered: Channel[] = []; + + layer_1_filtered.forEach((channel) => { + const custom_channel = new Channel(this, channel); + if (filter.filter && filter.filter(custom_channel)) { + layer_2_filtered.push(custom_channel) + } else if (!filter.filter) { + layer_2_filtered.push(custom_channel); + } + }); + + return layer_2_filtered; + } +} + +export class Channel { + public readonly guild: Guild; + public readonly inner_channel: discord.Channel; + public readonly messages: Messages; + + constructor(guild: Guild, channel: discord.Channel) { + this.guild = guild; + this.inner_channel = channel; + this.messages = new Messages(channel); + } +} + +export class Embed { + public title = ""; + public description = ""; +} + +export class Messages { + public readonly inner_channel: discord.Channel; + + constructor(channel: discord.Channel) { + this.inner_channel = channel; + } + + public push(message: Message) { + const message_raw = { + content: message.text, + embeds: Message.transform_embeds(message.embeds) as any + }; + + console.log(message_raw, message); + (this.inner_channel as any).send(message_raw); + } +} + +export class Message { + public text = ""; + public embeds: Embed[] = []; + + public static transform_embeds(embeds: Embed[]) { + const embed_raw = [] as any[]; + + embeds.forEach((embed) => { + const raw = new discord.EmbedBuilder(); + + raw.setTitle(embed.title); + raw.setDescription(embed.description); + + embed_raw.push(raw); + }); + + return embed_raw; + } +} + +export interface CommandInteraction { + channel: Channel; +} + +export abstract class Command { + public readonly trigger: string; + public readonly description = ""; + constructor(trigger: string) { + this.trigger = trigger; + } + + abstract execute(interaction: CommandInteraction) { + + } } \ No newline at end of file