Skip to content

Instantly share code, notes, and snippets.

View Fyko's full-sized avatar
🏠
Working from home

Carter Fyko

🏠
Working from home
View GitHub Profile
const { randomBytes } = require('crypto');
const fetch = require('node-fetch');
const FormData = require('form-data');
const { parse } = require('url');
module.exports = class OAuth2 {
constructor({
endpoint,
clientID,
clientSecret,
@Fyko
Fyko / DBLAPI.md
Last active April 23, 2019 23:54
An example on using the new-dblapi Node package to post stats & handle votes

This is a quick guide on using the new-dblapi npm package to post your bot stats to discordbots.org. This package is only compatible with discord.js.

Here are the the sources that are mentioned in the comments below. link 1 link 2 link 3

const { Client } = require('discord.js');
@Fyko
Fyko / prompt.js
Last active May 17, 2019 23:16
An example of confirmation with Discord.js
const responses = await message.channel.awaitMessages(msg => msg.author.id === message.author.id, {
max: 1,
time: 10000
});
if (!responses || responses.size !== 1) {
// timed out
}
const response = responses.first();
@Fyko
Fyko / discord entity ids.md
Last active November 26, 2019 23:10
Short guide on getting Discord entity IDs such as servers, channels, and users

This guide will walk you through obtaining Discord IDs such as your server ID.

  1. Ensure that Developer Mode is on. If not, head to Settings ⚙ => Appearance then toggle Developer Mode.
  • Settings
  • Appearance
  • Developer Mode
  1. For most Discord entities (servers, channels, users, messages) you can simply right click the item and click Copy ID
    However, for emoji IDs you must escape the emoji by placing a foreword slash () infront of the emoji. Ex: \:blobreach: then copy the ID from there.
  • Server ID
@Fyko
Fyko / keybase.md
Created December 15, 2019 20:02
My keybase verification

Keybase proof

I hereby claim:

  • I am fyko on github.
  • I am fyko (https://keybase.io/fyko) on keybase.
  • I have a public key ASAMTkMlDtCWi1VXm-H0Tjx_pF1FaI1ylldPBkPqypesJgo

To claim this, I am signing this object:

@Fyko
Fyko / index.ts
Created April 22, 2020 20:46
util function for verifiying hcaptcha token, sorry dom
import fetch from 'node-fetch';
import qs from 'querystring';
enum ErrorCode {
'missing-input-secret' = 'Your secret key is missing.',
'invalid-input-secret' = 'Your secret key is invalid or malformed.',
'missing-input-response' = 'The response parameter (verification token) is missing.',
'invalid-input-response' = 'The response parameter (verification token) is invalid or malformed.',
'bad-request' = 'The request is invalid or malformed.',
'invalid-or-already-seen-response' = 'The response parameter has already been checked, or has another issue.',
@Fyko
Fyko / Dockerfile
Created July 25, 2020 10:27
Dockerfile that caches cargo packages
# syntax=docker/dockerfile-upstream:experimental
# WARNING: THE LINE ABOVE CANNOT BE REMOVED
# Note: Remember to change the workdir & paths that use "trakor/inkress"
# https://stackoverflow.com/q/54952867
# https://github.com/rust-lang/cargo/issues/2644#issuecomment-436907777
# --------------------------------
# building in this image
# --------------------------------
@Fyko
Fyko / rest.rs
Created August 19, 2020 03:46
client for interacting with https://github.com/spec-tacles/proxy
#[macro_use]
extern crate log;
use anyhow::Result;
use rustacles_brokers::amqp::AmqpBroker;
use serde_json::{from_slice, to_vec};
use std::collections::HashMap;
use tokio::time::{delay_for, timeout, Duration};
pub use proxy::models::*;
@Fyko
Fyko / ExtendedGuild.ts
Last active September 4, 2020 04:22
collector for guild member add event in discord.js
import { Client, Collection, GuildMember, Snowflake, Structures, Guild as ImportedGuild } from 'discord.js';
import GuildMemberCollector, { GuildMemberCollectorOptions } from './GuildMemberCollector';
type MemberCollection = Collection<Snowflake, GuildMember>;
declare module 'discord.js' {
interface Guild {
awaitMembers(
filter: (member: GuildMember) => boolean,
options?: GuildMemberCollectorOptions,
NzA3OTk1NjY1NjYxMTY1NTY4.XrQ6WA.yC8FjGmM3KbO0dD1wNP3jqNzq2c