Skip to content

Instantly share code, notes, and snippets.

@AriRexouium
Last active October 15, 2020 19:07
Show Gist options
  • Save AriRexouium/84152d0d49ee066c782157af615b1682 to your computer and use it in GitHub Desktop.
Save AriRexouium/84152d0d49ee066c782157af615b1682 to your computer and use it in GitHub Desktop.
Custom Selfbot Commands

Custom Selfbot Commands

This is a list of custom commands i've created for the Discord-SelfBot repo by TheRacingLion.

Credit to Respected Owners.

1. date.js - Gives you the current time relative to the location of the selfbot.

2. eval.js (Rewrote Code) - Rewrote the code to make it nicer.

3. guilds.js - Just lists your guilds with the amount of users in them.

4. hastebin.js - Sends text to hastebin.

5. leave.js - Allows you to leave the current guild.

6. oldeval.js (Requires discord.js) - The rewritten eval command my friend created for me that I ended up rewriting.

7. oldstats.js - The first command I ever created, sort of stole some of the code from the selfbot to imitate the info the console gives you on login.

8. perms.js - Gives you the permissions of yourself or another user in the current selected channel.

9. quickmention.js - QuickMentions the user in three messages and deletes the three messages. It acts as a wake up call. This is done in just a few miliseconds apart.

10. restart.js - Kills the selfbot and lets it restart. Give it about 5-10 seconds after you restart.

11. serverinfo.js - Allows you to view server info in a nice Rich Embed.

12. spam.js - As the file name implies...

13. stats.js - Gives you your stats in a nice Rich Embed.

14. uptime.js - Gives you your seflbot's uptime.

15. userinfo.js - Get a users info in a nice Rich Embed.

