#development
1 messages · Page 324 of 1
oops
Same
const game = new Discord.MessageCollector(message.channel, m => m.author.id === message.author.id, { time: 1000 })
game.on("end", (Collection, reason) => {
if (game.options({time: 0})) {
reason = "Test"
}
message.channel.send(reason)
})
if (game.options({time: 0})) {
^
TypeError: game.options is not a function
Where am I going wrong here?
FUCk
ask the @earnest phoenix
How can I mention myself and ping meself

jk
@earnest phoenix I made some improvements to the selfbot if you want it...
wat did u do
if you click the notification it will open the server
o

I'll send it to you one sec
not sure how I can make it notify me in discord yet...
There probably is a way but I don't know if anyone has done it yet 
loli
loli
yay
cool
how would i make it so my clever bot only responds when its mentioned
bot.on("message", async message => {
if(message.author.bot) return;
if(message.channel.type === "dm") {
clbot.write(message.content, (response) => {
message.channel.startTyping();
setTimeout(() => {
message.channel.send({embed:{
title: response.output,
color: 654456
}}).catch(console.error);
message.channel.stopTyping();
}, Math.random() * (1 - 3) + 1 * 1000);
});
}
})
message.guild.me.id I believe. Haven't tested this theory though
at least it worked after half an hour of fucking up
@topaz fjord npm i pm2 -g
it worked
🍰
Hi
is there a jimp method for changing the z index? I can't seem to find one.
i'm getting this memey error:
(node:11460) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): TypeError: undefined is not a function
(node:11460) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Nod
e.js process with a non-zero exit code.
from this code
const ytdl = require('ytdl-core')
exports.run = async (bot, message, args) => {
const vc = message.member.voiceChannel;
if(!vc) return message.channel.send("You have to be in a voice channel to play music!");
const perms = vc.permissionsFor(message.client.user);
if(!perms.has('CONNECT')) {
return message.channel.send("I can\'t connect to your voice channel, might need to edit my permissions!");
}
if (!perms.has('SPEAK')) {
return message.channel.send("I\' suppressed here, make sure I get the right perms!");
}
try {
var connection = await vc.join();
} catch(error) {
console.error(`I couldn\'t join the voice channel: ${error}`);
return message.channel.send("I couldn\'t join the voice channel!")
}
const dispatcher = connection.playStream(ytdl(args.join(" ")))
.on('end', () => {
console.log("Playback ended.");
vc.leave();
})
.on('error', error => {
console.error(error);
});
dispatcher.setVolumeLogarithmic(5 / 5);
}
@low niche What does the code do
Plays music
With user input?
I believe it might be the User Input that's 'undefined'
Returned what?
The error
Thought so
game.on('collect', message => {
if (message.content.toLowerCase() === "redeemables" || message.content.toLowerCase() === "r") {
start = "redeem"
game.stop()
}
});
if (start === "redeem") {
message.channel.send("yep")
}
Does the collector continue the code after it ends? For me it doesn't and I don't know if it's because I'm doing something wrong
async await works fine with my local version but whenever i upload to linux and try run my app there i get this
any fixes or workarounds that dont require me rewriting my entire code adding extra brackets?
node is probably outdated on your server 
hmm
but how is async correct?
nice
i updated it properly 😉
😉
@earnest phoenix so, what was the answer to my previous question?
¯_(ツ)_/¯
I don't have a Music Player so I wouldn't really know. I just figure it could be user input
Doing it
@languid dragon what version of node are you running on them?
is fixed 👀 i was running some super outdated crap
Lol sounded like it
Mhmm
Hey people
The website shows my bot is offline
Do i need to POST the status too?
no luca is just broken
wtf is this? lol https://jeff-kaplan.spies-on-my.webcam/7ce93f.png
¯_(ツ)_/¯
neither do the devs
¯_(ツ)_/¯
Hmm
hey i get an error for that says await is reserved.
the code:
if(message.content.startsWith(prefix + "ping")) {
const m = await message.channel.send("Ping?");
m.edit(`Pong! Latency is ${m.createdTimestamp - message.createdTimestamp}ms. API Latency is ${Math.round(client.ping)}ms`);
}
can someone help plz
It needs to be in an async function
await has to be inside an async function
bot.on('message', async(message) => {
if (message.content.startsWith(prefix + "ping")) {
await message.channel.send("Ping?").then(m => m.edit(`Pong! Latency is ${m.createdTimestamp - message.createdTimestamp}ms. API latency is ${Math.trunc(client.ping)}ms!`));
}
});
@vital lark that doesn't make alot of sense

