This repository has been archived by the owner on Dec 19, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Create a profile and statistics system
- Loading branch information
Matthew Ray
committed
Oct 25, 2018
1 parent
68f2fb7
commit 36be4da
Showing
9 changed files
with
1,211 additions
and
9 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
{ | ||
// See https://go.microsoft.com/fwlink/?LinkId=733558 | ||
// for the documentation about the tasks.json format | ||
"version": "2.0.0", | ||
"tasks": [ | ||
{ | ||
"type": "npm", | ||
"script": "install", | ||
"group": { | ||
"kind": "build", | ||
"isDefault": true | ||
} | ||
} | ||
] | ||
} |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
const Discord = require('discord.js'); | ||
|
||
exports.run = async (client, message, args) => { | ||
const resolvedUser = (args[0] !== undefined) ? message.guild.members.get(args[0].match(/[0-9]/g).join('')) : null; | ||
const botuser = resolvedUser ? message.guild.members.get(resolvedUser.id) : message.member; | ||
const thisUser = botuser.id; | ||
|
||
const myMessages = await client.stats.get(`${thisUser} | ${message.guild.id}`); | ||
const repPoints = await client.repPoints.get(thisUser); | ||
|
||
const embed = new Discord.RichEmbed(); | ||
embed.setAuthor(botuser.user.tag, botuser.user.avatarURL); | ||
embed.setTitle('Profile Card'); | ||
embed.setColor(botuser.displayHexColor); | ||
embed.setThumbnail(botuser.user.avatarURL); | ||
if (myMessages === undefined) { | ||
embed.addField('Messages', 'Unknown', true); | ||
} else { | ||
embed.addField('Messages', myMessages, true); | ||
} | ||
if (repPoints === undefined) { | ||
embed.addField('Reputation Points', '0', true); | ||
} else { | ||
embed.addField('Reputation Points', repPoints, true); | ||
} | ||
try { | ||
embed.addField('Last Seen', botuser.lastMessage.createdAt.toLocaleString('en-US')); | ||
} catch (err) { | ||
embed.addField('Last Seen', 'Unknown', true); | ||
} | ||
embed.setFooter(client.user.username, client.user.avatarURL); | ||
embed.setTimestamp(); | ||
await message.channel.send(embed); | ||
}; | ||
|
||
|
||
exports.conf = { | ||
enabled: true, | ||
guildOnly: true, | ||
aliases: [], | ||
permLevel: 'Standard User' | ||
}; | ||
|
||
exports.help = { | ||
name: 'profile', | ||
category: 'Fun', | ||
description: 'Displays your profile.', | ||
usage: 'profile' | ||
}; |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
const cooldown = new Set(); | ||
|
||
exports.run = async (client, message, args) => { | ||
const msg = await message.channel.send('Authenticating...'); | ||
if (cooldown.has(message.author.id)) { | ||
|
||
const botmessage = await msg.edit(`<@!${message.author.id}>, you are being ratelimited. Chill out for a minute.`); | ||
botmessage.delete(10000); | ||
return; | ||
} | ||
const resolvedUser = (args[0] !== undefined) ? message.guild.members.get(args[0].match(/[0-9]/g).join('')) : null; | ||
const botuser = resolvedUser ? message.guild.members.get(resolvedUser.id) : message.member; | ||
const thisUser = botuser.id; | ||
if (client.repPoints.get(thisUser) === undefined) { | ||
await client.repPoints.set(thisUser, 1); | ||
msg.edit(`***You have given a reputation point to ${botuser.user.tag}!***`); | ||
message.channel.send('This is also their first reputation point, congratulations!'); | ||
} else { | ||
await client.repPoints.inc(thisUser); | ||
msg.edit(`***You have given a reputation point to ${botuser.user.tag}!***`); | ||
} | ||
cooldown.add(message.author.id); | ||
setTimeout(() => { | ||
// Removes the user from the set after a minute | ||
cooldown.delete(message.author.id); | ||
}, 64800000); | ||
}; | ||
|
||
exports.conf = { | ||
enabled: true, | ||
guildOnly: true, | ||
aliases: [], | ||
permLevel: 'Standard User' | ||
}; | ||
|
||
exports.help = { | ||
name: 'rep', | ||
category: 'Fun', | ||
description: 'Gives a reputation point to another person.', | ||
usage: 'rep [...user]' | ||
}; |
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
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
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
Oops, something went wrong.