1.4.8 • Published 4 years ago

roye.js v1.4.8

Weekly downloads
4
License
ISC
Repository
-
Last release
4 years ago

Newest Feature

convertMs Converts milliseconds to seconds/minutes/hours/days/weeks/years.

How to Use:

const { convertMs } = require('roye.js');
let ms = 30000;
let converted = convertMs(ms);
console.log(converted); // logs 30s;

messageCollector: Makes message collecting easier.

  • multiMsg(message, array, numberOfMsgs, collector, number): - Helps you with multi message collecting.

getRole: You can fetch a role by mentioning, by their name, or by their ID.

getMember: You can fetch a member by mentioning, by their username, or by their user ID.

getChannel: You can fetch a channel by mentioning, by their name, or by their ID.

formatDate: Format/Shorten a date.

promptMessage: Send a verification message.

getRandom - Properties:

  • .number(num1, num2): Get a random number between two numbers.
  • .member(membersObject): Get a random member from the guild.
  • .role(rolesObject): Get a random role in the guild.
  • .channel(channelsObject): Get a random channel in the guild(text);

Command: npm install roye.js

const { Client } = require('discord.js');
// Initialize the Discord.js Client instance
const client = new Client();
const { getMember, getRole, formatDate, promptMessage } = require('roye.js');

// Ready event fires when the Discord.js client is ready.
// Use once so it only fires once.
client.once('ready', () => {
  console.log(`${client.user.username} is online!`);
});

client.on('message', async (message) => {

  if(message.content === "?test"){

    const args = message.content.split(" ");

    if(!args) return message.channel.send("Please specify a user.");

    const member = getMember(message, args.join(" ")); // getRole function is used in the same way.

    if(!member) return message.channel.send("Specified member was not found.");

    const date = formatDate(member.joinedAt);

    message.channel.send("Verification Message").then(async msg => {

          const emoji = await promptMessage(msg, message.author, 30, ["✅", "❌"]);

          if(emoji === "✅"){
          message.channel.send(`Member: ${member}\nJoin Date: ${date}`)
          }else if(emoji === "❌"){
            message.channel.send("User Cancelled Verification.")
          }
        });
     }else if(message.content === "?test2"){
       let array = [
        "This is the prompt message. `Example`; Tell me about yourself. You have 2 minutes till your time expires.",
        "This is the response message. `Example`: what is your age?",
        "This is another response message. `Example`: What are your hobbies?",
        "This is can be the last response message. `Example`: Anything else we should know?"
      ]

      await message.channel.send(array[0]);// sending the prompt message in the array.
      let collected = 0;
      const filter = m => m.author.id === message.author.id;
      const collector = message.channel.createMessageCollector(filter, {time: 60000});
       collector.on('collect', (message) => {
       collected++;
       messageCollector.multiMsg(message, array, 3, collector, collected);
       // message -  the message object.
       // array - the array of messages.
       // 3 - the amount of messages to collect.
       // collector - the message collector.
       // collected - the amount of messages collected counter. THIS SHOULD BE SET TO ZERO.
   });

   collector.on('end', collected => {

     message.channel.send(collected.size + " Messages Collected.")

     });
     }
});

client.login('token');

More Updates Will Be Coming Soon! Keep an eye out!

1.4.8

4 years ago

1.4.7

4 years ago

1.4.6

4 years ago

1.4.5

4 years ago

1.4.4

4 years ago

1.4.3

4 years ago

1.4.2

4 years ago

1.4.1

4 years ago

1.4.0

4 years ago

1.3.9

4 years ago

1.3.7

4 years ago

1.3.6

4 years ago

1.3.8

4 years ago

1.3.5

4 years ago

1.3.4

4 years ago

1.3.3

4 years ago

1.3.2

4 years ago

1.3.1

4 years ago

1.3.0

4 years ago

1.2.9

4 years ago

1.2.0

4 years ago

1.2.8

4 years ago

1.2.7

4 years ago

1.0.9

4 years ago

1.2.6

4 years ago

1.0.8

4 years ago

1.2.5

4 years ago

1.0.7

4 years ago

1.2.4

4 years ago

1.2.3

4 years ago

1.2.2

4 years ago

1.2.1

4 years ago

1.0.6

4 years ago

1.0.5

4 years ago

1.0.4

4 years ago

1.0.3

4 years ago

1.0.2

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago