Skip to content

Commit

Permalink
Added utils command
Browse files Browse the repository at this point in the history
  • Loading branch information
ChristopherBThai committed Nov 14, 2019
1 parent b03969b commit ff9afd6
Show file tree
Hide file tree
Showing 43 changed files with 701 additions and 651 deletions.
4 changes: 0 additions & 4 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,6 @@ else var auth = require('../tokens/owo-auth.json');
// Config file
const config = require('./src/data/config.json');
const request = require('./utils/request.js');
var io;
if (require('cluster').isMaster){
io = require('./utils/socket.js');
}
// Eris-Sharder
const Sharder = require('eris-sharder').Master;
var result,shards,firstShardID,lastShardID;
Expand Down
62 changes: 0 additions & 62 deletions methods/command/util/avatar.js

This file was deleted.

40 changes: 0 additions & 40 deletions methods/command/util/merch.js

This file was deleted.

147 changes: 0 additions & 147 deletions methods/command/util/shard.js

This file was deleted.

72 changes: 0 additions & 72 deletions methods/command/util/stats.js

This file was deleted.

1 change: 0 additions & 1 deletion src/botHandlers/mysqlHandler.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ module.exports = class MySQL{
if(err) return reject(err);
resolve(rows);
});
//console.log(query.sql);
});
}
}
2 changes: 1 addition & 1 deletion src/commands/CommandInterface.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ module.exports = class CommandInterface{
let channelPerms = channel.permissionsOf(params.client.user.id);
for(let i in this.permissions){
if(!channelPerms.has(this.permissions[i])){
if(channelPerms.has("sendMessages"))
if(channelPerms.has("sendMessages")&&channelPerms.has("readMessages"))
params.errorMsg(", the bot does not have the `"+this.permissions[i]+"` permission! Please reinvite the bot, or contact your server admin!",4000);
params.logger.increment("noperms",['permission:'+this.permissions[i],'channel:'+params.msg.channel.id,'guild:'+params.msg.channel.guild.id],'id:'+params.msg.author.id);
return;
Expand Down
20 changes: 5 additions & 15 deletions src/commands/commandList/social/emoji.js
Original file line number Diff line number Diff line change
Expand Up @@ -159,10 +159,9 @@ async function display(p,emojis){
//Save the emoji
let name = emojis[loc].name;
let url = emojis[loc].url;
let id = emojis[loc].id;

try{
let result = await addEmoji(p,guild,name,url,id,loc,buffers[loc]);
let result = await addEmoji(p,guild,name,url,loc,buffers[loc]);
if(result.buffer) buffers[result.loc] = result.buffer;
save(loc,userID,successMsg);
}catch(err){
Expand Down Expand Up @@ -252,17 +251,8 @@ async function unsetServer(p){
p.replyMsg(stealEmoji,", your server has been unset for stealing!");
}

function addEmoji(p,guild,name,url,emojiID,loc,buffer){
return new Promise(function(res,rej){
let callbackID = p.msg.author.id+""+emojiID;
let callback = function(err,buffer,loc){
if(err){
rej(err);
}else{
res({buffer,loc});
}
}
p.pubsub.channels.addEmojiCallback.addCallback(callbackID,callback);
p.pubsub.publish("addEmoji",{guild,name,url,userID:p.msg.author.id,callbackID,buffer,loc});
});
async function addEmoji(p,guild,name,url,loc,buffer){
if(!buffer) buffer = await p.DataResolver.urlToBufferString(url);
await p.client.createGuildEmoji(guild,{name,image:buffer},"Requested by "+p.msg.author.username+"#"+p.msg.author.discriminator);
return {buffer,loc};
}
Loading

0 comments on commit ff9afd6

Please sign in to comment.