I agree
await tonkku.nudes()
i think it threw a timeout exception
¯_(ツ)_/¯
what does that mean
you don't know what a shrug means?
@timid bolt
-botinfo @timid bolt
smh
i'm getting this error:
TypeError: undefined is not a function
at Map.forEach (native)
at Client.bot.on (c:\Users\no-username-here\Stuff\PowerPlug\bot.js:33:35)
at emitOne (events.js:115:13)
at Client.emit (events.js:210:7)
at MessageCreateHandler.handle (c:\Users\no-username-here\Stuff\PowerPlug\node_modules\discord.js\src\client\websocket\packets\handlers\MessageCreate.js:9:34)
at WebSocketPacketManager.handle (c:\Users\no-username-here\Stuff\PowerPlug\node_modules\discord.js\src\client\websocket\packets\WebSocketPacketManager.js:102:65)
at WebSocketConnection.onPacket (c:\Users\no-username-here\Stuff\PowerPlug\node_modules\discord.js\src\client\websocket\WebSocketConnection.js:325:35)
at WebSocketConnection.onMessage (c:\Users\no-username-here\Stuff\PowerPlug\node_modules\discord.js\src\client\websocket\WebSocketConnection.js:288:17)
at WebSocket.onMessage (c:\Users\no-username-here\Stuff\PowerPlug\node_modules\ws\lib\EventTarget.js:103:16)
at emitTwo (events.js:125:13)
from this code: https://hastebin.com/dasihekofa.js

@tawny lava npm i uws
@low niche it’s this
const dispatcher = connection.playStream(ytdl(args[1]))
oh ok
the “connection” variable is trying to be used, but it’s being defined in a block scope
what is it
pft, saying what the question is would be too easy.
~help
Yes?
@vital lark
msg.channel.send(msg.content.replace (prefix +
'say ', '');
},```
Why does it crash my bot?
You're using d.js?
node.js
Ye
you have unneeded spaces
Where
msg.channel.send(`${msg.content.replace(prefix, '')} say`)
That's all the info I can get from your snip
What's the error message?
Websocket stuff
It dont say it crashes it just shows kike all the true and null atuff
Can you copy it here?
Not really helpful screenshot 
Well i dont have discord on my laptop

<help
anyone knows what i did wrong? it just logs undefined and when i remove the filters its data of undefined
snekfetch.get('https://www.reddit.com/r/emojipasta.json?sort=top&t=day&limit=500').then(response => {
let pastas = response.body.data.children.filter(post => post.data.is_video === false && post.data.over_18 === false);
let pasta = pastas[(Math.floor(Math.random() * 400) + 10)]
console.log(pasta)
});```
await
no
const msg = await msg.channel.send('...');
msg.edit('...');
(depending on your library)
i have discord.js
ok thx
const msg = await msg.channel.send("hello");
msg.edit("bye");```
this
yeah?


if(command === "ping") {
// Calculates ping between sending a message and editing it, giving a nice round-trip latency.
// The second ping is an average latency between the bot and the websocket server (one-way, not round-trip)
const m = await message.channel.send("Ping?");
m.edit(`Pong! Latency is ${m.createdTimestamp - message.createdTimestamp}ms. API Latency is ${Math.round(client.ping)}ms`);
}```
do u know why this doesnt work
css codeblock for js
You're using the wrong Codeblock for your code
what is codeblock
It's written by an autsitic
who is he
ok

