Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
if (!msg.content.startsWith(prefix)) {
return;
}
const [ commandName, ...args ] = msg.content.slice(prefix.length).split(/ +/g);
const command = this.commands.get(this.commandTriggers.get(commandName));
if (
!command || (
command.props.ownerOnly && msg.author.id !== process.env.BOT_OWNER_ID
)) {
return;
}
const permissions = msg.channel.guild
? msg.channel.permissionsOf(this.user.id)
: new Permission(383040); // DM channels
if (!permissions.has('sendMessages')) {
return;
}
command
._execute(msg, args)
.catch(err => {
console.error(err);
return {
title: '⚠ Something went wrong while executing this command.',
color: 0xFF0000,
description: codeblock(
err.message + (
err.body && err.body.error
);
const aws = new Aws(options);
const eris = require('eris');
const { BOT_TOKEN } = require('../config.json');
const { ROLEID } = require('../config.json');
const { CHANNELID } = require('../config.json');
const PREFIX = '$aws';
const HelpDocs =
'\n Help Docs: \n `start`: Starts the server \n `stop`: Stops the server \n `status`: Returns the server status ';
// Create a Client instance with our bot token.
const bot = new eris.Client(BOT_TOKEN);
// When the bot is connected and ready, log to console.
bot.on('ready', () => {
console.log('Connected and ready.');
});
const commandHandlerForCommandName = {};
commandHandlerForCommandName['start'] = (msg, args) => {
startStop(true, msg);
};
commandHandlerForCommandName['stop'] = (msg, args) => {
startStop(false, msg);
};
commandHandlerForCommandName['help'] = (msg, args) => {
// Get the required shit together
const Discord = require('eris');
const config = require('config');
const { commands } = require('./cogs');
const handler = require('./handler');
const botlist = require('./botlist');
const r = require('./../db');
const client = new Discord.Client(config.get('api').discord.token, {
maxShards: config.get('discord').shards
});
const prefixes = config.get('discord').prefix.user;
client.once('ready', () => {
console.log('All shards are online');
// Set up currently playing game
client.editStatus('online', {
name: `${prefixes[0]} help`,
type: 0
});
setInterval(() => {
botlist(client);
const Eris = require("eris");
// Replace BOT_TOKEN with your bot account's token
const bot = new Eris.CommandClient("BOT_TOKEN", {}, {
description: "A test bot made with Eris",
owner: "somebody",
prefix: "!"
});
bot.on("ready", () => { // When the bot is ready
console.log("Ready!"); // Log "Ready!"
});
bot.registerCommandAlias("halp", "help"); // Alias !halp to !help
bot.registerCommand("ping", "Pong!", { // Make a ping command
// Responds with "Pong!" when someone says "!ping"
description: "Pong!",
fullDescription: "This command could be used to check if the bot is up. Or entertainment when you're bored."
});
const Eris = require("eris");
// Replace BOT_TOKEN with your bot account's token
const bot = new Eris.CommandClient("BOT_TOKEN", {}, {
description: "A test bot made with Eris",
owner: "somebody",
prefix: "!"
});
bot.on("ready", () => { // When the bot is ready
console.log("Ready!"); // Log "Ready!"
});
bot.registerCommand("ping", "Pong!", { // Make a ping command
// Responds with "Pong!" when someone says "!ping"
description: "Pong!",
fullDescription: "This command could be used to check if the bot is up. Or entertainment when you're bored.",
reactionButtons: [ // Add reaction buttons to the command
{
emoji: "⬅",
module.exports = (db, auth, config) => {
// Create a new Eris bot client
const eris = require("eris");
process.setMaxListeners(0);
const bot = new eris.Client(auth.platform.login_token, {
disableEvents: {
MESSAGE_DELETE_BULK: true,
TYPING_START: true
},
getAllUsers: true,
maxShards: config.shard_count || 1
});
bot.isReady = false;
// Sequentially send an array
bot.sendArray = (ch, arr, i, options, callback) => {
if (i === null) {
i = 0;
}
if(i>=arr.length) {
if(callback) {
templateConf,
tokenConf,
utils: MyUtils, // use your own Utils
logger: null, // custom Logger
db: null, // custom DB Service
axonSchema: null,
guildSchema: MyGuildSchema,
};
/**
* new AxonClient(token, erisOptions, AxonOptions, modules)
*
* new Client(token, erisOptions, AxonOptions) => Modules imported in Client
*/
const client = new Eris.Client(
tokenConf.bot.token,
{
autoreconnect: true,
defaultImageFormat: 'png',
defaultImageSize: 512,
disableEveryone: true,
getAllUsers: false,
messageLimit: 100,
restMode: true,
}
);
const Bot = new Client(
client,
AxonOptions
);
// There's no good way to simulate this
const guild = this;
this.fetchAllMembers();
return new Promise((res, rej) => {
setTimeout(()=>{res(guild);}, 1000);
});
});
odg(egp, "voiceConnection", function(){return this.shard.client.voiceConnections.get(this.id);});
})(Eris.Guild.prototype);
odg(Eris.Member.prototype, "voiceChannel", function(){return this.voiceState.channelID?(this.guild.channels.get(this.voiceState.channelID)):undefined;});
odg(Eris.Message.prototype, "guild", function(){return this.channel.guild;});
odf(Eris.Message.prototype, "reply", function(content){return this.channel.send(this.author.mention + ", " + content);});
Eris.PrivateChannel.prototype.send = Eris.PrivateChannel.prototype.createMessage;
odg(Eris.Role.prototype, "members", function () {
const role = this;
return this.guild.members.filter((member) => {
return member.roles.includes(role.id);
});
});
(function (esp) {
odf(esp, "send", function(){return process.send.apply(process, arguments);});
odf(esp, "broadcastEval", function (cmd) {
return new Promise((res, rej) => {
process.send({"_sEval": cmd});
function receiver(msg) {
if (msg._sEval === cmd)
bot.on("typingStart", async (channel, user) => {
// config.typingProxy: forward user typing in a DM to the modmail thread
if (config.typingProxy && (channel instanceof Eris.PrivateChannel)) {
const thread = await threads.findOpenThreadByUserId(user.id);
if (! thread) return;
try {
await bot.sendChannelTyping(thread.channel_id);
} catch (e) {}
}
// config.typingProxyReverse: forward moderator typing in a thread to the DM
else if (config.typingProxyReverse && (channel instanceof Eris.GuildChannel) && ! user.bot) {
const thread = await threads.findByChannelId(channel.id);
if (! thread) return;
const dmChannel = await thread.getDMChannel();
if (! dmChannel) return;
bot.on('messageCreate', (msg) => {
if (! (msg.channel instanceof Eris.PrivateChannel)) return;
if (msg.author.id === bot.user.id) return;
if (blocked.indexOf(msg.author.id) !== -1) return;
// This needs to be queued as otherwise, if a user sent a bunch of messages initially and the createChannel endpoint is delayed, we might get duplicate channels
messageQueue.add(() => {
return getModmailChannel(msg.author).then(channel => {
channel.createMessage(`« **${msg.author.username}#${msg.author.discriminator}:** ${msg.content}`);
if (channel._wasCreated) {
bot.createMessage(modMailGuild.id, {
content: `@here New modmail thread: ${channel.mention}`,
disableEveryone: false,
});
msg.channel.createMessage("Thank you for your message! Our mod team will reply to you here as soon as possible.");