Skip to content
This repository has been archived by the owner on Dec 19, 2018. It is now read-only.

Commit

Permalink
fix ping and suggest
Browse files Browse the repository at this point in the history
  • Loading branch information
Matthew Ray committed Dec 5, 2018
1 parent 88bc26f commit 74dd1c1
Show file tree
Hide file tree
Showing 20 changed files with 4,510 additions and 169 deletions.
2 changes: 1 addition & 1 deletion allowedGuildDB.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"allowedGuildIDs":["470248906945462272","472913337454297108","113422487378788352","abahahlahalhal","446067825673633794","446067825673633794"]}
{"allowedGuildIDs":["470248906945462272","472913337454297108","113422487378788352","abahahlahalhal","446067825673633794","446067825673633794","400803476814168065"]}
1 change: 1 addition & 0 deletions commands/deploy.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ exports.run = async (client, msg) => {
//args.join(' ');
const outMessage = await msg.channel.send('`Deploying...`');
//await msg.channel.send(`Running \`${command}\`...`);
if (args[0] === 'stash') let stash = await doExec(command).catch(data=> outputErr(outMessage, data));
let stdOut = await doExec(command).catch(data=> outputErr(outMessage, data));
stdOut = stdOut.substring(0, 1750);
outMessage.edit(`\`DEPLOYMENT STATUS\`
Expand Down
43 changes: 43 additions & 0 deletions commands/getinvite.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
const Discord = require('discord.js');

exports.run = async (client, message, args) => {
const msg = await message.channel.send('Fetching invite...');
try {
await client.fetchInvite(args);
} catch (err) {
return msg.edit(err);
}

const inviteCode = args;
const guildName = await client.fetchInvite(args).guild.name;
const guildID = await client.fetchInvite(args).guild.id;
const guildMembersOnline = await client.fetchInvite(args).presenceCount;
const inviteUses = await client.fetchInvite(args).uses;
const guildMemberCount = await client.fetchInvite(args).memberCount;
//const guildIcon = client.fetchInvite(args).then(m => m.guild.icon);

const embed = new Discord.RichEmbed();
embed.setTitle('Server Invite Information');

await embed.addField('Invite Code', inviteCode, true);
await embed.addField('Server Name', guildName, true);
await embed.addField('Server Member Count', `${guildMembersOnline}/${guildMemberCount}`, true);
await embed.addField('Invite Uses', inviteUses, true);
embed.setFooter(`${client.user.username} | Server ID: ${guildID}`, client.user.avatarURL);
embed.setTimestamp();
msg.edit(embed);
};

exports.conf = {
enabled: true,
guildOnly: false,
aliases: ['fetchinvite'],
permLevel: 'Standard User'
};

exports.help = {
name: 'getinvite',
category: 'Misc',
description: 'Gets invite information from Discord.',
usage: 'getinvite'
};
58 changes: 49 additions & 9 deletions commands/ping.js
Original file line number Diff line number Diff line change
@@ -1,21 +1,61 @@
//const util = require('../util/util.ts');
exports.run = async (client, message) => {
//const thisMessage = '🏓 Pong!';
const msg = await message.channel.send('🏓 Pong!');

msg.edit(`🏓 Pong! \`${msg.createdTimestamp - message.createdTimestamp}ms\``);
var __awaiter = (this && this.__awaiter) || function(thisArg, _arguments, P, generator) {
return new (P || (P = Promise))(function(resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator['throw'](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : new P(function(resolve) { resolve(result.value); }).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
var __generator = (this && this.__generator) || function(thisArg, body) {
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
return g = { next: verb(0), 'throw': verb(1), 'return': verb(2) }, typeof Symbol === 'function' && (g[Symbol.iterator] = function() { return this; }), g;
function verb(n) { return function(v) { return step([n, v]); }; }
function step(op) {
if (f) throw new TypeError('Generator is already executing.');
while (_) try {
if (f = 1, y && (t = op[0] & 2 ? y['return'] : op[0] ? y['throw'] || ((t = y['return']) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
if (y = 0, t) op = [op[0] & 2, t.value];
switch (op[0]) {
case 0: case 1: t = op; break;
case 4: _.label++; return { value: op[1], done: false };
case 5: _.label++; y = op[1]; op = [0]; continue;
case 7: op = _.ops.pop(); _.trys.pop(); continue;
default:
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
if (t[2]) _.ops.pop();
_.trys.pop(); continue;
}
op = body.call(thisArg, _);
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
}
};

var _this = this;
//const util = require('../util/util.ts');
exports.run = function(client, message) { return __awaiter(_this, void 0, void 0, function() {
var msg;
return __generator(this, function(_a) {
switch (_a.label) {
case 0: return [4 /*yield*/, message.channel.send('🏓 Pong!')];
case 1:
msg = _a.sent();
msg.edit('\uD83C\uDFD3 Pong! `' + (msg.createdTimestamp - message.createdTimestamp) + 'ms`');
return [2 /*return*/];
}
});
}); };
exports.conf = {
enabled: true,
guildOnly: false,
aliases: [],
permLevel: 'Standard User'
};

exports.help = {
name: 'ping',
category: 'Bot Information',
description: 'Pings the bot, without the embed.',
description: 'Pings the bot, and returns the response time.',
usage: 'ping'
};
27 changes: 27 additions & 0 deletions commands/profileadmin.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
exports.run = async (client, message, args) => {
const msg = await message.channel.send('Authenticating...');
const myMessages = await client.stats.get(`${args[1]} | ${message.guild.id}`);
const repPoints = await client.repPoints.get(args[1]);
if (args[0] === 'messages') {
client.stats.set(`${args[1]} | ${message.guild.id}`, args[2]);
await msg.edit(`I have edited \`${args[1]}\` key to \`${args[2]}\`. They now have a total of \`${myMessages}\` messages.`);
}
else if (args[0] === 'reputation') {
client.repPoints.set(args[1], args[2]);
await msg.edit(`I have edited \`${args[1]}\` key to \`${args[2]}\`. They now have a total of \`${repPoints}\` reputation points.`);
}
};

exports.conf = {
enabled: true,
guildOnly: true,
aliases: [],
permLevel: 'Systems Administrator'
};

exports.help = {
name: 'profileadmin',
category: 'System',
description: 'Changes specified user\'s messages or reputation points.',
usage: 'profileadmin [messages (User ID) (New Messages) || [reputation (User ID) (New Reputation Points)'
};
2 changes: 1 addition & 1 deletion commands/serversuggest.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ exports.run = async (client, message, args) => {
if (!message.guild.id == '446067825673633794') return msg.edit('This command can only be used in the Library of Code server.');

const embed = new Discord.RichEmbed()
.setTitle('Moonglow Suggestion')
.setTitle('Library of Code Suggestion')
.addField('Author', `${message.author.username} (${message.author.id})`)
.addField('Suggestion', `${dataSuggestion}`)
.setTimestamp()
Expand Down
2 changes: 1 addition & 1 deletion commands/suggest.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ exports.run = async (client, message, args) => {
.setFooter(client.user.username, client.user.avatarURL);
client.channels.get('481464215962648577').send({embed});
client.channels.get('503473196704727050').send({embed});
msg.edit('Suggestion has been successfully sent to the Moonglow Development Team!');
msg.edit('Suggestion has been successfully sent to the Garnet Development Team!');
msg.delete(10000);
message.delete(10000);
//pls
Expand Down
25 changes: 25 additions & 0 deletions commands/talk.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
exports.run = async (client, message, args) => {
const cleverbot = require('cleverbot.io');

const bot = new cleverbot('1DoyBgxuUc3EiKnm', 'FYGWlyIAE85XYjBvB1pUVjGiqhZ9opyT');
bot.create(function(err, session) {
bot.ask(args, function(err, response) {
message.channel.send(response); // Will likely be: "Living in a lonely world"
});
});

};

exports.conf = {
enabled: true,
guildOnly: false,
aliases: ['ask'],
permLevel: 'Standard User'
};

exports.help = {
name: 'talk',
category: 'Fun',
description: 'Talk to the bot.',
usage: 'talk'
};
9 changes: 8 additions & 1 deletion commands/whois.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,14 @@ const status = {
offline: 'Offline/Invisible'
};
exports.run = async (client, message, args, level) => {
const resolvedUser = (args[0] !== undefined) ? message.guild.members.get(args[0].match(/[0-9]/g).join('')) : null;
const resolvedUser = (args[0] !== undefined) ? message.guild.members.get(args[0].match(/[0-9]/g).join('')) : message.guild.members.find(r => r.user.username.toLowerCase() === args);
/*if (resolvedUser == null) {
try {
resolvedUser = message.guild.members.find(r => r.user.username.toLowerCase() === args);
} catch (err) {
resolvedUser = err;
}
}*/
if (talkedRecently.has(message.author.id) && !message.member.roles.has('490364533550874644')) {

const botmessage = await message.channel.send('You are being rate limited!' + message.author);
Expand Down
3 changes: 2 additions & 1 deletion events/ready.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ module.exports = async client => {
.setTimestamp();

hook.send(embed);
};



};
2 changes: 2 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ const client = new Discord.Client({


client.config = require('./config.js');

// client.config.token contains the bot's token
// client.config.prefix contains the message prefix
//k
Expand Down Expand Up @@ -123,6 +124,7 @@ client.init = async () => {

};


client.init();

setTimeout(() => {
Expand Down
10 changes: 6 additions & 4 deletions modules/functions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,26 +79,28 @@ module.exports = (client) => {
and stringifies objects!
This is mostly only used by the Eval and Exec commands.
*/
client.clean = async (client, text) => {
/*client.clean = async (client, text) => {
if (text && text.constructor.name == 'Promise')
text = await text;
if (typeof evaled !== 'string')
text = require('util').inspect(text, {depth: 1});
//if (typeof evaled !== 'string')
//text = require('util').inspect(text, {depth: 1});
text = text
//.replace(/`/g, '`' + String.fromCharCode(8203))
//.replace(/@/g, '@' + String.fromCharCode(8203))
.replace(client.token, '[TOKEN]');
return text;
};
};*/
client.loadCommand = (commandName) => {
try {
client.logger.log(`Loading Command: ${commandName}`);
const props = require(`../commands/${commandName}`);
if (props.init) {
props.init(client);
}
//if (!props.conf.enabled) return;
// ^^^^^^ this shit broke as fuck do not uncomment this.
client.commands.set(props.help.name, props);
props.conf.aliases.forEach(alias => {
client.aliases.set(alias, props.help.name);
Expand Down
Loading

0 comments on commit 74dd1c1

Please sign in to comment.