what u mean
same
You need to be in an async function
how
🤦
/*stuff*/ level + 1)
Sometimes outputs
Forbidden ℨBOT - Today at 10:04 PM
@Can I change my variable?, Correct! Leveled Up To: 31
and only sometimes
Use parseInt, it will be adding strings.
Yep just did that
hey
i get this error dont know why ```js
Parsing error: The keyword 'await' is reserved (Fatal)
it's still not in an async function
ok
hey
wait
u know why this no work
client.on("message", async message => {
if(message.author.bot) return;
if(message.content.indexOf(config.prefix) !== 0) return;
const args = message.content.slice(config.prefix.length).trim().split(/ +/g);
const command = args.shift().toLowerCase();
anyone know why this doesnt work
what's the error
o
wait
i will get it
Parsing error: Unexpected token message (Fatal)```
code
const Discord = require("discord.js");
const client = new Discord.Client();
const config = require("./config.json");
client.on("ready", () => {
console.log("I'm Online'");
});
client.on("message", async message => {
if(message.author.bot) return;
if(message.content.indexOf(config.prefix) !== 0) return;
const args = message.content.slice(config.prefix.length).trim().split(/ +/g);
const command = args.shift().toLowerCase();
)};
client.login(config.token);```
@bitter sundial
what
if(message.content.indexOf(config.prefix) !== 0) return;
)<<<<<<<<<<<<<<<<<<<<<<<<<<<<< // what in gods name is this
above client.login but under const command
ok
const command = args.shift().toLowerCase();
)};
client.login(config.token);```
like this
});
now.
object lizard
@tawny lava
i have unexpected token message
error
parsing error
update it to the latest
you need anything above 7
8.5.0 is latest
yes...
is it safe to get upvotes every 10 minutes or should I change that to more?
Yea its ok to do that as most people post stats to the website every 5/10/15/30 mins atleast its not 10 seconds lol
okay
i need help kindsa
so right now my bot
checks if u have a certain perm
in order to do a command
and the perm is like logically linked
but i dont knew if thats any good
as far as customizing the bot
kek
aye
const Discord = require("discord.js");
const settings = require("../settings.json");
const serverroles = require("../groups.json");
module.exports.run = (client, message, args) => {
const noperms = new Discord.RichEmbed()
.setTitle('You need at least one of the following Roles.')
.setDescription(serverroles.purge)
.setColor(0xFF0000)
if(!message.member.roles.some(r=>`${serverroles.purge}`.includes(r.name)) ) return message.channel.send(noperms);
if (!message.guild.member(client.user).hasPermission('MANAGE_MESSAGES')) return message.reply('I cannot delete messages.');
var messagecount = message.content.substring(`${settings.prefix.length + 8}`,999)
if (messagecount == '') return message.reply(`Wrong usages, use **${settings.prefix}purge <amount>**`);
if (messagecount < 2) return message.reply(`It need to be at least 2 messages.`);
if (messagecount > 100) return message.reply(`I cannot delete more then 100 messages.`);
message.channel.fetchMessages({limit: messagecount}).then(messages => message.channel.bulkDelete(messages));
message.reply(`I have deleted ${messagecount} messages.`)
}
module.exports.help = {
name: "purge"
}```
error?
You shouldn't have to fetch messages anymore
^^
message.channel.bulkDelete(${args});
.channel.bulkDelete(messages)
Solace, you okay?
???
.channel.bulkDelete(args)
wat
You okay?
args being w/e you want
as in, a number
You don't need inline variable
why put it in a inline string
lol
😂
I just pasted my old code
lmao
lmao
but ya
just put w/e
template literals for everything
is a habit of mine
I still do it today
tbh
this work, part of the code if (messagecount > 100) return message.reply(`I cannot delete more then 100 messages.`); message.channel.bulkDelete(messages)); message.reply(`I have deleted ${messagecount} messages.`)
cmds.purge = {
name: 'purge',
help: 'allow staff to purge chat',
func: (msg, lc, prefix, raw, manager, embedPerms, serverManageRole) => {
if (manager || msg.guild.members.get(msg.author.id).hasPermission('MANAGE_GUILD')) {
let amount = Number(msg.content.split(" ")[1]);
if (amount && !isNaN(amount)) {
if (msg.guild.members.get(client.user.id).hasPermission('MANAGE_MESSAGES')) {
if (amount >= 2 && amount <= 100) {
msg.channel.bulkDelete(amount)
OFC CLOSING
lol
You should be able to work with that
no imma stay with the code i have
module.exports.run = (client, message, args) => {
const noperms = new Discord.RichEmbed()
.setTitle('You need at least one of the following Roles.')
.setDescription(serverroles.purge)
.setColor(0xFF0000)
if(!message.member.roles.some(r=>`${serverroles.purge}`.includes(r.name)) ) return message.channel.send(noperms);
if (!message.guild.member(client.user).hasPermission('MANAGE_MESSAGES')) return message.reply('I cannot delete messages.');
var messagecount = message.content.substring(`${settings.prefix.length + 8}`,999)
if (messagecount == '') return message.reply(`Wrong usages, use **${settings.prefix}purge <amount>**`);
if (messagecount < 2) return message.reply(`It need to be at least 2 messages.`);
if (messagecount > 100) return message.reply(`I cannot delete more then 100 messages.`);
message.channel.bulkDelete(NUMBER);
message.reply(`I have deleted ${messagecount} messages.`)
}
Should work
That is your code
just modified
thx
I edited it
I left the messages part in there
So where it says NUMBER you can change that to what your number is from your command
you took out the const part on top
I just gave the module.exports part
then put it back
that's why
lmao
ahh kk
I only copied the command run exports
kk
comes up as a error
What is the error?
wait thats on me
Okay
me and my friend use diffrent things for json files, he uses confi, i use settings
All good
That's another issue
That's your command handler
^^
let props = require(`./commands/${f}`);
//console.log(`${i + 1}: ${f} loaded!`)
client.commands.set(props.help.name, props);
});
console.log('-------------------------------')
console.log(`Loaded ${jsfiles.length} commands!`)
});
right here
is where the problem is
Oh dear
So you need to check on all your commands to make sure help is defined
oh
Somewhere it's not
I'm gonna need a beer with this rahman
You probably forgot to add the module.exports.help back into your purge command
mhm
👍🏻

dosent work
Error?
What version of discord.js are you using btw?
Discord.version
console.log that somewhere
That is your checks
The checking you're doing before purging
Let me look over them
Let me look over your code you sent before again, give me a second.
It seems that's on your checking for the messagecount == ''
So maybe your messagecount variable is not defined?
You might wanna log that to console to test and see if it is getting the number you want
how would i do that
So in your code right above your if statement for the if (messagecount == '') add console.log(messagecount)
It you don't know how to log to console why are you tryna make a bot
¯_(ツ)_/¯
Its called debugging
ik how to log console i dident know what he wanted me to log i was confused
nothing gets logged
Then you're splitting your varaiables wrong to get the number
fml
this is the part you need to see if you're doing right.
var messagecount = message.content.substring(`${settings.prefix.length + 8}`,999)
What was that error?
messages is not defined
Did you change the 8 to a 6?
yes
message.channel.bulkDelete(messages);
message.reply(I have deleted ${messagecount} messages.);
change the messages to messagecount
Okay now you can remove the console.log if you want, that is a good thing to do for debugging.
@ebon apex how did you make the total commands
Everytime a command is run I add one number to a field in my database. Same with message.
oh a database
dangit
i gtg but if someone could tell me how to make a toggle command for join/leave msges that would be great, cause i know not everyone likes that
tell me in dms
i get an error Parsing error: Unexpected token => (Fatal) for this code:
client.on("message", async(message) => {
if (message.content.startsWith(prefix + "ping")) {
await message.channel.send("Ping?").then(m => m.edit(`Pong! Latency is ${m.createdTimestamp - message.createdTimestamp}ms. API latency is ${Math.trunc(client.ping)}ms!`));
}
});
can someone help
Why are you using “await” if you’re using .then on it
remove the “await “ in front of msg.channel.send
Other than that, you’re good
¯_(ツ)_/¯
It means it is unsure
@shrewd field run node -v
ok
Forbidden ℨBOT - Today at 10:43 PM
Pong! Latency is 236ms. API latency is 235ms!(edited)
You must have done something wrong somewhere else. It looks fine to me
how
how what
i removed await
just run node -v in a terminal
ok
that usually means your node is outdated
i got this v8.5.0
thonk
Well somewhere else is probably causing the Error. God knows where. What does the error specifically say?
Does it say the line it's coming from
50:37
And that code you sent is from that line
no
it is 50 to 54
He did Aeth
Deni - Today at 10:45 PM
i got this v8.5.0
i did aeth
o
I should probably update my node.js lol
send the full bot script
don't send tokens
of course
hastebin it and send it here
Remove Async. You won't need it
oh no 🤦
where
lel
yep
You only need 1 of each
No
no
👀
what is the other way
Put it in the same event
if(command = "command"){
}
if(command = "othercommand"){
}`
if (command) {
} else if (other command) {
} else /*not command*/ {
}
its like coders basics man
@uncut slate Better?
Most likely the multiple amounts of the same event
so i need to change them
Yep
But you never know
it's kind of really dumb
It said the Error was the ping command. So whatever it is. It's probably caused by it
its common sense and logic
ok
the client guild things can be in the ready using what
if(command = "command"){
}
if(command = "othercommand"){
}```
You just move it to the same Event. Nothing needed really
like how
That's for your message event. That's how you make more commands.
ok
client.on("message", message => {
if (message.author === client.user) return;
if (message.content.startsWith(prefix + "ping")) {
message.reply("pong!");
}
if (message.content.startsWith(prefix + "OTHERCOMMAND")) {
message.reply("another command!");
}
});
for the gulid
client.on("ready", () => {
console.log("I\'m Online\nI\'m Online");
});
client.on("ready", () => {
client.user.setGame("In 10 servers | 4/10 guilds| use ..help");
});
client.on("ready", () => {
// This event will run if the bot starts, and logs in, successfully.
console.log(`Bot has started, with ${client.users.size} users, in ${client.channels.size} channels of ${client.guilds.size} guilds.`);
// Example of changing the bot's playing game to something useful. `client.user` is what the
// docs refer to as the "ClientUser".
client.user.setGame(`on ${client.guilds.size} servers`);
});
This should all be in the same Ready event
👍
and the remove gulid in the same
What do you mean?
i mean
oh
@earnest phoenix why the two on ready events lol
client.on("guildCreate", guild => {
// This event triggers when the bot joins a guild.
console.log(`New guild joined: ${guild.name} (id: ${guild.id}). This guild has ${guild.memberCount} members!`);
client.user.setGame(`on ${client.guilds.size} servers`);
});
client.on("guildDelete", guild => {
// this event triggers when the bot is removed from a guild.
console.log(`I have been removed from: ${guild.name} (id: ${guild.id})`);
client.user.setGame(`on ${client.guilds.size} servers`);
});
@tawny lava Not my code?
guild create and delete in one ready
ok
'ready' 'guildCreate' 'guildDelete' 'message' etc are different events
"guildDelete"
That's the name of the event
each only need one call
ok
guys
👀
this code ```js
client.on("message", (message) => {
if (message.content.startsWith(prefix + "ping")) {
message.channel.send("Ping?").then(m => m.edit(Pong! Latency is ${m.createdTimestamp - message.createdTimestamp}ms. API latency is ${Math.trunc(client.ping)}ms!));
}
});
where can i place js const m = message.channel.send("Ping?");
no need?
how
`message.channel.send("Ping?").then(m => m.edit(``
message.channel.send("Ping?").then(m => m.edit(`Pong! Latency is ${m.createdTimestamp -
you already have it
m is the message
m is the message created by message.channel.send("Ping?")
you're probably reading two different examples
yes
u where right i had it again above
😅
lol
hey
Unnecessary escape character: \'. (no-useless-escape)
u know what is this
that's eslint
ya
you can remove the \
i have it
it's not necessary
what on earth
yes i am
.au is australia, isn't it
know how did i know it
its not rocket science
what aeth said is correct
Does anyone know how to disable the es-lint rule of line breaks or make it CRLF I could figure it out.
Thank you
did ya google it?
yes
welp im out of ideas
ok
jQuery Devs, help yo boy out. I am using Xampp for development.
You are missing that header?
no
you're out of luck
twitter api should be providing the header
but they aren't
so you cant do that from a browser
PS C:\Users\toshiba\Desktop\MyBot> node mybot.js
module.js:646
throw err;
^
SyntaxError: C:\Users\toshiba\Desktop\MyBot\config.json: Unexpected string in JSON at position 133
at JSON.parse (<anonymous>)
at Object.Module._extensions..json (module.js:643:27)
at Module.load (module.js:545:32)
at tryModuleLoad (module.js:508:12)
at Function.Module._load (module.js:500:3)
at Module.require (module.js:568:17)
at require (internal/module.js:11:18)
at Object.<anonymous> (C:\Users\toshiba\Desktop\MyBot\mybot.js:3:16)
at Module._compile (module.js:624:30)
at Object.Module._extensions..js (module.js:635:10)```
does anyone know why is this error
invalid json
json what
...
i know trying to make them comments
ok i dont want them to execute
some parsers use // but it's not in the spec and is not supported
you shouldn't use comments in json
A Node.js module providing a set of interfaces to interact with Discord API.
i guess it's a discord lib
how
idk what it is
just found it out by random
does it work with discord api
the docs commands do they work with discord.js lib
ok
than discord.s
thx
i am trying to install djs-collection-persistent but i do it and i require it but it still cannot find module
const PersistentCollection = require("djs-collection-persistent");
You definitely ran
npm install --save djs-collection-persistent
and you had the Directory as the bot's
@rapid musk
const Discord = require('discord.js');
const moment = require('moment');
const Enmap = require('enmap');
const PersistentCollection = require("djs-collection-persistent");
const { bot } = require('../../..');
bot.ecoTable = new Enmap({name: "ecoTable"});
exports.run = (member) => {
}
What OS are you on
like node versoin or discord.js version? isnt OS like iphone related
sorry i honsetly dont knew what OS is
Windows?
OS is Operating System
Make sure it looks like this. Including the Bot's Directory, when installing
it does
Try uninstalling and reinstalling. Make sure that everything you input is correct.
ok
its still doing it
const moment = require('moment');
const Enmap = require('enmap');
const PersistentCollection = require("djs-collection-persistent");
const { bot } = require('../../..');
bot.ecoTable = new Enmap({name: "ecoTable"});
exports.run = (member) => {
const defaultMember = {
peanuts:0
}
bot.ecoTable.set(member.id,defaultMember)
const mValue = bot.ecoTable.get(member.id)
console.log(mValue)
}
thats the code i am trying to run
You might be using it wrong. I don't know what your using it for but in this code I don't see it being used.
bot.ecoTable = new Enmap({name: "ecoTable"});
What is bot.ecoTable
And isn't
new Enmap()
suppose to be
const configs = new PersistentCollection({name: 'configs'});
Looking at the site
ok let me try and change my code
Ok
Also looking at Enmap. Enmap does the almost same as Discord.js Collections
const moment = require('moment');
const Enmap = require('enmap');
const PersistentCollection = require("djs-collection-persistent");
const peanuts = new PersistentCollection({name: 'peanuts'});
const { bot } = require('../../..');
exports.run = (member) => {
const defaultMember = {
peanuts:0
}
peanuts.set(member.id,defaultMember)
const mValue = peanuts.get(member.id)
console.log(mValue)
}
it still giving an error
module.js:487
throw err;
^
Error: Cannot find module 'djs-collection-persistent'
at Function.Module._resolveFilename (module.js:485:15)
at Function.Module._load (module.js:437:25)
at Module.require (module.js:513:17)
at require (internal/module.js:11:18)
at Object.<anonymous> (C:\Users\dylanberman29\Desktop\index.js:1:92)
at Module._compile (module.js:569:30)
at Object.Module._extensions..js (module.js:580:10)
at Module.load (module.js:503:32)
at tryModuleLoad (module.js:466:12)
at Function.Module._load (module.js:458:3)
I wouldn't really know. It come not have installed correctly, installed in the right directory. Or what
What did you do?
const { bot } = require('../../..'); that is used for commands in events i need to doconst { bot } = require('../..');

how do you get messages from a certain user, after a week ago using message.channel.fetchMessages
API: d.js
looking for another person to join the development team for my SMS/phone call bot
need to have a third person working with us so that we can expand the features and integrations faster
DM me if you're interested
(using Discord.js & and JS duh)
If I knew how, I would.
knew how to waht?
[antlers Moose] - Today at 10:19 AM
looking for another person to join the development team for my SMS/phone call bot
don't know JS?
I do. I just wouldn't be reliable
ah
well, its not just sms stuff
its js in general
because we're expanding it to whatsapp, facebook messenger, and some other platforms
and just need help
Nice. Well, I hope you find someone better than me 😄
guys
Yes?
can i have help with js
const unban1 = new Discord.RichEmbed()
.setAuthor(""+message.guild.name+" | "+message.guild.id+"", message.guild.iconURL)
.setColor(654456)
.setFooter('bot.log', bot.user.avatarURL)
.setThumbnail(user.avatarURL)
.setTimestamp()
.setDescription('**Username:** '+user.username+'#'+user.discriminator+'\n**UserID:** '+user+'\n**Action:** Was Unbanned\n**Unbanned By:** '+message.author.username+'\n**Reason:**' +(reason || ' N/A'));
let user = args[0];
the user.useraname and user.discriminator keeps appearing as undefined
this is for my unban command
ok ty
ill try it
still undefined
@earnest phoenix
would it be able to detch the user
fetch
What is args[0]?
the id of the user to unban
user.mention ?
@topaz fjord are you sending this when a user uses the command?
?
when the user does ttb!unban (id) (reason)
if it is, try use message.author.tag
it unbans the user then sends the embed
try that
then that just tags me
yes but i want the users tag
I WANT THE FUCKING USERS TAG
oh then just use user.mention
WHEN I DO THAT IT GIVES UNDERFINE#UNDERFINED
jesus
you need to use message.author
its trying to get the username from the id
yea, user is undefines
Because hes trying to say who Unbanned I assumed
const Discord = require("discord.js");
const fs = require("fs");
module.exports.run = async(bot, message, args) => {
let modlog = message.guild.channels.find('name', 'mod-log')
if (!modlog) return message.channels.send({embed:{
title: "You do not have a mod-log channel!",
color: 654456
}})
let user = args[0];
let reason = message.content.split(' ').slice(2).join(' ');
if (!message.guild.member(bot.user).hasPermission("BAN_MEMBERS")) return message.channel.send({embed:{
title: "Permissions Invalid",
color:654456
}});
if(!reason) return message.channel.send({embed:{
title: "You must provide a reason!",
color:654456
}});
if (!user) return message.channel.send({embed:{
title: "User is not valid!",
color:654456
}});
const unban1 = new Discord.RichEmbed()
.setAuthor(""+message.guild.name+" | "+message.guild.id+"", message.guild.iconURL)
.setColor(654456)
.setFooter('bot.log', bot.user.avatarURL)
.setThumbnail(user.avatarURL)
.setTimestamp()
.setDescription('**Username:** '+user.username+'#'+user.discriminator+'\n**UserID:** '+user+'\n**Action:** Was Unbanned\n**Unbanned By:** '+message.author.username+'\n**Reason:**' +(reason || ' N/A'));
if (message.member.hasPermission("BAN_MEMBERS")) {
console.log(""+message.author.username+" unbanned "+user+"");
modlog.send({embed: unban1}).catch(console.error);
message.guild.unban(user);
}
}
module.exports.help = {
name: "unban"
}
thats it all
the top
you need to fetch the user first
I know. But args[0] doesn't exist. args is always undefined if you don't define it as
let args = //code
message.guild.users.get(<id>).unban
yea, we see that, but are they actually being given as a value
as in like this
let args = message.content.split(" ").splice(2)
i mean that would include unban
but you get the idea
also, as for getting the user
are you trying to tag the user
or are you requesting the userID for the unban
im am unbanning them with their user id
ok gimme a sec to type up an example
i did fetch user to get their info but i dont know where to go from there
bot.fetchUser(userID, function(user) {
message.guild.unban(user)
message.channel.send({embed})
})```
thats literally just an example, it might or might not work
how would i also get the username
user.username
basically the same way you were before
user.tag would work better
since you wouldnt have to do user.username + "#" + user.discriminator
bot.fetchUser(user, function(user) {
const unban1 = new Discord.RichEmbed()
.setAuthor(""+message.guild.name+" | "+message.guild.id+"", message.guild.iconURL)
.setColor(654456)
.setFooter('bot.log', bot.user.avatarURL)
.setThumbnail(user.avatarURL)
.setTimestamp()
.setDescription('**Username:** '+user.username+'#'+user.discriminator+'\n**UserID:** '+user+'\n**Action:** Was Unbanned\n**Unbanned By:** '+message.author.username+'\n**Reason:**' +(reason || ' N/A'));
if (message.member.hasPermission("BAN_MEMBERS")) {
console.log(""+message.author.username+" unbanned "+user+"");
modlog.send({embed: unban1}).catch(console.error);
message.guild.unban(user);
}
})
i did this
but it doesnt work
@delicate zephyr
+user+'
the user variable there is an object
its over 2000 chars
use user.id
i did say it wouldnt work since it was an example
@delicate zephyr
how would i fetch a username and the discriminator using fetchUser();
wert
oh ty
did it work
no
it still says undefined
if this help im one 11.0.0 discord.js
@delicate zephyr
.
var args = message.mentions.users.first()
If I wanted to find all mentioned users. I would use findAll?
var args = message.mentions.users```
should work
@earnest phoenix
Ok 👍
thank you
jk
objectlizard
i didn't get what this meant
@tawny lava
why you ping lizard like that
typical help vamp behaviour 🤷
Nah. No one. Just you bub 💙
@heady zinc i use discord.js -_-
i do too
@uncut slate may i please have the bot developers role ffs
if your bot is not approved you"re not gonna have it 👀
which bot is yours
put it on last with that shit attitude
-bots @earnest phoenix
@thorn pivot
Your bot was made in Discord Bot Maker, right
discord bot maker 

its not aproved
i want the certified bot role
it's a special mute role
@uncut slate give me admin too :^)
hmmmmmmmmmmm
@inner jewel i say no
nah gotta keep the meme exclusive
@uncut slate i am a bot developer though -_-

well
i mean
some bots got approved
even though their devs wasnt really one

including myself
r u sure about that
#general lads
(for the others)
(lib talk = development)
(hm yeah we should actually move to general too, talking between parentheses doesn't count)
Hello
let ban = JSON.parse(fs.readFileSync('./Storage/bans.json', 'utf8'));
let modlog = message.guild.channels.find('name', 'mod-log')
if (!modlog) return message.channels.send({embed:{
title: "You do not have a mod-log channel!",
color: 654456
}});
if (!message.guild.member(bot.user).hasPermission("BAN_MEMBERS")) return message.channel.send({embed:{
title: "Permissions Invalid",
color:654456
}});
if (message.mentions.users.size < 1) return message.channel.send({embed:{
title: "Must specify a user!",
color:654456
}});
let banmember = message.guild.members.get(message.mentions.users.first().id);
let user = message.mentions.users.first();
let reason = message.content.split(' ').slice(2).join(' ');
if (user !== '.Storage/bans.json') {
if (!ban[user.id]) ban[user.id] = {}
if (!ban[user.id].bans) ban[user.id].bans = 0;
if (!ban[user.id].username) ban[user.id].username = user.username;
}
if(!reason) return message.channel.send({embed:{
title: "You must provide a reason!",
color:654456
}});
if (!banmember) return message.channel.send({embed:{
title: "User is not valid!",
color:654456
}});
const ban1 = new Discord.RichEmbed()
.setAuthor(""+message.guild.name+" | "+message.guild.id+"", message.guild.iconURL)
.setColor(654456)
.setFooter('bot.log', bot.user.avatarURL)
.setThumbnail(user.avatarURL)
.setTimestamp()
.setDescription('**Username:** '+user.username+'#'+user.discriminator+'\n**UserID:** '+user.id+'\n**Action:** Was banned\n**Banned By:** '+message.author.username+'\n**Reason:**'+(reason || ' N/A'));
if (message.member.hasPermission("BAN_MEMBERS")) banmember.ban().then(member => {
console.log(""+message.author.username+" banned "+user.username+"");
modlog.send({embed: ban1}).catch(console.error);
})
anyone see whats wrong here
saving data in json files
it wont send the ban embed
saving data in json files
you guys are no help
saving data in json files backfires
Saving data in JSON files is always an issue.
if you wanna help then help, otherwise just stay out of it
there i fixed it myself
with no help from you guys
g4u
@topaz fjord Instead of if (!message.guild.member(bot.user).hasPermission("BAN_MEMBERS")), use if (!message.guild.me.hasPermission("BAN_MEMBERS"))
exports.run = (msg, args) => {
const srole = args.slice(0).join(' ');
if(!msg.author.id == msg.guild.owner.id) return msg.channel.send("This command is only avalible to the guild owner and people who he/she adds to a list")
if(!srole) return msg.channel.send("Please provide a role you would like to have set has the mod role")
sql.get(`SELECT * FROM gconfig WHERE guildID = "${msg.guild.id}"`).then(row => {
if (!row) {
sql.run("INSERT INTO gconfig (guildID,srole) VALUES (?, ?)", [msg.guild.id,`${srole}`]);
} else {
sql.run(`UPDATE gconfig SET srole = ${srole} WHERE guildID = ${msg.guild.id}`);
}
}).catch(() => {
console.error;
sql.run("CREATE TABLE IF NOT EXISTS gconfig (guildID TEXT,srole TEXT )").then(() => {
sql.run("INSERT INTO gconfig (guildID,srole) VALUES (?, ?)", [msg.guild.id,`${srole}`]);
});
})
sql.get(`SELECT * FROM gconfig WHERE guildID ="${msg.guild.id}"`).then(row => {
if (!row) return msg.reply("No mod role is set");
msg.reply(`**${row.srole}** is now the mod role for this server`);
});
}
``` its saying Error: SQLITE_ERROR: no such table: gconfig
i dont get that cause i see the file
in the bot folder
The file itself isn't the table
The file is the database
Re-run the script, because I see a sql.run("CREATE TABLE IF NOT EXISTS gconfig (guildID TEXT,srole TEXT )")
it worked this time..
why did it work the second time?
Also if i run it again after i set the srole once it doesnt update the srole.(this is my first time using SQL. sorry)
bot.user.setPresence({ game: { name: prefix + "help" + " | " + bot.guilds.size + " Guilds", type: 0 }});
how would i change this so it streaming the game
so it says streaming"" not playing""
type 1
so like
url: link
but i mean how would i format it
bot.user.setPresence({ game: { name: prefix + "help" + " | " + bot.guilds.size + " Guilds", type: 1 }});
where would i put the link in there
url
im asking where in that line of code
game: { name: "", type: 1, url: "https://www.twitch.tv/"}



