- isBot
- checkCommand
- hasPermission
- log
- error
- warn
- sendEmbedLog
- sendWelcomeMessage
- setActivity
- credentialFileExists
- createCredentialFile
- wait
- getFeaturedServers
const Discord = require("discord.js");
const helper = require('@dulliag/discord-helper');
helper.isBot(member: Discord.GuildMember) : void;
const Discord = require("discord.js");
const helper = require('@dulliag/discord-helper');
helper.checkCommand(message: Discord.Message, requiredPermissions: string[]) : boolean;
const Discord = require("discord.js");
const helper = require('@dulliag/discord-helper');
helper.hasPermission(member: Discord.GuildMember, requiredPermissions: string[]) : boolean;
const Discord = require("discord.js");
const helper = require('@dulliag/discord-helper');
helper.log(message: string) : void;
const Discord = require("discord.js");
const helper = require('@dulliag/discord-helper');
helper.error(message: string) : void;
const Discord = require("discord.js");
const helper = require('@dulliag/discord-helper');
helper.warn(message: string) : void;
const Discord = require('discord.js');
const client = new Discord.Client();
const helper = require('@dulliag/discord-helper');
client.on("ready" () => {
helper.setActivity(client, "Use @dulliag/discord-helper");
});
const Discord = require('discord.js');
const client = new Discord.Client();
const helper = require('@dulliag/discord-helper');
// This equals the default content
// You can use any pattern u want
const credentialContent = {
bot: {
token: "ENTER_TOKEN",
clientId: "ENTER_CLIENT_ID",
}
};
if (!helper.credentialFileExists("./credentials.json")) {
helper.error("There is no credential file given. You should create an...");
process.exit(0); // Stop the bot
}
const { bot } = require("./credentials.json");
client.on("ready" () => {
helper.setActivity(client, "Use @dulliag/discord-helper");
});
client.login(bot.token);
const Discord = require('discord.js');
const client = new Discord.Client();
const helper = require('@dulliag/discord-helper');
// This equals the default content
// You can use any pattern u want
const credentialContent = {
bot: {
token: "ENTER_TOKEN",
clientId: "ENTER_CLIENT_ID",
}
};
if (!helper.credentialFileExists("./credentials.json")) {
const success = helper.createCredentialFile(settings.credentials, credentialContent);
success
? helper.log("Credential file created!")
: helper.error("Creation of credential file failed!");
process.exit(0); // Stop the bot
}
const { bot } = require("./credentials.json");
client.on("ready" () => {
helper.setActivity(client, "Use @dulliag/discord-helper");
});
client.login(bot.token);
const Discord = require('discord.js');
const client = new Discord.Client();
const helper = require('@dulliag/discord-helper');
client.on("ready" () => {
helper.log("Bot started!");
helper.wait(10 * 1000); // wait 10s before updating the activity
helper.setActivity(client, "Use @dulliag/discord-helper");
});
NOTE: You could get client.guilds.cache instead of using helper.getFeaturedServers(client);
const Discord = require('discord.js');
const client = new Discord.Client();
const helper = require('@dulliag/discord-helper');
client.on("ready" () => {
helper.log("Bot started!");
helper.setActivity(client, "Use @dulliag/discord-helper");
helper.getFeaturedServers(client).forEach((guild) => {
helper.log("Bot is running on guild " + guild.name);
})
});
-
Increase the version using the command
npm version [major|minor|patch]
-
Make sure you are logged in
npm login
-
After this publish this package by using the
npm publish --access public
command