/*
Gives you the current time relative to the location of the selfbot.
Written by Aceheliflyer.
*/
const moment = require('moment')
module.exports = (self) => {
self.registerCommand('date', function (msg, args) {
var timeZone = new Date().toString().match(/\(([A-Za-z\s].*)\)/)[1]
this.self.createMessage(msg.channel.id, moment(msg.timestamp).format('[Today is] LLL') + ' (' + timeZone + ')')
}, {
aliases: ['time']
})
}
/*
Eval. Evaluates a snippet of JavaScript code.
Rewritten by ASIANBOI.
Rewritten (sort of) yet again by Aceheliflyer for the following:
* Modified code so it doesn't rely on discord.js for embeds. (Might not be efficient, but works.)
* Going to attempt at adding a fallback if you don't have the embedLinks permission.
*/
const util = require('util')
module.exports = (self) => {
self.registerCommand('eval', function (msg, args) {
if (msg.author.id !== this.self.user.id) return // Better safe than sorry!
if (!args[0]) return this.send(msg, 'I can\'t evaluate nothing.')
var code = args.join(' ')
try {
var evaled = eval(code) // eslint-disable-line no-eval
var type = typeof evaled
var inspect = util.inspect(evaled, {
depth: 0
})
if (evaled === null) evaled = 'null'
var sortName = null; var sortValue = null
if (evaled instanceof Object) {
sortName = 'Inspect'
sortValue = '```js\n' + inspect.toString().replace(this.self.token, 'REDACTED').replace(this.self.user.email, 'REDACTED') + '\n```'
} else {
sortName = 'Type'
sortValue = '```js\n' + type + '\n```'
}
// Evaluation Success
this.embed(msg, {
author: { name: this.self.user.username, icon_url: this.self.user.avatarURL },
title: 'Selfbot Javascript Evaluation Complete!',
footer: { text: `${this.self.user.username}'s Selfbot`, icon_url: this.self.user.avatarURL },
timestamp: new Date(),
fields: [
{
'name': 'Code',
'value': '```js\n' + clean(code) + '\n```',
'inline': false
},
{
'name': 'Result',
'value': '```js\n' + clean(evaled.toString().replace(this.self.token, 'REDACTED').replace(this.self.user.email, 'REDACTED')) + '\n```',
'inline': false
},
{
'name': sortName,
'value': sortValue,
'inline': false
}
],
color: 0x00FF00
}).catch(err => {
this.log.err(err, 'Eval'); this.send(msg, 'There was an error, check console.')
})
} catch (err) {
// Evaluation Error
this.embed(msg, {
author: { name: this.self.user.username, icon_url: this.self.user.avatarURL },
title: 'Error in Selfbot Javascript Evaluation!',
footer: { text: `${this.self.user.username}'s Selfbot`, icon_url: this.self.user.avatarURL },
timestamp: new Date(),
fields: [
{
'name': 'Code',
'value': '```js\n' + clean(code) + '\n```',
'inline': false
},
{
'name': 'Error',
'value': '```LDIF\n' + clean(err.message) + '\n```',
'inline': false
}
],
color: 0xFF0000
}).catch(err => {
this.log.err(err, 'Eval')
this.send(msg, 'There was an error, check console.')
})
}
}, {
perms: ['embedLinks']
})
}
function clean (text) {
if (typeof (text) === 'string') {
return text.replace(/`/g, '`' + String.fromCharCode(8203)).replace(/@/g, '@' + String.fromCharCode(8203))
} else {
return text
}
}
/*
Lists all the guilds you are in.
Written by Aceheliflyer
*/
module.exports = (self) => {
self.registerCommand('guilds', function (msg, args) {
if (this.self.guilds.size === 0) return this.send(msg, 'You need to be in at least one server... ๐Ÿคฆ')
this.embed(msg, {
author: { name: this.self.user.username, icon_url: this.self.user.avatarURL },
title: '๐Ÿ“‹ Guilds',
footer: { text: `${this.self.guilds.size} guilds / ${this.self.users.size} users`, icon_url: this.self.user.avatarURL },
timestamp: new Date(),
description: this.self.guilds.map(g => `**${g.name}** (${g.memberCount} users)`).join('\n')
})
}, {
aliases: ['servers'],
perms: ['embedLinks']
})
}
/*
Sends text to hastebin.
Written by Aceheliflyer.
*/
const snekfetch = require('snekfetch')
module.exports = (self) => {
self.registerCommand('hastebin', function (msg, args) {
if (!args[0]) return this.send(msg, 'I can\'t send nothing to hastebin.')
hasteBin(args.join(' ')).then(m => {
this.send(msg, m)
}).catch(err => {
this.log.err(err, 'Hastebin'); this.send(msg, 'There was an error, check console.')
})
})
}
async function hasteBin (code = '') {
let h = await snekfetch
.post('https://hastebin.com/documents').send(code).catch(err => { this.log.err(err, 'Hastebin') })
const url = `http://hastebin.com/${h.body.key}`
return url
}
/*
Allows you to leave the current guild.
Written by Aceheliflyer
*/
module.exports = (self) => {
self.registerCommand('leave', function (msg, args) {
if (self.user.id === msg.channel.guild.ownerID) return this.send(msg, `You cannot leave this guild!`)
var leaveDelay = 1000 // I don't recommend setting this lower than 1 second or it wil cause your selfbot to throw a 404 error and your message won't get deleted.
setInterval(function () {
msg.channel.guild.leave().catch((err) => { this.log.err(err, 'Leave') })
}, leaveDelay)
this.log.warn(`Left server ${msg.channel.guild.name}!`, `Leave`)
}, {
noPms: true
})
}
/*
Eval. Evaluates a snippet of javascript code.
Rewritten by ASIANBOI.
Edit by Aceheliflyer for standard.js format and fixed a few bugs.
*/
const util = require('util')
const Discord = require('discord.js')
module.exports = (self) => {
self.registerCommand('oldeval', function (msg, args) {
if (msg.author.id !== this.self.user.id) return // Better safe than sorry!
var code = args.join(' ')
var embed = new Discord.RichEmbed()
try {
var evaled = eval(code) // eslint-disable-line no-eval
var type = typeof evaled
var insp = util.inspect(evaled, {
depth: 0
})
if (evaled === null) evaled = 'null'
// Evaluation Success
embed.setColor(0x00FF00)
.setAuthor(this.self.user.username, this.self.user.avatarURL)
.setTitle('Selfbot Javascript Evaluation Complete!')
.setFooter(`${this.self.user.username}'s Selfbot`, this.self.user.avatarURL)
.setTimestamp()
.addField('Code', '```js\n' + clean(code) + '```')
.addField('Result', '```js\n' + clean(evaled.toString().replace(this.self.token, 'REDACTED').replace(this.self.user.email, 'REDACTED')) + '```')
if (evaled instanceof Object) {
embed.addField('Inspect', '```js\n' + insp.toString().replace(this.self.token, 'REDACTED').replace(this.self.user.email, 'REDACTED') + '```')
} else {
embed.addField('Type', '```js\n' + type + '```')
}
this.send(msg, { content: '', embed: embed })
} catch (err) {
// Evaluation Error
embed.setColor(0xFF0000)
.setAuthor(this.self.user.username, this.self.user.avatarURL)
.setTitle('Error in Selfbot Javascript Evaluation!')
.setFooter(`${this.self.user.username}'s Selfbot`, this.self.user.avatarURL)
.setTimestamp()
.addField('Code', '```js\n' + clean(code) + '```')
.addField('Error', '```LDIF\n' + clean(err.message) + '```')
this.send(msg, { content: '', embed: embed })
.catch(error => console.log(error.stack))
}
}, {
perms: ['embedLinks']
})
}
function clean (text) {
if (typeof (text) === 'string') {
return text.replace(/`/g, '`' + String.fromCharCode(8203)).replace(/@/g, '@' + String.fromCharCode(8203))
} else {
return text
}
}
/*
The first command I ever created, sort of stole some of the code from the selfbot to imitate the info the console gives you on login.
Written by Aceheliflyer.
*/
module.exports = (self) => {
self.registerCommand('oldstats', function (msg, args) {
if (self.guilds.size === 0) return this.send(msg, 'This command requires you to be in at least one guild to work with the best accuracy.')
var guildList = null
guildList = this.self.guilds.map(g => g)
guildList = guildList[~~(Math.random() * guildList.length)]
var statsUser = guildList.members.get(this.self.user.id)
this.send(msg, [
`[===================================]`,
`| Logged in as ${this.self.user.username}`,
`| Your Discord status is "${statsUser.status}". Current stats:`,
`| - ${self.guilds.size} servers (${Object.keys(self.channelGuildMap).length} channels) (${self.users.size} users)`,
`| - ${self.relationships.size} friends (${self.relationships.filter(r => r.status !== 'offline').length} online)`,
`[===================================]`
].join('\n'))
})
}
/*
Gives you the permissions of yourself or another user in the current selected channel.
Written by Aceheliflyer.
Usage:
-perms -me // GIves you your own permissions.
-perms <name/id/mention> // Gives you the permissions of someone else.
Aliases:
-permissions
*/
module.exports = (self) => {
self.registerCommand('perms', function (msg, args) {
if (!args[0]) return this.send(msg, 'Need to specify a name, an ID or mention the user.\nUse `-perms -me` To get your own permissions.')
var selectedUser = null
if (/-me/.test(args[0])) {
selectedUser = msg.author
} else {
selectedUser = this.findMember(msg, args[0])
if (!selectedUser) return this.send(msg, 'That is not a valid guild member. Need to specify a name, an ID or mention the user.\nUse `-perms -me` To get your own permissions.')
}
var userPerms = msg.channel.permissionsOf(selectedUser.id).json
var ifMFA = null
if (msg.channel.guild.mfaLevel === 1) {
ifMFA = 'has 2FA enabled'
} else {
ifMFA = 'doesn\'t have 2FA enabled'
}
this.embed(msg, {
author: { name: this.self.user.username, icon_url: this.self.user.avatarURL },
title: `${selectedUser.username}'s Permissions`,
footer: {
text: '53-bit Integer: ' + msg.channel.permissionsOf(selectedUser.id).allow,
icon_url: selectedUser.avatarURL
},
timestamp: new Date(),
fields: [
{
'name': 'General Permissions',
'value': [
'```diff',
`${userPerms.administrator}administrator*`,
`${userPerms.viewAuditLogs}viewAuditLogs`,
`${userPerms.manageGuild}manageGuild*`,
`${userPerms.manageRoles}manageRoles*`,
`${userPerms.manageChannels}manageChannels*`,
`${userPerms.kickMembers}kickMembers*`,
`${userPerms.banMembers}banMembers*`,
`${userPerms.createInstantInvite}createInstantInvite`,
`${userPerms.changeNickname}changeNickname`,
`${userPerms.manageNicknames}manageNicknames`,
`${userPerms.manageEmojis}manageEmojis`,
`${userPerms.manageWebhooks}manageWebhooks*`,
'```'
].join('\n').replace(/true/g, '+').replace(/undefined/g, '-'),
'inline': true
},
{
'name': 'Text Permissions',
'value': [
'```diff',
`${userPerms.readMessages}readMessages`,
`${userPerms.sendTTSMessages}sendTTSMessages`,
`${userPerms.embedLinks}embedLinks`,
`${userPerms.readMessageHistory}readMessageHistory`,
`${userPerms.externalEmojis}externalEmojis`,
`${userPerms.sendMessages}sendMessages`,
`${userPerms.manageMessages}manageMessages*`,
`${userPerms.attachFiles}attachFiles`,
`${userPerms.mentionEveryone}mentionEveryone`,
`${userPerms.addReactions}addReactions`,
'```'
].join('\n').replace(/true/g, '+').replace(/undefined/g, '-'),
'inline': true
},
{
'name': 'Voice Permissions',
'value': [
'```diff',
`${userPerms.voiceConnect}voiceConnect`,
`${userPerms.voiceMuteMembers}voiceMuteMembers`,
`${userPerms.voiceMoveMembers}voiceMoveMembers`,
`${userPerms.voiceSpeak}voiceSpeak`,
`${userPerms.voiceDeafenMembers}voiceDeafenMembers`,
`${userPerms.voiceUseVAD}voiceUseVAD`,
'```'
].join('\n').replace(/true/g, '+').replace(/undefined/g, '-'),
'inline': true
},
{
'name': 'Note:',
'value': '**\\* These permissions require the owner account to use [two-factor authentication](http://discordapp.com/developers/docs/topics/oauth2#twofactor-authentication-requirement) when used on a guild that has server-wide 2FA enabled.**\n\n*This server ' + ifMFA + '.*',
'inline': false
}
],
color: 0x7289DA
})
}, {
noPms: true,
aliases: ['permissions'],
perms: ['embedLinks']
})
}
/*
QuickMentions the user in three messages and deletes the three messages. It acts as a wake up call. This is done in just a few miliseconds apart.
Written by Aceheliflyer.
*/
module.exports = (self) => {
self.registerCommand('quickmention', function (msg, args) {
if (!args[0]) return this.send(msg, 'Need to specify a name, an ID or mention the user.')
var user = this.findMember(msg, args[0])
if (!user) return this.send(msg, 'That is not a valid guild member. Need to specify a name, an ID or mention the user.')
var messageAmount = 3 // I don't recommend setting this above three, it could piss off the user and the devs over at Discord.
for (var i = 0; i < messageAmount; i++) {
this.send(msg, `<@${user.id}>`).then(m => m.delete())
}
}, {
aliases: ['qm']
})
}
/*
Exits the selfbot and lets it restart. Give it about 5-10 seconds after you restart. (Could depend on how many commands you have.)
Written by Aceheliflyer.
*/
module.exports = (self) => {
self.registerCommand('restart', function (msg, args) {
if (msg.author.id !== this.self.user.id) return
this.log.warn(msg.author.username + ' requested restart! Restarting...', `Restart`); this.send(msg, 'Restarting...')
setInterval(function () {
process.exit().catch((err) => { this.log.err(err, 'Restart'); this.send(msg, `There was an error, check console.`) })
}, 3000)
})
}
/*
Allows you to view server info in a nice Rich Embed.
Written by Aceheliflyer.
*/
const moment = require('moment')
module.exports = (self) => {
self.registerCommand('serverinfo', function (msg, args) {
var ownerInfo = msg.channel.guild.members.get(msg.channel.guild.ownerID)
var notificationSettings = [
'All Messages',
'Only **@mentions**'
]
var verifyLevel = [
'**None**\n(Unrestricted)',
'**Low**\n(Must have verified email on account)',
'**Medium**\n(Must be registered on Discord for longer than 5 minutes)',
'**High**\n(Must be a member of the server for longer than 10 minutes)',
'**Very High**\n(Must have a verified phone number)'
]
var explicitLevel = [
'**Level 1**\n(Don\'t scan any messages)',
'**Level 2**\n(Scan messages from members without a role)',
'**Level 3**\n(Scan all messages.)'
]
var mfaRequirement = null; var isLocked = null
if (msg.channel.guild.mfaLevel === 1) {
mfaRequirement = 'True'; isLocked = '๐Ÿ”’'
} else {
mfaRequirement = 'False'; isLocked = '๐Ÿ”“'
}
var totalUsers = msg.channel.guild.members.filter(r => r.bot !== true)
var onlineUsers = totalUsers.filter(r => r.status !== 'offline')
var offlineUsers = totalUsers.filter(r => r.status === 'offline')
var totalBots = msg.channel.guild.members.filter(r => r.bot !== false)
var onlineBots = totalBots.filter(r => r.status !== 'offline')
var offlineBots = totalBots.filter(r => r.status === 'offline')
var afkInfo = null; var afkName = null; var afkID = null; var afkTimeout = null
if (msg.channel.guild.afkChannelID !== null) {
afkName = `***(Coming... Maybe, eh. Don't count on it.)***`
afkID = msg.channel.guild.afkChannelID
if (msg.channel.guild.afkTimeout === 60) { afkTimeout = '1 minute' }
if (msg.channel.guild.afkTimeout === 300) { afkTimeout = '5 minutes' }
if (msg.channel.guild.afkTimeout === 900) { afkTimeout = '15 minutes' }
if (msg.channel.guild.afkTimeout === 1800) { afkTimeout = '30 minutes' }
if (msg.channel.guild.afkTimeout === 3600) { afkTimeout = '1 hour' }
afkInfo = [`Channel name: ${afkName}`, `Channel ID: ${afkID}`, `Timeout: ${afkTimeout}`].join('\n')
} else {
afkInfo = 'N/A'
}
var timeZone = new Date().toString().match(/\(([A-Za-z\s].*)\)/)[1]
var guildIcon = msg.channel.guild.iconURL !== null ? msg.channel.guild.iconURL : 'http://cdn.discordapp.com/embed/avatars/0.png'
this.embed(msg, {
author: { name: this.self.user.username, icon_url: this.self.user.avatarURL },
title: msg.channel.guild.name,
description: `Since ${moment(msg.channel.guild.createdAt).format('llll')} ${timeZone}\n(${moment(msg.channel.guild.createdAt).fromNow()})`,
footer: { text: `Server ID: ${msg.channel.guild.id}`, icon_url: guildIcon },
thumbnail: { url: guildIcon },
timestamp: new Date(),
fields: [
{
'name': '๐Ÿ”ง Owner',
'value': [
`${ownerInfo.user.username}#${ownerInfo.user.discriminator}`,
`(${ownerInfo.user.id})`,
`Status: ${ownerInfo.status}`
].join('\n'),
'inline': true
},
{
'name': '๐Ÿ“‹ Members',
'value': [
`${msg.channel.guild.memberCount} total`,
`${msg.channel.guild.members.filter(r => r.status !== 'offline').length} online`,
`${msg.channel.guild.members.filter(r => r.status === 'offline').length} offline`
].join('\n'),
'inline': true
},
{
'name': '๐Ÿ•ต Users',
'value': [
`${totalUsers.length} total`,
`${onlineUsers.length} online`,
`${offlineUsers.length} offline`
].join('\n'),
'inline': true
},
{
'name': '๐Ÿค– Bots',
'value': [
`${totalBots.length} total`,
`${onlineBots.length} online`,
`${offlineBots.length} offline`
].join('\n'),
'inline': true
},
{
'name': '๐ŸŒ Region',
'value': msg.channel.guild.region,
'inline': true
},
{
'name': '๐Ÿ“ฒ Default Notifications',
'value': notificationSettings[msg.channel.guild.defaultNotifications],
'inline': true
},
{
'name': 'โš– Verification Level',
'value': verifyLevel[msg.channel.guild.verificationLevel],
'inline': true
},
{
'name': '๐Ÿ“ฐ Explicit Content Filter',
'value': explicitLevel[msg.channel.guild.explicitContentFilter],
'inline': true
},
{
'name': isLocked + ' 2FA Requirement',
'value': mfaRequirement,
'inline': true
},
{
'name': '๐Ÿ’ค AFK Info',
'value': afkInfo,
'inline': true
}
],
color: 0x7289DA
}).catch((err) => { this.log.err(err, 'ServerInfo'); this.send(msg, 'There was an error, check console.') })
}, {
noPms: true,
aliases: ['sinfo'],
perms: ['embedLinks']
})
}
/*
As the file name implies...
Written by Aceheliflyer.
*/
module.exports = (self) => {
self.registerCommand('spam', function (msg, args) {
if (!args[0] || !/\d{1,2}/ig.test(args[0])) {
return this.send(msg, 'Please specify the number of messages to spam.')
} else {
var spamAmount = args[0]
}
if (!args[1]) {
return this.send(msg, 'I can\'t spam nothing.')
} else {
args.splice(0, 1)
var spamContent = args.join(' ')
}
for (var i = 0; i < spamAmount; i++) {
this.send(msg, spamContent)
}
})
}
/*
Gives you your stats in a nice Rich Embed.
Written by Aceheliflyer.
*/
const moment = require('moment')
module.exports = (self) => {
self.registerCommand('stats', function (msg, args) {
if (self.guilds.size === 0) return this.send(msg, 'This command requires you to be in at least one guild to work with the best accuracy.')
var ms = self.uptime
var sec = Math.floor((ms / 1000) % 60)
var min = Math.floor((ms / 1000 / 60) % 60)
var hrs = Math.floor((ms / 1000 / 60 / 60) % 24)
var day = Math.floor((ms / 1000 / 60 / 60 / 24) % 7)
var wks = Math.floor((ms / 1000 / 60 / 60 / 24 / 168) >> 0)
var secInfo = null; var minInfo = null; var hrsInfo = null; var dayInfo = null; var wksInfo = null
if (sec === 1) { secInfo = ' second ' } else { secInfo = ' seconds ' }
if (min === 1) { minInfo = ' minute, and ' } else { minInfo = ' minutes, and ' }
if (hrs === 1) { hrsInfo = ' hour, ' } else { hrsInfo = ' hours, ' }
if (day === 1) { dayInfo = ' day, ' } else { dayInfo = ' days, ' }
if (wks === 1) { wksInfo = ' week, ' } else { wksInfo = ' weeks, ' }
if (sec === 0) { sec = null; secInfo = null }
if (min === 0) { min = null; minInfo = null }
if (hrs === 0) { hrs = null; hrsInfo = null }
if (day === 0) { day = null; dayInfo = null }
if (wks === 0) { wks = null; wksInfo = null }
var uptime = wks + wksInfo + day + dayInfo + hrs + hrsInfo + min + minInfo + sec + secInfo
var timeZone = new Date().toString().match(/\(([A-Za-z\s].*)\)/)[1]
var guildList = null
guildList = this.self.guilds.map(g => g)
guildList = guildList[~~(Math.random() * guildList.length)]
var statsUser = guildList.members.get(this.self.user.id)
var finalUptime = `Been up for: **${uptime}**\n(since ${moment().subtract(self.uptime, 'ms').format('L LTS')} ${timeZone})`
var memUsage = (process.memoryUsage().heapUsed / 1024 / 1024).toFixed(2)
var userGaming = null
var infoGame = null
if (statsUser.game !== null) {
if (statsUser.game.type === 1) {
infoGame = 'Stream'
userGaming = `Streaming **[${statsUser.game.name}](${statsUser.game.url})**`
} else {
infoGame = 'Game'
userGaming = `Playing **${statsUser.game.name}**`
}
} else {
infoGame = 'Game/Stream'
userGaming = 'N/A'
}
this.embed(msg, {
author: { name: this.self.user.username, icon_url: this.self.user.avatarURL },
title: 'Selfbot Stats',
footer: { text: `${this.self.user.username}'s Selfbot`, icon_url: this.self.user.avatarURL },
thumbnail: { url: this.self.user.avatarURL },
timestamp: new Date(),
fields: [
{ 'name': '๐Ÿ•‘ Uptime', 'value': finalUptime, 'inline': false },
{ 'name': '๐Ÿ“ค Messages Sent', 'value': self.counts.msgsSent, 'inline': true },
{ 'name': '๐Ÿ“ฅ Messages Recieved', 'value': self.counts.msgsGot, 'inline': true },
{ 'name': 'โ— Mentions', 'value': self.counts.mentionsGot, 'inline': true },
{ 'name': 'โœ Keywords Logged', 'value': self.counts.msgsSent, 'inline': true },
{ 'name': 'โš” Guilds', 'value': self.guilds.size, 'inline': true },
{ 'name': '๐Ÿ“‚ Channels', 'value': Object.keys(self.channelGuildMap).length, 'inline': true },
{ 'name': '๐Ÿ’ป Users', 'value': self.users.size, 'inline': true },
{ 'name': '๐Ÿ“ฑ Status', 'value': statsUser.status, 'inline': true },
{ 'name': '๐ŸŽฎ ' + infoGame, 'value': userGaming, 'inline': true },
{ 'name': '๐Ÿ’พ Memory', 'value': memUsage + ' MB', 'inline': true },
{ 'name': '๐Ÿ“Š Version', 'value': `Node: ${process.version}\nEris: ${require('eris/package.json').version}`, 'inline': true }
],
color: 0x7289DA
}).catch((err) => { this.log.err(err, 'Stats'); this.send(msg, `There was an error, check console.`) })
}, {
perms: ['embedLinks']
})
}
/*
Gives you your seflbot's uptime.
Written by Aceheliflyer.
*/
const moment = require('moment')
module.exports = (self) => {
self.registerCommand('uptime', function (msg, args) {
var ms = self.uptime
var sec = Math.floor((ms / 1000) % 60)
var min = Math.floor((ms / 1000 / 60) % 60)
var hrs = Math.floor((ms / 1000 / 60 / 60) % 24)
var day = Math.floor((ms / 1000 / 60 / 60 / 24) % 7)
var wks = Math.floor((ms / 1000 / 60 / 60 / 24 / 168) >> 0)
var secInfo = null; var minInfo = null; var hrsInfo = null; var dayInfo = null; var wksInfo = null
if (sec === 1) { secInfo = ' second ' } else { secInfo = ' seconds ' }
if (min === 1) { minInfo = ' minute, and ' } else { minInfo = ' minutes, and ' }
if (hrs === 1) { hrsInfo = ' hour, ' } else { hrsInfo = ' hours, ' }
if (day === 1) { dayInfo = ' day, ' } else { dayInfo = ' days, ' }
if (wks === 1) { wksInfo = ' week, ' } else { wksInfo = ' weeks, ' }
if (sec === 0) { sec = null; secInfo = null }
if (min === 0) { min = null; minInfo = null }
if (hrs === 0) { hrs = null; hrsInfo = null }
if (day === 0) { day = null; dayInfo = null }
if (wks === 0) { wks = null; wksInfo = null }
var uptime = wks + wksInfo + day + dayInfo + hrs + hrsInfo + min + minInfo + sec + secInfo
var timeZone = new Date().toString().match(/\(([A-Za-z\s].*)\)/)[1]
this.send(msg, `Been up for: **${uptime}**\n(since ${moment().subtract(self.uptime, 'ms').format('L LTS')} ${timeZone})`)
})
}
/*
Get a users info in a nice Rich Embed.
Written by Aceheliflyer.
*/
const moment = require('moment')
module.exports = (self) => {
self.registerCommand('userinfo', function (msg, args) {
if (!args[0]) return this.send(msg, 'Need to specify a name, an ID or mention the user.')
var user = this.findMember(msg, args[0])
if (!user) return this.send(msg, 'That is not a valid guild member. Need to specify a name, an ID or mention the user.')
var channelGuild = msg.channel.guild
var selectedUser = channelGuild.members.get(user.id)
var userGaming = null
if (selectedUser.game !== null) {
if (selectedUser.game.type === 1) {
userGaming = `Streaming **[${selectedUser.game.name}](${selectedUser.game.url})**`
} else {
userGaming = `Playing **${selectedUser.game.name}**`
}
} else {
userGaming = 'User is not playing a game.'
}
var timeZone = new Date().toString().match(/\(([A-Za-z\s].*)\)/)[1]
this.embed(msg, {
author: { name: this.self.user.username, icon_url: this.self.user.avatarURL },
title: `Information for ${selectedUser.username}${selectedUser.bot === true ? ' [BOT]' : ''}`,
description: userGaming,
footer: { text: selectedUser.username, icon_url: selectedUser.avatarURL },
thumbnail: { url: selectedUser.avatarURL },
timestamp: new Date(),
fields: [
{
'name': '๐Ÿ“‡ Username',
'value': selectedUser.username + '#' + selectedUser.discriminator,
'inline': true
},
{
'name': '๐ŸŒ ID',
'value': selectedUser.id,
'inline': true
},
{
'name': '๐Ÿ”— Nickname',
'value': selectedUser.nick !== null ? selectedUser.nick : 'N/A',
'inline': true
},
{
'name': '๐Ÿ“ฑ Status',
'value': selectedUser.status,
'inline': true
},
{
'name': '๐Ÿค– Bot',
'value': selectedUser.bot,
'inline': false
},
{
'name': '๐Ÿ”ง Account Created',
'value': `${moment(selectedUser.createdAt).format('llll')} ${timeZone} (${moment(selectedUser.createdAt).fromNow()})`,
'inline': false
},
{
'name': '๐Ÿ“ฅ Joined Guild',
'value': `${moment(selectedUser.joinedAt).format('llll')} ${timeZone} (${moment(selectedUser.joinedAt).fromNow()})`,
'inline': false
}
],
color: 0x7289DA
}).catch((err) => { this.log.err(err, 'UserInfo'); this.send(msg, 'There was an error, check console.') })
}, {
noPms: false,
aliases: ['uinfo', 'whois'],
perms: ['embedLinks']
})
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment