Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

import sql = require('sql');
import pg = require('pg');
export declare class Table {
name: string;
database: any;
pool: pg.Pool;
table: sql.Table<string, [
{
name: 'key',
const dotenv = require('dotenv');
const clientOptionsDefaults = {
token: undefined,
logChannel: undefined
};
class missingLogChannelError extends Error {
constructor() {
super('Log Channel not found.');
@ha6000
ha6000 / index.js
Last active February 14, 2020 12:16
const dotenv = require('dotenv');
const clientOptionsDefaults = {
token: undefined,
logChannel: undefined
};
class missingLogChannelError extends Error {
constructor() {
super('Log Channel not found.');
import Discord from "discord.js";
interface ClientOptions {
token: String;
logChannel: Discord.Snowflake;
}
declare class Client extends Discord.Client {
constructor(opts: ClientOptions);
import * as Discord from 'discord.js';
interface ClientOptions {
token: String;
logChannel: Discord.Snowflake;
}
declare class Client extends Discord.Client {
constructor(opts: ClientOptions);
/**
* @author Harry Kruger
* @copyright 2020 Harry Kruger
*/
// todo: add auto config
const dotenv = require('dotenv');
// the default client options
const clientOptionsDefaults = {
@ha6000
ha6000 / cauth_api_wrapper.js
Last active August 24, 2020 08:13
Wrapper for the cauth universal and premium api
/*
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');
@ha6000
ha6000 / wrapString.js
Last active September 23, 2020 16:19
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);
/(^\d{17,19}$|<@!?\d{17,19}>)/
@ha6000
ha6000 / get.js
Created January 15, 2021 17:12
Get's certain path of a object
function get(object = {}, path = '') {
return path.split('.').reduce((obj, token) => obj[token], object);
}
module.exports = get;