Skip to content

Instantly share code, notes, and snippets.

Avatar
:bowtie:
stink

Julian Berryessa jpbberry

:bowtie:
stink
View GitHub Profile
@jpbberry
jpbberry / voiceAdapter.ts
Last active May 22, 2021
Voice adapter for discord-rose in TypeScript
View voiceAdapter.ts
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 Sep 14, 2019
Raw websocket thing
View websocket.js
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 Jun 14, 2019
A proposal script for DJS channel types.
View ChannelTypes.js
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
For shaye boi
View index.js
class ShaysEnergyBoi {
constructor(config, baseURI = "api.shaybox.com", extend = "tplink") {
this.config = config || {
"type": "bar",
"options": {
"maintainAspectRatio": false,
"scales": {
"yAxes": [{
"ticks": {
"beginAtZero": true
View cringe.js
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
View gist:2434454e5404f61f9c9d06adef6fba81
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")