View LimitedSet.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Harry Kruger | |
// License: MIT | |
class LimitedSet extends Set { | |
constructor(limit = 0, maxAge = 0, sweepInterval = 1000 * 60, init) { | |
super(init); | |
this.limit = limit; | |
this.maxAge = maxAge; | |
this._sweepInterval = sweepInterval; |
View get.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function get(object = {}, path = '') { | |
return path.split('.').reduce((obj, token) => obj[token], object); | |
} | |
module.exports = get; |
View userRegex.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/(^\d{17,19}$|<@!?\d{17,19}>)/ |
View wrapString.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function wrap(msg, charLimit = 2000, wrapChar = '\n') { | |
const messages = []; | |
while (msg.length > charLimit) { | |
const firstPart = msg.slice(0, charLimit); | |
let lastNewline = firstPart.lastIndexOf('\n'); | |
if (lastNewline < 0) lastNewline = firstPart.length; | |
messages.push(firstPart.slice(0, lastNewline)); | |
msg = msg.slice(lastNewline + 1); | |
} | |
if (msg) messages.push(msg); |
View cauth_api_wrapper.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Made by Harry Kruger | |
License MIT | |
*/ | |
const Axios = require('axios'); | |
const fs = require('fs'); | |
const path = require('path'); | |
const https = require('https'); | |
const FormData = require('form-data'); |
View index.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* @author Harry Kruger | |
* @copyright 2020 Harry Kruger | |
*/ | |
// todo: add auto config | |
const dotenv = require('dotenv'); | |
// the default client options | |
const clientOptionsDefaults = { |
View index.d.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import * as Discord from 'discord.js'; | |
interface ClientOptions { | |
token: String; | |
logChannel: Discord.Snowflake; | |
} | |
declare class Client extends Discord.Client { | |
constructor(opts: ClientOptions); |
View index.d.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Discord from "discord.js"; | |
interface ClientOptions { | |
token: String; | |
logChannel: Discord.Snowflake; | |
} | |
declare class Client extends Discord.Client { | |
constructor(opts: ClientOptions); |
View index.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const dotenv = require('dotenv'); | |
const clientOptionsDefaults = { | |
token: undefined, | |
logChannel: undefined | |
}; | |
class missingLogChannelError extends Error { | |
constructor() { | |
super('Log Channel not found.'); |
View index.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const dotenv = require('dotenv'); | |
const clientOptionsDefaults = { | |
token: undefined, | |
logChannel: undefined | |
}; | |
class missingLogChannelError extends Error { | |
constructor() { | |
super('Log Channel not found.'); |
NewerOlder