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
class Ratelimiter { | |
constructor({ limit = 1, frequency = 5 }) { | |
this.count = 0; | |
this.limit = limit; | |
this.frequency = frequency * 1000; | |
this._timeout(); | |
} | |
_timeout() { |
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
class Camel { | |
constructor(data) { | |
for(const prop in data) | |
if(data.hasOwnProperty(prop)) | |
this[prop.replace(/_([a-z])/, (match, p1) => p1.toUpperCase())] = data[prop]; | |
} | |
} |
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
await new Promise((resolve, reject) => { | |
exec(`fswebcam --fps 15 -S 8 -r ${imgW}x${imgH} --no-banner selfie.jpg`, (error) => { | |
if (error) return reject(error); | |
return resolve(); | |
}); | |
}); |
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
// not chaining | |
asyncFunction().then(data => { | |
asyncFunction(data).then(data2 => { | |
asyncFunction(data2); | |
}).catch(console.error); | |
}); | |
// chaining | |
asyncFunction.then(data => { | |
return asyncFunction(data); |
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 {SettingProvider} = require('discord.js-commando'); | |
const bluebird = require('bluebird'); | |
const redis = require('redis'); | |
const erlpack = require('erlpack'); | |
const mergeOptions = require('merge-options'); | |
bluebird.promisifyAll(redis.RedisClient.prototype); | |
bluebird.promisifyAll(redis.Multi.prototype); |
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
let rp = require('request-promise-native'); | |
const dns = require('dns'); | |
const os = require('os'); | |
function checkSpelling(client, text) { | |
return new Promise((resolve, reject) => { | |
dns.lookup(os.hostname(), (err, address, family) => { | |
if(err) return reject(err); | |
resolve(address); |
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
{ | |
"token": "test token" | |
} |
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 Eval(msg, args) { | |
const input = ':arrow_right: **Input:**\n```js\n' + args.join(' ') + '\n```'; | |
return new Promise((resolve, reject) => { | |
let ev; | |
try { | |
ev = eval(args.join(' ')); | |
if(ev && ev instanceof Promise) { | |
ev.then(resolve).catch(reject); |
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
var chaine = msg.content.split(" "); | |
// Also, consider using `msg.author.voiceChannel` | |
bot.joinVoiceChannel(bot.channels.get("name", "Général")).then(function(vc){ | |
var request = require("request"); | |
var url = chaine[1]; | |
var stream = request(url); | |
return vc.playRawStream(stream); | |
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
{ | |
"countries": [ | |
{ | |
"name": "Australia", | |
"code": "AU", | |
"status": "supported" | |
}, | |
{ | |
"name": "Austria", | |
"code": "AT", |
NewerOlder