Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const Notes = JSON.parse(fs.readFileSync('./Notes.json','utf8'));
- const captcha = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
- client.on('message', message => {
- let prefix = ">"
- if(message.content.startsWith(prefix + 'note')) {
- let ID = "";
- let name;
- let note;
- let filter = m => m.author.id === message.author.id;
- for (var m = 0; m < 8; m++) {
- ID += `${captcha.charAt(Math.floor(Math.random() * captcha.length))}`;
- }
- message.channel.send('📜 **| Give a name to your note... ✏ **').then(msg => {
- message.channel.awaitMessages(filter, {
- max: 1,
- time: 90000,
- errors: ['time']
- }).then(collected => {
- collected.first().delete();
- name = collected.first().content;
- if(name == `cancel`) {
- msg.edit(`**Successfully cancelled.**`).then(hello => {hello.delete({timeout:3000})})
- }else{
- if(name.length > 18 || name.length < 3) {
- msg.edit(`**The length of the name shouldn\'t be shorter than \`3\` or longer than \`18\`.**`).then(msg => {msg.delete({timeout:5000})})
- }else{
- msg.edit(`📝 **| Now, Type your note... ✏**`).then(msg => {
- message.channel.awaitMessages(filter, {
- max: 1,
- time: 90000,
- errors: ['time']
- }).then(collected => {
- collected.first().delete();
- note = collected.first().content;
- if(note == `cancel`) {
- msg.edit(`**Successfully cancelled.**`).then(hello => {hello.delete({timeout:3000})})
- }else{
- msg.edit(`✅ **| Successfully saved your note /n ID: ${ID}**`)
- Notes[`${message.author.id}-${ID}`] = {
- ID: ID,
- NAME: name,
- DATE: moment(message.createdTimestamp).format ('DD/MM/YYYY hh:mm'),
- MSG: note
- }
- fs.writeFile('./Notes.json', JSON.stringify(Notes), (err) => {
- if (err) console.error(err);
- })
- }
- })
- })
- }
- }
- })
- })
- }
- })
- client.on('message', message => {
- if(message.content.startsWith(prefix + 'myNote')) {
- const args = message.content.slice(prefix.length).split(/ +/)
- let id = args[1]
- if(!id) return message.reply(`Usage ${prefix}myNote <Note_ID>`)
- let syntax = `${message.author.id}-${id}`
- let note = Notes[syntax]
- if(!note) return message.reply("Wrong ID")
- let noteEmbed = {
- color: 0x5e5e5e,
- author: {
- name: `${note.NAME}`,
- icon_url: "https://i.top4top.io/p_1822u2too1.jpg"
- },
- description: note.MSG,
- footer: {
- text: `ID: ${note.ID}, Date: ${note.DATE}`,
- icon_url: "https://i.top4top.io/p_1822u2too1.jpg"
- },
- }
- message.channel.send({ embed: noteEmbed })
- }
- }) //MEWO TOXIC CODES
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement