Skip to content

Commit

Permalink
first commit
Browse files Browse the repository at this point in the history
  • Loading branch information
DillonMercz committed Mar 18, 2021
1 parent 42e0ef5 commit 14facc8
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 7 deletions.
49 changes: 43 additions & 6 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,16 +48,17 @@ client.on('ready', () => {
//Help Command
client.on('message', async message => {
if (message.content.includes('!help')) {
var help = '**Command: !p** \n Get The moments of a player. Player name all lower case. \n\n!p Ex: !p lebron james'+
var help = '**Command: !p** \n Get The moments of a player. Player name all lower case. \n!p EXAMPLE: !p lebron james'+

'\n\n **Command: !s** \n Store a Specific Moment. Easiest is to just copy straight from the website. The moment name has to be seperated by a comma. \n\n !s EX: !s KYLE ANDERSON Dunk Base Set (Series 2), https://www.nbatopshot.com/listings/p2p/208ae30a-a4fe-42d4-9e51-e6fd1ad2a7a9+a3cd9d63-7ca6-41c6-b8ee-a10733d02a96'+
'\n\n **Command: !s** \n Store a Specific Moment. Easiest is to just copy straight from the website. The moment name has to be seperated by a comma. \n !s EXAMPLE: !s KYLE ANDERSON Dunk Base Set (Series 2), https://www.nbatopshot.com/listings/p2p/208ae30a-a4fe-42d4-9e51-e6fd1ad2a7a9+a3cd9d63-7ca6-41c6-b8ee-a10733d02a96'+

' \n\n **Command: !m** \n Recall the moment stored using !s command. \n\n !m EX: KYLE ANDERSON Dunk Base Set (Series 2)'+
' \n\n **Command: !m** \n Recall the moment stored using !s command. \n !m EXAMPLE: KYLE ANDERSON Dunk Base Set (Series 2)'+

'\n\n **Command: !add** \n Add an abbreviation for a moment, for personal use, and ease of access. comma comes after abbreviation. \n\n !add EX: !add KA, https://www.nbatopshot.com/listings/p2p/208ae30a-a4fe-42d4-9e51-e6fd1ad2a7a9+a3cd9d63-7ca6-41c6-b8ee-a10733d02a96'+
'\n\n **Command: !add** \n Add an abbreviation for a moment, for personal use, and ease of access. comma comes after abbreviation. \n !add EXAMPLE: !add KA, https://www.nbatopshot.com/listings/p2p/208ae30a-a4fe-42d4-9e51-e6fd1ad2a7a9+a3cd9d63-7ca6-41c6-b8ee-a10733d02a96'+

'\n\n **Command: !u** \n Use The Added Abbreviation. \n\n !u EX: !u KA'+
'\n\n **Command: !list** \n Get The List Of Stored Abbreviations. \n\n !list Ex: !list'
'\n\n **Command: !u** \n Use The Added Abbreviation. \n !u EXAMPLE: !u KA'+
'\n\n **Command: !list** \n Get The List Of Stored Abbreviations. \n !list EXAMPLE: !list'+
'\n\n **Command: !rm** \n Remove a Previously Stored Abbreviation. \n !rm EXAMPLE: !rm KA'
const embed = new Discord.RichEmbed()
// Set the title of the field
.setTitle('Help And Commands')
Expand All @@ -70,6 +71,42 @@ client.on('message', async message => {
message.channel.send(embed)
}
})
client.on('message', async message => {
if (message.content.includes('!rm')) {
var messagec = message.content
var sender = message.author.username + '#'+ message.author.discriminator;
var message1 = messagec.replace("!rm ","");
const fs = require('fs')
fs.readFile('./shortcuts.json', 'utf8', function (err,data1) {
if (err) {
return console.log(err);
}
var data1 = data1 + "}"
const data2 = JSON.parse(data1)
delete data2[sender][message1]
var data3 = JSON.stringify(data2)
var data3 = data3.replace(/\}([^}]*)$/,'')
fs.writeFile("./shortcuts.json", data3, (err) => {
if (err)
console.log(err);})

// We can create embeds using the MessageEmbed constructor
// Read more about all that you can do with the constructor
// over at https://discord.js.org/#/docs/main/stable/class/RichEmbed
const embed = new Discord.RichEmbed()
// Set the title of the field
.setTitle("Abbreviation Has Been Removed!")
// Set the color of the embed
.setColor(0xff0000)
// Set the main content of the embed
.setDescription('Brought To You By The NBA Top Shot Pros')
// Send the embed to the same channel as the message
message.channel.send(embed);
})
}
})


//Get List
client.on('message', async message => {
if (message.content.includes('!list')) {
Expand Down
2 changes: 1 addition & 1 deletion shortcuts.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"Dillon_Marks#6810":{"BB":"https://www.nbatopshot.com/listings/p2p/122b048d-585e-4c63-8275-c23949576fd6+0445c38e-c13c-44b4-b3aa-e2c21eca7407?serialNumber=3733","RD":" https://www.nbatopshot.com/listings/p2p/7b797690-5b53-45a7-b972-bd2d5152654a+ffe420ae-a89c-4c21-b080-086172c5277d?serialNumber=1390","kyle":" https://www.nbatopshot.com/listings/p2p/208ae30a-a4fe-42d4-9e51-e6fd1ad2a7a9+a3cd9d63-7ca6-41c6-b8ee-a10733d02a96","KA":" https://www.nbatopshot.com/listings/p2p/208ae30a-a4fe-42d4-9e51-e6fd1ad2a7a9+a3cd9d63-7ca6-41c6-b8ee-a10733d02a96","LJ3":" https://www.nbatopshot.com/listings/p2p/208ae30a-a4fe-42d4-9e51-e6fd1ad2a7a9+8d5f8379-aa09-4bd1-9a71-80e5a606cb63","PJ":" https://www.nbatopshot.com/listings/p2p/208ae30a-a4fe-42d4-9e51-e6fd1ad2a7a9+94fb4073-e00f-4334-b15b-6e659f294c98?serialNumber=27893","eric":" https://www.nbatopshot.com/listings/p2p/208ae30a-a4fe-42d4-9e51-e6fd1ad2a7a9+8a95da78-2737-4805-b27c-45a8c84d730f?serialNumber=2945","BS":" https://www.nbatopshot.com/listings/p2p/208ae30a-a4fe-42d4-9e51-e6fd1ad2a7a9+10357d57-4fab-497b-b220-423b77847b87?serialNumber=14764"},"Misfitz_Love#5895":{"BS":" BEN SIMMONS Dunk Base Set (Series 2)","BBBBBBBB":" BEN SIMMONS Dunk Base Set (Series 2)"},"BrennanClay#5549":{"DJ":" https://www.nbatopshot.com/listings/p2p/7b797690-5b53-45a7-b972-bd2d5152654a+45e0e8c4-a281-40b1-91fd-c777300a29ed"}
{"Dillon_Marks#6810":{"RD":" https://www.nbatopshot.com/listings/p2p/7b797690-5b53-45a7-b972-bd2d5152654a+ffe420ae-a89c-4c21-b080-086172c5277d?serialNumber=1390","KA":" https://www.nbatopshot.com/listings/p2p/208ae30a-a4fe-42d4-9e51-e6fd1ad2a7a9+a3cd9d63-7ca6-41c6-b8ee-a10733d02a96","LJ3":" https://www.nbatopshot.com/listings/p2p/208ae30a-a4fe-42d4-9e51-e6fd1ad2a7a9+8d5f8379-aa09-4bd1-9a71-80e5a606cb63","BS":" https://www.nbatopshot.com/listings/p2p/208ae30a-a4fe-42d4-9e51-e6fd1ad2a7a9+10357d57-4fab-497b-b220-423b77847b87?serialNumber=14764"},"Misfitz_Love#5895":{"BS":" BEN SIMMONS Dunk Base Set (Series 2)","BBBBBBBB":" BEN SIMMONS Dunk Base Set (Series 2)"},"BrennanClay#5549":{"DJ":" https://www.nbatopshot.com/listings/p2p/7b797690-5b53-45a7-b972-bd2d5152654a+45e0e8c4-a281-40b1-91fd-c777300a29ed"}

0 comments on commit 14facc8

Please sign in to comment.