Skip to content

Instantly share code, notes, and snippets.

View jpbberry's full-sized avatar
:bowtie:
stink

Julian Berryessa jpbberry

:bowtie:
stink
View GitHub Profile
@jpbberry
jpbberry / voiceAdapter.ts
Last active May 22, 2021 01:35
Voice adapter for discord-rose in TypeScript
import { GatewayVoiceServerUpdateDispatchData, GatewayVoiceState } from "discord-api-types";
const connection = Voice.joinVoiceChannel({
channelId: channel.id,
guildId: channel.guild_id,
adapterCreator: (methods) => {
const voiceServerUpdate = (data: GatewayVoiceServerUpdateDispatchData) => {
methods.onVoiceServerUpdate(data)
}
@jpbberry
jpbberry / websocket.js
Last active September 14, 2019 03:27
Raw websocket thing
let browser = typeof window !== 'undefined'
const WS = browser ? WebSocket : require("ws");
const req = browser ? fetch : require("node-fetch");
function wait(a) { return new Promise(r => { setTimeout(() => r(), a) }) }
class Client {
constructor(token, options = {}, debug = () => { }) {
this.debug = debug;
this.options = {
shards: options.shards || 1,
@jpbberry
jpbberry / ChannelTypes.js
Created June 14, 2019 15:55
A proposal script for DJS channel types.
const { ChannelTypes: CT } = require("../util/Constants.js")
/**
* Represents a channel's type
*/
class ChannelTypes {
/**
* @param {Number} number The Discord assigned indentifier for a channel
*/
constructor(number) {
@jpbberry
jpbberry / index.js
Last active May 22, 2019 21:49
For shaye boi
class ShaysEnergyBoi {
constructor(config, baseURI = "api.shaybox.com", extend = "tplink") {
this.config = config || {
"type": "bar",
"options": {
"maintainAspectRatio": false,
"scales": {
"yAxes": [{
"ticks": {
"beginAtZero": true
module.exports = class JPBFilter {
constructor(client, filterFile, linkBypFile) {
this.filterFile = filterFile;
this.filter = require(filterFile);
this.linkBypFile = linkBypFile;
this.linkByp = require(linkBypFile).links;
this.client = client;
this.replaceSpots = {
spaces: /(\_|\/|\\|\.|\n|\&|\-|\+|\=|\:|\~)/gi,
nothing: /(\"|\*|\'|\||\`|\<|\>|\@|\#|\!|\,|\(|\)|\[|\]|\{|\}|\;|\%)/gi
module.exports = function(bot, connection, stuff, auth) {
var SelfReloadJSON = require('self-reload-json');
const modulename = "swearfilter"
const swears = new SelfReloadJSON("./swears.json")
var statuslog = bot.channels.get("450444337357258772")
var logchannel = bot.channels.get("399688995283533824")
var serverlistchannel = bot.channels.get("413831069117186078")
var botowner = bot.users.get("142408079177285632")