The Dev branch of Gydo-JS (Unstable Branch)
It will probably receive quite lots of updates, but it will be unstable. Report bugs in our Discord Server
Stable Version: Main Branch
const gydo = require("gydo.js-dev");
const bot = new gydo.config({
// change the <token here> to your bots token, same with the prefix (you can only do one prefix yet)
token: "<token here>",
prefix: "<your prefix>"
});
You will automatically have this intents:
GUILDS
GUILD_MESSAGES
Which is enough, and what is required.
Once you've completed the setup, you can run node .
(or node <filename>.js
) in your terminal to run the bot.
If you encounter any bugs, please report it to our Discord Server
Before you put any commands put:
bot.MessageDetect()
For the command to actually work
(Make sure to put it above the commands)
To create a command do:
bot.cmd({
name: "<cmd name>",
code: "<code>"
});
Every command will start with your prefix like ?ping
Example Command:
bot.cmd({
name: "ping",
code: "Pong! ({ping}ms)"
});
Functions:
{ping}
- Sends the Bot's ping
{message-author-tag}
- Sends the tag of the user who sent/ran the command
{message-author-id}
- Sends the ID of the User who ran the command
{bot-user-tag}
- Sends the tag of your Bot
{bot-user-id}
- Sends the ID of your Bot
{guildname}
- Sends the Guild's name
Args
{args;<num>}
You can replace <num>
with a number.
Example:
Code: {args;0}
Message sent by user: "!example gydo"
Output: gydo
Raw Args Output: ["gydo"]
Since this is the Dev branch, there is unfortunately, no documentation for this, yet.
Baisc Command Handler Example:
const fs = require('fs');
const commandFiles = fs.readdirSync('./commands').filter(file => file.endsWith('.js'));
for (const file of commandFiles) {
const command = require(`./commands/${file}`);
bot.cmd(command);
}
Make sure your bot has the permission to create slash commands
Simple Ping Slash Command:
bot.slashCommand.create({
name: "ping",
description: "a simple ping command",
code: "pong",
// optional
guildId: "1234567890"
});
You can also put {ping}
inside code: ""
to get the bots ping.
If you want your slash command to only be created on a specific server, then you can put the server's guild ID in guildId
If you want it so only the user who created the interaction can see it, add the property in slashCommand.create({})
: ephemeral: true
To detect the slash command:
bot.slashCommand.detect("ping")
You will have to do bot.slashCommand.detect("<slashCommandName>")
to detect the slash commands you've created, otherwise the bot will say "interaction failed"
ClientError
extends EventEmitter
const { ClientError } = require('gydo.js-dev');
const ClientErr = new ClientError();
ClientErr.on('error', error => {
console.error(error);
});
To make an embed:
You will first have to specify on what command should the embed be attached on. It'll automatically attached on a command, if you have put one, and does exist.
All things you could add in the embed's property is mentioned here:
new gydo.Embed("<any of your command name>", {
title: "Embed Title",
author: "Embed Author",
authorURL: "<some URL here>",
description: "Embed Description \n [Hyper Link](https://npmjs.com/package/gydo.js-dev/)",
footer: "Embed Footer",
// (You can add more than 2 fields)
fields: [
{
name: "First Field",
value: "First Field Value",
// Optional
inline: true
},
{
name: "Second Field",
value: "Second Field Value"
}
],
color: "RANDOM",
timestamp: true
});
bot.activity.setActivity("<status>", { type: "PLAYING" });
or a Changing Status Loop
bot.activity.loopStatus(["<status>", "another one"], 1000, { type: "PLAYING" })
It must be on an Array, otherwise it'll send an error.
The Second Argument (or the time) is in Miliseconds (1000 = 1 second), and you can't go below 1000 ms, or it'll send an error.
Status Types are:
PLAYING
, LISTENING
, WATCHING
, and STREAMING
You can also do just a normal status:
bot.activity.setUserStatus('idle');
Normal Status Types are:
idle
(Idle)
dnd
(Do not Disturb)
invisible
(Invisible)
online
(Online)
bot.guildMemberRemove({
message: "Sad to see you leave {member-tag}",
// put any message you want
channel: "<CHANNEL ID>"
});
Functions:
{member-tag}
- Returns the member's tag
{member-id}
- Returns the member's ID
{guildname}
- Returns the Guild's name
bot.guildMemberAdd({
// put any message here
message: "{member-tag} Welcome to {guildname}!",
channel: "<channel ID>"
});
Functions:
{member-tag}
- Return the member's tag
{member}
- Mentions the member that just joined
{guildname}
- Returns the Guild's name
{member-id}
- Returns the member's id
{guild-memmber-count}
- Returns the Guild's Member Count (Will Include Bots)
MessageUpdate
extends Base
Example:
bot.MessageUpdate({
channel: "<CHANNEL_ID>",
message: "<MESSAGE>"
});
Functions:
{oldMessage}
- Old Message Content before the message were updated
{newMessage}
- New Message Content after the message were updated
{message.author.id}
- Message Author's ID
{message.author.tag}
- Message Author's User Tag
{message.author.mention}
- Mentions the Message Author
{message.channel}
- the Channel the message was sent on by the author
Report the bugs on our Discord Server, and/or to our GitHub Repository.