chore: consistency/prettier (#3852)

* chore: consistency/prettier

* chore: rebase

* chore: rebase

* chore: include typings

* fix: include typings file in prettier lint-staged
This commit is contained in:
Crawl
2020-02-29 14:35:57 +01:00
committed by GitHub
parent 6650d50a56
commit c065156a88
127 changed files with 5198 additions and 4513 deletions

View File

@@ -1,16 +1,20 @@
/* eslint-disable */
'use strict';
const Discord = require('../');
const request = require('superagent');
const fs = require('fs');
const ytdl = require('ytdl-core');
const { token, song } = require('./auth.js');
const Discord = require('../');
console.time('magic');
const client = new Discord.Client({ fetchAllMembers: true, apiRequestMethod: 'sequential' });
const { email, password, token, usertoken, song } = require('./auth.js');
client.login(token).then(atoken => console.log('logged in')).catch(console.error);
client
.login(token)
.then(() => console.log('logged in'))
.catch(console.error);
client.on('ready', () => {
console.log(`ready with ${client.users.size} users`);
@@ -33,8 +37,9 @@ client.on('message', message => {
if (message.content === 'imma queue pls') {
let count = 0;
let ecount = 0;
for(let x = 0; x < 4000; x++) {
message.channel.send(`this is message ${x} of 3999`)
for (let x = 0; x < 4000; x++) {
message.channel
.send(`this is message ${x} of 3999`)
.then(m => {
count++;
console.log('reached', count, ecount);
@@ -48,8 +53,9 @@ client.on('message', message => {
}
if (message.content === 'myperms?') {
message.channel.send('Your permissions are:\n' +
JSON.stringify(message.channel.permissionsFor(message.author).serialize(), null, 4));
message.channel.send(
`Your permissions are:\n${JSON.stringify(message.channel.permissionsFor(message.author).serialize(), null, 4)}`,
);
}
if (message.content === 'delchann') {
@@ -65,22 +71,26 @@ client.on('message', message => {
}
if (message.content.startsWith('botavatar')) {
request
.get('url')
.end((err, res) => {
client.user.setAvatar(res.body).catch(console.error)
.then(user => message.channel.send('Done!'));
});
request.get('url').end((err, res) => {
client.user
.setAvatar(res.body)
.catch(console.error)
.then(user => message.channel.send('Done!'));
});
}
if (message.content.startsWith('gn')) {
message.guild.setName(message.content.substr(3))
message.guild
.setName(message.content.substr(3))
.then(guild => console.log('guild updated to', guild.name))
.catch(console.error);
}
if (message.content === 'leave') {
message.guild.leave().then(guild => console.log('left guild', guild.name)).catch(console.error);
message.guild
.leave()
.then(guild => console.log('left guild', guild.name))
.catch(console.error);
}
if (message.content === 'stats') {
@@ -90,22 +100,29 @@ client.on('message', message => {
m += `I am aware of ${client.channels.size} channels overall\n`;
m += `I am aware of ${client.guilds.size} guilds overall\n`;
m += `I am aware of ${client.users.size} users overall\n`;
message.channel.send(m).then(msg => msg.edit('nah')).catch(console.error);
message.channel
.send(m)
.then(msg => msg.edit('nah'))
.catch(console.error);
}
if (message.content === 'messageme!') {
message.author.send('oh, hi there!').catch(e => console.log(e.stack));
}
if (message.content === 'don\'t dm me') {
if (message.content === "don't dm me") {
message.author.deleteDM();
}
if (message.content.startsWith('kick')) {
message.guild.member(message.mentions[0]).kick().then(member => {
console.log(member);
message.channel.send('Kicked!' + member.user.username);
}).catch(console.error);
message.guild
.member(message.mentions[0])
.kick()
.then(member => {
console.log(member);
message.channel.send(`Kicked!${member.user.username}`);
})
.catch(console.error);
}
if (message.content === 'ratelimittest') {
@@ -122,55 +139,72 @@ client.on('message', message => {
}
if (message.content === 'makerole') {
message.guild.createRole().then(role => {
message.channel.send(`Made role ${role.name}`);
}).catch(console.error);
message.guild
.createRole()
.then(role => {
message.channel.send(`Made role ${role.name}`);
})
.catch(console.error);
}
}
});
function nameLoop(user) {
// user.setUsername(user.username + 'a').then(nameLoop).catch(console.error);
// User.setUsername(user.username + 'a').then(nameLoop).catch(console.error);
}
function chanLoop(channel) {
channel.setName(channel.name + 'a').then(chanLoop).catch(console.error);
channel
.setName(`${channel.name}a`)
.then(chanLoop)
.catch(console.error);
}
client.on('message', msg => {
if (msg.content.startsWith('?raw')) {
msg.channel.send('```' + msg.content + '```');
msg.channel.send(`\`\`\`${msg.content}\`\`\``);
}
if (msg.content.startsWith('#eval') && msg.author.id === '66564597481480192') {
try {
const com = eval(msg.content.split(" ").slice(1).join(" "));
msg.channel.send('```\n' + com + '```');
} catch(e) {
msg.channel.send('```\n' + e + '```');
const com = eval(
msg.content
.split(' ')
.slice(1)
.join(' '),
);
msg.channel.send(`\`\`\`\n${com}\`\`\``);
} catch (e) {
msg.channel.send(`\`\`\`\n${e}\`\`\``);
}
}
});
const ytdl = require('ytdl-core');
let disp, con;
client.on('message', msg => {
if (msg.content.startsWith('/play')) {
console.log('I am now going to play', msg.content);
const chan = msg.content.split(' ').slice(1).join(' ');
const s = ytdl(chan, {filter:'audioonly'}, { passes : 3 });
const chan = msg.content
.split(' ')
.slice(1)
.join(' ');
const s = ytdl(chan, { filter: 'audioonly' }, { passes: 3 });
s.on('error', e => console.log(`e w stream 1 ${e}`));
con.playStream(s);
}
if (msg.content.startsWith('/join')) {
const chan = msg.content.split(' ').slice(1).join(' ');
msg.channel.guild.channels.get(chan).join()
const chan = msg.content
.split(' ')
.slice(1)
.join(' ');
msg.channel.guild.channels
.get(chan)
.join()
.then(conn => {
con = conn;
msg.reply('done');
const s = ytdl(song, {filter:'audioonly'}, { passes : 3 });
const s = ytdl(song, { filter: 'audioonly' }, { passes: 3 });
s.on('error', e => console.log(`e w stream 2 ${e}`));
disp = conn.playStream(s);
conn.player.on('debug', console.log);
@@ -198,10 +232,13 @@ client.on('message', m => {
reaction.fetchUsers().then(users => {
m.channel.send(
`The following gave that message ${reaction.emoji}:\n` +
`${users.map(u => u.username).map(t => `- ${t}`).join('\n')}`
`${users
.map(u => u.username)
.map(t => `- ${t}`)
.join('\n')}`,
);
});
}
});
}
});
});