#development
1 messages · Page 653 of 1
Ok
let format = commaNumber.bindWith(',', ',')
let money = game.user[memberID].money.cash
let newmoney = format(money)
message.channel.send(newmoney)```
@floral bloom
Thanks, I'll try it 😄
@floral bloom it's working?
I haven't done it yet 😄
I'm trying though
@earnest phoenix Thank you so much! It worked! :D
np ;)
😄
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
Missing a }) at the end i think
One message removed from a suspended account.
How to make a reload command, my old reload stopped working and I'm using a vps
@earnest phoenix code? And error?
No there is no error, the command just won't actually re load the file
Code?
Where do you guys learned to code?
a great mix of sololearn and throwing shit together until it works
i learned concepts from youtube videos, syntax from sololearn, and gained experience from copying and pasting code, while changing it up just a bit so i understand what does what
ok
what
anidiots.guide isnt platform specific

its not
you install it via your preferred package manager
linux package manager =/= node package manager
Is there a way to make a bot tell if a users in a voice channel and if so set a variable to the name of the channel?
Discord.js
client.commands['eval'] = {
category: "mod",
name: "Eval",
desc: "Eval command for owners only",
usage: "-eval {command} or @Clap Bot eval {command}",
async run(message) {
How could I get category from client.commands ?
Cause I am not just trying to get category from just eval but all mod commands
client.commands['eval'] = {
category: "mod",
name: "Legacy Bot",
desc: "Legacy Bot command for everyone",
usage: "-Legacy {command} or @Clap Bot Legacy {command}",
async run(message) {
What?
Are you trying to copy my code?
or what?
Cause if you are tryingto copy my code good luck
@lusty dew is client.commands an object?
ye
what are you trying to do with the category?
are you trying to get all commands that are mod?
const modcmds = [];
for (const cmd in client.commands) {
if (client.commands[cmd].category === 'mod') modcmds.push(client.commands[cmd].name)
}
I guess
storing in an object is kinda suboptimal since it's not iterable
I mean there's object.values() but that's kinda eh
but
ES6 solution:
Object.values(client.commands).filter(i => i.category === 'mod').map(i => i.name)
Discord.js
Why is it that when I add two numbers from on object together, it doesn't work?
client.game.data:
{
"userID": {
"money": {
"cash": 100,
"bank": {
"balance": 300,
"maxBalance": 1000
}
}
}
}
balance command:
let total = client.game.user[memberID].money.cash + client.game.user[memberID].money.bank.balance;
message.channel.send(total);
Output:
100,300
Expected output:
400
are you sure that's how client.game.data looks
is 100, being converted to a string?
i dont know if you need a comma
since its the only element
like, can you eval JSON.stringify(client.game.user[memberID], null, 2)
It shouldn't be
nvm its the first element of 2
no that doesn't make sense Loafyboy
you could try forcing them to add as numbers
the object looks correctly structured if that's how it actually looks
https://oliy.is-just-a.dev/0ek5lh_575.png work for me
well if there is a comma in a key somewhere converting it to number is gonna be NaN
so it's probably malformed client.game
Wait...
Somehow client.game.user[memberID].money.cash was changed to a string instead of a number........
yes we got that much
Welp, it's fixed now 🤷
maybe give the code where it's stored?
👍
two days ago I asked a question in here why my variables were undefined in some logs and not in others
found out I was calling a function out of sync twice
oof
my worst to-figure-out fuckup yet was (sec, let me find the commit)
this today
I haven't used this out of relation to websites
which normally you do by this.prop
like
user.username
would be this.username
inside of the user class
but the thing is, proxies take the object they're on as an argument, not as this
so I was like wtf doesn't this work with "this"
because uh that's not how ya do it 
thats the beauty of pseudo code
you write something and feel great about it
go home and compile it
and spend the next 5 hours raging about an interaction
Lol, I found what converted it to a string. I had a set command that set the user's cash balance, and since the args of a message are strings, it set the user's cash as a string too xD
nice
that line was a fix for another thing and I committed it on mobile being happy about fixing that other thing
without really proof-reading
owoof
Now I'm using parseInt(); to fix it. Thanks for everyone who tried to help!
const discord = require('discord.js');
exports.run = async (client, message, args) => {
const hi = new discord.RichEmbed();
.setTitle('New ModMail Thread')
.setDescription('Please choose a guild from the list below to begin. (type the number above the guild name)')
.addField('1', 'Library of Code Developers (590070673796235284)')
.addField('2', 'kasper test (590070673796235284)')
.setColor('FF0000')
.setFooter(client.user.username, client.user.avatarURL)
message.channel.send(hi)
}
``` Anything wrong with this code?
One message removed from a suspended account.
One message removed from a suspended account.
Wdym
Like ppl have to vote ur bot to use the command? @sage bobcat
I mean it's pretty simple logic, any person who "knows JS" like you kept gloating about should be able to figure it out... but here it goes... check if they voted using the API, and if they did, let them earn their daily. Every time they successfully claim it, store the current time in a DB. The next time they run the command, check if it's been 24 hours since they last redeemed the prize.
One message removed from a suspended account.
One message removed from a suspended account.
Cool but there's ur answer still
One message removed from a suspended account.
Store the time in a DB and check if it's been 24 hours since that time
Is it possible to upload folders of images to an online database and have a Discord bot access and search through those folders grabbing the links of the online images?
How can I ban someone using their ID
I have the option for mention
but I can't figure out the ID
which library
D.js master
If d.js I assume
if message.mentions.users.size is zero
check the args
message has a property called mentions, mentions has a property called users, users is a collection so if its size is zero it means that theres no mentions
Yea I know
they're asking how to ban with an id
yes now Im talking about that
I already have
call ban('id') on a guild
since its zero, you can check your args
let banMember = message.mentions.members.first()
I have that now I also want to add the option to ban by ID
as I said use .size
also use users since its more fail safe than members
as members can be uncached
ok
basically what Im telling you to do is
- check the size of users property of mentions
- if its not 0, use mentions.users.first()
- if its 0 check the arguments of the command
- use the id from number 2 if its a mention, or the args in 3 if its not a mention to ban the user
How to let an Embed looks like this?
@stray garnet wdym
i mean how to get for exapmle "Servers: ${bot.guilds.size}" in one line
it already is in.. one line?
In an Embed.
"Servers: " + bot.guilds.size + "\nImANewLine"
@stray garnet they arent fields
the title is just bold
Developer: Ace Flame
Guilds: 42
Watching: 24473 members
its just that
wait nvm
const purgeTurds = async () => {
return await players.find( {level: 1, exp: 0, rLevel: 0} );
};
purgeTurds().then(async flush=> {
for(i=0; i<flush.length; i++) {
flush[i].deleteOne({ flake: flush[i].flake });
}
});
players.deleteMany({level: 1, exp: 0, rLevel: 0});
are those identical expressions?
aside from the use of await
Can you make your code more readable?
grr not formatting
is that easier to read?
basically, the longer code builds an array then iterates through it with deleteOne of a property every document has
but the problem is, it seems to throw an error for an empty array
whereas deleteMany would just do nothing if it had no results
that code can be greatly simplified
Yeah, I wrote it when I was just learning to use mongo
then I realized that 1 query should do it all
for example (if i understood it correctly)```js
const purgeTurds = await players.find( {level: 1, exp: 0, rLevel: 0} );
for(i=0; i<purgeTurds.length; i++) {
purgeTurds[i].deleteOne({ flake: purgeTurds[i].flake });
}
you removed the .then callback
which will also account for empty results, since the for loop wont run if purgeTurds is empty
the other example checks for flush.length, but flush can return undefined
not sure, i dont use mongo
yeah it should
(node:5996) UnhandledPromiseRejectionWarning: ReferenceError: bMember is not defined
I keep getting this error
But like
if(message.mentions.users.size === 0) {
let bMember = await client.users.fetch(args[0])
}else {
bMember = message.mentions.users.first()
}
if (bMember.hasPermission("BAN_MEMBERS")) return message.reply(`Sorry, ${bMember} can't be banned`)
if (!message.member.hasPermission("BAN_MEMBERS")) return message.reply(`Sorry, you do not have the permission \`\`BAN_MEMBERS\`\``)
if (!mMember) return message.reply(`This user doesn't exist`)
let bReason = args[1] || "N/A"
I have it defined
you don't
Oh?
request('https://api.eggsybot.xyz/ataturk', function (error, response, body) {
if (error) return console.log('Hata:', error); // Hata olursa, konsola göndersin,
else if (!error) { // Eğer hata yoksa;
var info = JSON.parse(body); // info değişkeninin içerisine JSON'ı ayrıştırsın,
message.channel.sendEmbed(new Discord.RichEmbed().setImage(info.link)); // ve konsola çıktıyı versin.
}
})};```
beyler sorun ne
the user returned from first() can still not exist
Wym?
you're checking if the mentions collection size is 0, if it is, fetch the user with the first argument, however, you're not sure whether the user with such id exists (which can result in an undefined user)
ignore what i said above i misread the code
also isn't it Client#fetchUser
you can't fetch in a collection
ah
Yea
and I noticed I have no way of checking if the ID the person uses belongs to an actual user
I forgot how to handle rejected promises or whatever it is called
I have a question.
If you were to store data such as custom settings and custom tokens the moment a user uses a command using their User ID.
Does that go against the TOS for data collection?
Essentially is storing someone’s user id purging the data of users?
no
you can collect any user data as long as you have their permission and the data is encrypted
for storing ids you dont have to do either of those
cry, how would I handle rejected promises
dunno, i don't do node
@lusty dew define bMember outside the if block, or use ternary operators
Define it as what though
Cause like
I need to have it defined with those values inside the if block
if(condition) {
let variable = something
variable // exists here
}
variable // doesnt exist here```
let and const are more strict with scoping, if you define them inside a block, they only exist inside that block
however var isnt, because var is weird and broken
you can use var, but the recommended way would be to define it outside of the scope
like this
let bMember;
if(condition) {
bMember = something
}```
Ah
or using ternary operators:
I forgot you can define things without a value
let bMember = condition ? something : something_else;```
Okie thank you
(node:7044) UnhandledPromiseRejectionWarning: TypeError: bMember.hasPermission is not a function
if (bMember.hasPermission("BAN_MEMBERS")) return message.reply(`Sorry, ${bMember} can't be banned`)
is this not how it's done?
or does master do it differently?
Oh wait
Nvmmm
it is using users
is it carding
what
Wut
inconsistency between platforms
discord clients handle markdown differently on desktop, android & ios
Hello
client.loadGuildData(message.guild.id, res => {
let banEmbed = new Discord.MessageEmbed()
.setTitle(`Ban | Case #${res.case_number++}`)
.addField(`Moderator:`, message.author)
.addField(`Banned:`, bMember)
.addField(`Reason:`, bReason)
.addField(`Time:`, message.createdAt.toDateString())
.setColor('BURPLE')
client.channels.get(res.log_channel).send(banEmbed).catch(e => { console.log(e) })
})
Can anyone explain why it isn't showing the correect number
It loads guild data from my db
yea
doubles
Hm?
idk
I'd log res
And check if what's in there is actually what you're expecting to be there
Also
Don't know if you're aware but it'll display the old value before incrementing
Not sure if that's intentional
It isn't incrementing @late hill
@lusty dew try logging res.case_number
also wouldnt ++res.case_number would work better in this case?
I changed it to that
it says 0 in the db
but on the embed it shows one
so I did it again
and it showed one again
so it isn't incrementing properly
you're not saving anything back to the database
you're just incrementing the variable
(node:5652) UnhandledPromiseRejectionWarning: TypeError: callback is not a function
client.writeGuildData(message.guild.id, res)
Well which is callback and what’s res smh
if you're returning with a callback, you need to add a function into the argument of a function you're calling, sort of like resolving promises
function naam(guild, callback) {
}
naam(<guild>, function(res) {
});
How?
This server
oh
Maybe not idk
i thought he meant how his user count is so high
Not very dev but who knows
@slim heart Yea thx
Guys I need help
One message removed from a suspended account.
dbl ask2ask @gloomy estuary
By asking if you can ask a question, you have already asked a question so simply just ask the actual question. State exactly what the problem is so someone can help you as soon as possible.
I typed all correctly but says like this. I host in heroku using github someone help me
One message removed from a suspended account.
not helping dv :<
One message removed from a suspended account.
first of all, are you coding on mobile
yeah dont
What that line means?
One message removed from a suspended account.
you have an error somewhere else
What mistake I made
One message removed from a suspended account.
One message removed from a suspended account.
you made a syntax error, likely typo somewhere
but it realizes shits broken on the last line
What I have to make it possible
One message removed from a suspended account.
One message removed from a suspended account.
@gloomy estuary replace token with your bot token.
I was gonna explain fstrings but idk what version they use
And what is the best solution for hosting please say
anything that you pay for really
Pins?
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
Pinned message
dv youre not being helpful you know that 
One message removed from a suspended account.
Stfu dv I just woke up
One message removed from a suspended account.
And not even how I wanted
I was forced to wake up because video output wasnt coming out of the console my family uses for netfliz
Now the output is blurry, and audio is delayed
I also putted token but it remains same
One message removed from a suspended account.
because you have a syntax error somewhere else
its obvious
wrong token throws api error
At the top of the code do token = your bot token and then at the bottom do client.run(token)
Use a variable so we cannot see it
Encase your token in "token"
For example
import discord
client=whatever client you use
token="your token here"
#your events
#
#
#
#
client.run(token)
I have done but it says same 😦
Send screenshot
Did you define TOKEN
did you seriously just copy it
Public toookeeeeeen
So @west spoke :
..
I dév' my admin panel but i have try for test this folder : https://github.com/orels1/discord-token-generator
But this code give the token of the personn look : and me i want just the id of the personn no the token
You already posted that.
What exactly are you trying to get
Undo part of that, as I dont know what the fuck it is
No
Oh ok so yyou can not help me
But I'm guessing it will have a .ID part in the <user> area
Can you not repeat messages
This is oauth2 system
You have to set oauth scopes
No you can help me if you don't know what is oauth2 lmao
@lofty hamletjust fucking do it, I can try.
Dont assume.
I don't know d.js but I've been able to help.
@topaz fjord scope and not identify ?
@west spoke this is not discord.js this is oauth
I know, it's a fucking example
Integrate your service with Discord — whether it's a bot or a game or whatever your wildest imagination can come up with.
?
That identifies the user, and can retrieve elements such as the name, and id
in the file discord.js
Yeah ?
Log req.query
req.query
Then log req.body
@topaz fjord
One message removed from a suspended account.
user having an inventory?
more or less same thing just an array, right?
unless each item is more complicated
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
yeah it sounds like a document would just be a list of binary items
type : Number, default : 0 etc
How to install FFMPEG on NodeJS
Does anyone know how to delete a managed bot role even though the bot's not in the guild yet it still exists?
@sudden geyser reinv and then ban
Will try that (edit: worked)
Can anyone help with my question xD
One message removed from a suspended account.
what's the purpose of the items?
One message removed from a suspended account.
so "equipped" and "inventory" will be separate?
One message removed from a suspended account.
yeah, would make sure you fully understand what you want every item to be capable of before starting to write that
whether you want the database to have the "stats" of every item
One message removed from a suspended account.
or a giant file to interpret each string
One message removed from a suspended account.
the mongodb is for players
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
you just want to assign an attack/defense value?
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
well just ballpark it sounds like every item needs 2-3 variables
pie {
type = "healing",
value=25,
}
sword {
type="weapon",
value=10,
}
type could of course be a separate class
One message removed from a suspended account.
because later on you will need to differentiate what a player can equip
One message removed from a suspended account.
mongoose would be server side
One message removed from a suspended account.
I think all you really need is a giant class database
One message removed from a suspended account.
i guess you could mongo it too
One message removed from a suspended account.
why store that in a db?
One message removed from a suspended account.
unless you have a massive amount of items or people can create their own there's no need
One message removed from a suspended account.
mongoose schema would store whether a player has an item or not
One message removed from a suspended account.
even with a lot of them you could just save the item stats/whatever on eg a json file
and only save inventories in the db
One message removed from a suspended account.
yeah, I agree with giant json file for item properties
you can add/delete from json its just messy
I just want that instead of receiving the token I get the id, knowing that I took the file exactly here: https://github.com/orels1/discord-token-generator
just do a get on /api/users/@me with the token
json could quickly differentiate item types/properies
once you get the token, it's a single http request to get the user id
🤔
I tested a lot of things but I do not understand how I get the id of the person, ah and I have to get it with the token? Is not it unauthorized to take the person's token? @inner jewel
@lofty hamlet oauth tokens are not the same as a regular token
Oh ok
you get those only if the user explicitly authorizes you
and they have limited access
the mongoose schema would load/save how many of each item a player has
you would have to manually add items to both the jsona nd schema
I'd add ID's to the items
My token that the oauth displays can not be used to send a message for example via a script @inner jewel if i have understand
And so how i can with this token get the id of this user ?
send an http GET to https://discordapp.com/api/v6/users/@me with the authorization header set to Bearer <OAUTH TOKEN>
How to install ffmpeg
Hum ok so how i can make this for example, i make test with this link for understand the oauth @inner jewel
But now, i don't understand all in oauth
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
you running atlas account?
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
compass just read/writes your database
if you have atlas you never have to activate db
its always online
One message removed from a suspended account.
One message removed from a suspended account.
yeah, you shouldn't have to run anything for mongo
compass and bot just connect to it
@topaz fjord you're back 👀 so Natan say for get the user id with the token Bearer i do : send an http GET to https://discordapp.com/api/v6/users/@me with the authorization header set to Bearer <OAUTH TOKEN>
And he have decconected and i have say : Hum ok so how i can make this for example, i make test with this link for understand the oauth @Natan But now, i don't understand all in oauth
You can help me ? :d
What natan said is self explanatory
Also if you don't understand oauth you should learn it before jumping into it
One message removed from a suspended account.
have you ever connected to it with bot?
if you don't connect to it successfully within a day it goes dormant
but goes online as soon as you connect
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
I'm not familiar with running it that way
One message removed from a suspended account.
when I made an atlas account it's 100% serverside
One message removed from a suspended account.
One message removed from a suspended account.
There is just the aspect of getting the id of the user's avatar etc.
Because they say that identify return all the info of the user but no @topaz fjord
Do what natan said
Make an http request with the token given
To the endpoint he gave you
An http request for ?
To get their data
I want just transform the Bearer token in user infos
And that's how you do it
Oh ok so how i can make this
jesus christ
@hushed berry ?
its like going in circles
But i do not understand how to do
@spring ember when i get home im going to try and do something ML & DBL related
im having trouble getting the bot online even though it should be working
@earnest phoenix keep me posted
do i have to refresh the bot or something? and how do i do that as well
i still dont grasp what those are but im using visual studio code and discord.js probably not what you were asking though
Do you have an error
Can you send code without token
i dont really think i get how to actually like. USE the code
im using windows
ok i do that and nothing happens
yea
i do
let me grab it
\Bot\RadicalBot> node bot.js
(node:8036) UnhandledPromiseRejectionWarning: Error: Incorrect login details were provided.
at WebSocketConnection.<anonymous> (C:\Users\jasonjr\Desktop\Bot\RadicalBot\node_modules\discord.js\src\ctManager.js:48:41)
at Object.onceWrapper (events.js:291:20)
at WebSocketConnection.emit (events.js:203:13)
at WebSocketConnection.onClose (C:\Users\jasonjr\Desktop\Bot\RadicalBot\node_modules\discord.js\src\clien\WebSocketConnection.js:390:10)
at WebSocket.onClose (C:\Users\jasonjr\Desktop\Bot\RadicalBot\node_modules\ws\lib\event-target.js:124:16) at WebSocket.emit (events.js:203:13)
at WebSocket.emitClose (C:\Users\jasonjr\Desktop\Bot\RadicalBot\node_modules\ws\lib\websocket.js:191:10)
at TLSSocket.socketOnClose (C:\Users\jasonjr\Desktop\Bot\RadicalBot\node_modules\ws\lib\websocket.js:850: at TLSSocket.emit (events.js:208:15)
at net.js:588:12
(node:8036) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by thde of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). id: 2)
(node:8036) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise that are not handled will terminate the Node.js process with a non-zero exit code.
huh
ok
ok
oh
oooooooooh
await
auth.js would be a config for the token right?
ill just
put the right token
in the thing now
because it changed from last time
It’s saying syntax error what’s wrong with it
!eval client.user.setGame(“In development.”)
thank you!
Wdym?
Oh wait I copied the wrong line
I’m trying to have the bot send a message in a channel, through the eval command but it’s saying syntex error
!eval client.channels.get(“526413689558138892”).send(“Hello!”)
Go to #commands and I’ll show you
What bots I own
So what’s wrong with this
!eval client.channels.get(“526413689558138892”).send(“Hello!”)
Wdym.
what
What’s wrong with this
!eval client.channels.get(“526413689558138892”).send(“Hello!”)
My bot says syntax error
what is the full error
K
and now im having problems including multiple words in something. hold on let me show you what isnt working this time
client.on('message', msg => {
if (msg.content.includes === "rad", "radical", "great", "nice", "awesome", "Rad", "Radical", "Great", "Nice", "Awesome", "RAD", "RADICAL", "GREAT", "NICE", "AWESOME") {
msg.reply('Totally Radical!');
}
what is wrong with this one
because
i cant find a way to have multiple phrases
i feel like a fool
You could use || and an or statement
Or you could have it as one string and have msg.content in x
as far as I know, ".includes" is specifically for array objects
Could create an array of "rad", "radical", "great", "nice", "awesome", "Rad", "Radical", "Great", "Nice", "Awesome", "RAD", "RADICAL", "GREAT", "NICE", "AWESOME" like let words = ["rad", "radical", "great", "nice", "awesome", "Rad", "Radical", "Great", "Nice", "Awesome", "RAD", "RADICAL", "GREAT", "NICE", "AWESOME"]; then check if (words.includes(msg.content)) {}
im not sure how it interacts with a string
Oh it’s not an array
ok
it works with strings, but that's not how that works
I think dillon gave you a good answer
const words = ["rad", "radical", "great", "nice", "awesome", "Rad", "Radical", "Great", "Nice", "Awesome", "RAD", "RADICAL", "GREAT", "NICE", "AWESOME"];
if (words.includes(msg.content) {
// do something
}```
for syntax
like that
alt.f4();
i guess
ok
One message removed from a suspended account.
give snowflake [args string]
slice the first 2 strings (command, snowflake)
remainder = item name
check if item name exists
then you set flags on mongoose
One message removed from a suspended account.
by set flags I mean save the object
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
json is for the item data
for the stats of the items
mongo is for keeping tabs on the number of items they have
One message removed from a suspended account.
One message removed from a suspended account.
how to find the document that correlates to the item?
One message removed from a suspended account.
One message removed from a suspended account.
heres a thought
Make sure it's require not Require.
One message removed from a suspended account.
One message removed from a suspended account.
Understandable.
One message removed from a suspended account.
One message removed from a suspended account.
hold on i gotta look up how much you can jam in a schema
lmao
One message removed from a suspended account.
so you parse the json to find the object
One message removed from a suspended account.
use the objects "id" to find the database item
that way you can write it in 1 conditional
One message removed from a suspended account.
the tricky part is the dynamic of setting a property name
it's easy to find the document of the id
player = await db.find({playerid : id});
One message removed from a suspended account.
One message removed from a suspended account.
yes so - you find both
you have the player's db object
and you have the json object
but you need to concatenate them to "db.jsonobject = "
does that make sense?
One message removed from a suspended account.
db is defined as a list of your players , your model
One message removed from a suspended account.
I'd hope so 😄
db = mongoose.model("players", playerSchema); for example
assuming you had a model players
then your documents/schemas would be the individual player files
with their stats/inventory
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
I don't see why you need multiple models
One message removed from a suspended account.
wouldn't 1 schema hold all the variables of 1 account?
One message removed from a suspended account.
😄
like I said make sure you got all the variables you intend to use
before you start coding models
write all out on paper or something
afk a bit
One message removed from a suspended account.
i couldnt get it to say any more than one thing without it breaking
im just
ima hope one of yall can fix this while still having it work because im out for now
const Discord = require('discord.js');
const client = new Discord.Client();
client.on('ready', () => {
console.log(Logged in as ${client.user.tag}!);
});
client.on('message', msg => {
if (msg.content === 'rad') {
msg.reply('Totally Radical!');
}
});
client.login(no)
whats the error?
One message removed from a suspended account.
One message removed from a suspended account.
it looks ok tho lol
there isnt an error with that one
One message removed from a suspended account.
there isnt an error
One message removed from a suspended account.
var name doesnt matter
im askin if you can have it respond to multiple phrases with the same result
because
im tired
is it ok if i post a challenge here?
probably, since this channel is about bot development
not even a link
if its yours then it likely falls under self promotion
inb4 minimod 
im not a mod ¯_(ツ)_/¯
not in this server
welp im just gonna post it in #memes-and-media
is there
because we dont want self promotion
It says the bot should not listen to other prefixes than his. But what about key words? Like you say "toxic" and it reacts or sends an emoji
disable it for this guild
if you're going to list it
anyone play rocket leagu ehere
ornah
lol if you want timezones use moment.js
@earnest phoenix wrong channel?
doesnt do what im trying to do though
this takes a unix and handles all the variables
(node:5652) UnhandledPromiseRejectionWarning: TypeError: callback is not a function
client.writeGuildData(message.guild.id, res)
callback is not a function
I think that means something in your ()s isnt a function when it should be
dont quote me on that though since im blanking out on it
@lusty dew what is writeGuildData
@lusty dew I’m gonna take a guess and say where you have res, it should be a function.
So like:
client.writeGuildData(message.guild.id, (res) => {
// do stuff
});
It may be the other property but honestly you should know what a callback function is if you code a bot
So, Is it bad if I send a message to the owner of a guild on event: guildCreate with like help command or something?
yes
Thanks
how can i make my bot send an animated emoji?
Hey, I am currently having an issue installing certain node modules like when I try install modules like canvas, color-thief-node and such I get a long as hell error but when I do it on my vps it works, why is that?
- It may be lack of build tools
- Possibly a mis-match of node versions (I had this problem trying to install on node v12 but only on v12)
But a lot of the time, it's just from missing build tools
What command did you run
npm install -g node-gyp
Will that fix it?
Im on some github page about it, it requires some more stuff too.
Imma try it.
Rebuild errors can be annoying
Well, how do I actually fix it though.
Uh the easiest solution is to not use windows
but uh
are you on the latest versions?
Can't you do npm install
Yo install all packages your bot is using
oh
Oh I was asking for myself
wait not talking about that
Not him
It would install all the dependencies in the package.json file
I tried doing npm install to install all the packages my bot is using but it doesn't install any of them
Ah mk
Ahh
Why am i getting this error? ```0|index | TypeError: Cannot read property 'user' of undefined
0|index | at Object.exports.run (/home/boss/assistant-2/commands/avatar.js:8:24)
0|index | at module.exports (/home/boss/assistant-2/events/message.js:19:9)
0|index | at emitOne (events.js:116:13)
0|index | at Client.emit (events.js:211:7)
0|index | at MessageCreateHandler.handle (/home/boss/assistant-2/node_modules/discord.js/src/client/websocket/packets/handlers/MessageCreate.js:9:34)
0|index | at WebSocketPacketManager.handle (/home/boss/assistant-2/node_modules/discord.js/src/client/websocket/packets/WebSocketPacketManager.js:105:65)
0|index | at WebSocketConnection.onPacket (/home/boss/assistant-2/node_modules/discord.js/src/client/websocket/WebSocketConnection.js:333:35)
0|index | at WebSocketConnection.onMessage (/home/boss/assistant-2/node_modules/discord.js/src/client/websocket/WebSocketConnection.js:296:17)
0|index | at WebSocket.onMessage (/home/boss/assistant-2/node_modules/ws/lib/event-target.js:120:16)
0|index | at emitOne (events.js:116:13)
Code:
```js
const discord = require('discord.js');
exports.run = async (client, message, args) => {
const resolvedUser = (args[0] !== undefined) ? message.guild.members.get(args[0].match(/[0-9]/g).join('')) : null;
const botuser = resolvedUser ? message.guild.members.get(resolvedUser) : message.member;
const embed = new discord.RichEmbed()
.setAuthor(botuser.user.tag)
.setTitle('Avatar')
.setColor(botuser.displayHexColor)
.setImage(botuser.user.avatarURL)
.setTimestamp()
.setFooter(`User ID: ${botuser.id}`)
message.channel.send(embed);
};
@ember atlas idk exactly but don't you need to await message.channel.send() or something?
well that error went away i guess
Huh you edited the message
but it brought a new one so idk
Are you sure that's the block that throws such exception?
Lol
What's the code in events/message.js?
PS: idk js that well but still trying to help
thats fine, any help is appreciated lol
module.exports = (client, message) => {
// Ignore all bots
if (message.author.bot) return;
// Ignore messages not starting with the prefix (in config.json)
if (message.content.indexOf(client.config.prefix) !== 0) return;
// Our standard argument/command name definition.
const args = message.content.slice(client.config.prefix.length).trim().split(/ +/g);
const command = args.shift().toLowerCase();
// Grab the command data from the client.commands Enmap
const cmd = client.commands.get(command);
// If that command doesn't exist, silently exit and do nothing
if (!cmd) return;
// Run the command
cmd.run(client, message, args);
};
@ember atlas what about commands/avatar.js?
const discord = require('discord.js');
exports.run = async (client, message, args) => {
const resolvedUser = (args[0] !== undefined) ? message.guild.members.get(args[0].match(/[0-9]/g).join('')) : null;
const botuser = resolvedUser ? message.guild.members.get(resolvedUser) : message.member;
const embed = new discord.RichEmbed()
.setAuthor(botuser.user.tag)
.setTitle('Avatar')
.setColor(botuser.displayHexColor)
.setImage(botuser.user.avatarURL)
.setTimestamp()
.setFooter(`User ID: ${botuser.id}`)
message.channel.send(embed);
};```
Seems like the problem is here
Aren't you just resolving the user twice
looks like it
What happens if you do resolvedUser ? resolvedUser : message.member;
If it already exists, you don't need to do it again
Instead of args[0] !== undefined use !args[0]
That too
@ember atlas there you go. The nice people have pointed out the issue
You can also use message.mentions.members.first() instead of RegExp. It's your choice though
ty everyone
ur welcome!
const discord = require('discord.js');
exports.run = async (client, message, args) => {
const resolvedUser = message.guild.members.has(args[1]) ? message.guild.members.get(args[1]) : null
const botUser = resolvedUser == null ? (message.mentions.first() ? message.mentions.members.first() : message.member) : resolvedUser
const embed = new discord.RichEmbed()
.setAuthor(botUser.user.tag)
.setTitle('Avatar')
.setColor(botUser.displayHexColor)
.setImage(botUser.avatarURL)
.setTimestamp()
.setFooter(`User ID: ${botUser.id}`)
message.channel.send(embed);
};
Code ^^
What the hell 
https://i.imgur.com/5wbjayL.png
I dont even know what\
@ember atlas what version of discord.js are you on
I can recommend trying this
https://discord.js.org/#/docs/main/11.5.1/class/User?scrollTo=displayAvatarURL
<user>.displayAvatarURL
I'm on a different version of Discord.js so I don't know if that's correct or not
I'm on 11.5.1 and it works
code?
const discord = require('discord.js');
exports.run = async (client, message, args) => {
const resolvedUser = message.guild.members.has(args[1]) ? message.guild.members.get(args[1]) : null
const botUser = resolvedUser == null ? (message.mentions.first() ? message.mentions.members.first() : message.member) : resolvedUser
const embed = new discord.RichEmbed()
.setAuthor(botUser.user.tag)
.setTitle('Avatar')
.setColor(botUser.displayHexColor)
.setImage(botUser.displayAvatarURL)
.setTimestamp()
.setFooter(`User ID: ${botUser.id}`)
message.channel.send(embed);
};
Hmmm
@ember atlas I think the problem is that the member object does not have that property. Try using it on the user instead of the member
@ember atlas You only needed to do const botUser = resolvedUser ? resolvedUser : message.member;
const discord = require('discord.js');
exports.run = async (client, message, args) => {
const resolvedUser = message.guild.members.has(args[1]) ? message.guild.members.get(args[1]) : null
const botUser = resolvedUser == null ? (message.mentions.first() ? message.mentions.members.first() : message.member) : resolvedUser
const embed = new discord.RichEmbed()
.setAuthor(botUser.user.tag)
.setTitle('Avatar')
.setColor(botUser.displayHexColor)
.setImage(botUser.displayAvatarURL)
.setTimestamp()
.setFooter(`User ID: ${botUser.id}`)
message.channel.send(embed);
};
module.exports.help = {
name: ""
}
🤷
We dont know what the problem is
I do
Yes
We don’t know because we dont know what the problem is.
@ember atlas botUser.avatarURL
displayAvatar is not valid in a .setImage i think
And if you want that on the right its .setThumbnail(botUser.displayAvatarURL)
@earnest phoenix It works on .setImage
Okay
Maybe the cache
Or a big api latency
Hello, can someone help me with php?
Yes
Probably not considering it's php
Idk, maybe for discord oauth
Maybe, slim chance though ¯_(ツ)_/¯
Doesn't have to be about discord
dev in general
I've asked several questions before which had nothing to do with Discord at all
const discord = require('discord.js');
exports.run = async (client, message, args) => {
const botUser = message.mentions.members.first() ? message.mentions.members.first() : message.member
const embed = new discord.RichEmbed()
.setAuthor(botUser.user.tag)
.setTitle('Avatar')
.setColor(botUser.displayHexColor)
.setImage(botUser.user.displayAvatarURL)
.setTimestamp()
.setFooter(`User ID: ${botUser.id}`)
message.channel.send(embed);
};```
@ember atlas that should fix your issue.. idk why you made it 20x harder lol
youre a legend
🥄
^
🙄

A day or so ago I asked:
"Is it possible to upload folders of images to an online database and have a Discord bot access and search through those folders grabbing the links of the online images?"
Someone responded saying it's possible, which is great, but I don't know the first thing about using online databases.
Does anyone have any recommendations?
I haven't chosen one yet.
Naturally something free would be best.
almost all dbs are free
mysql, mariadb, postgres are just examples of free sql based db
mongo, redis are just examples of no sql based db
Are all databases online?
What's the difference between sql and non-sql?
You must mistake this for a google search bar
I use this place as a last resort.
I do admit those last two questions were very Google-able, my bad.
Lol it's fine
Can any online database do what I want? (The whole uploading folders of images thing)
ok so basically uploading images into a database is no no
you can store data about the image, like generating a unique id for it, but storing the file with the same id name somewhere else like on your filesystem or in the cloud
Then maybe a database won't work for me...
If my bot uploads an image from my computer and posts the same image using a link from Imgur it's the same speed.
If I use a rich embed however, the link from Imgur is much faster.
If I can have an online database store my images in folders that I can search through using the bot, then that will save me a lot of effort. Otherwise it'll take a lot of tedious work to change everything to using links instead of uploading files.
Since I don't know much about databases I started asking questions here to see if I could save myself the effort & time.
Why is my bot not approved from earlier?
@bright patio #502193464054644737
Use an S3 bucket, not the cheapest but is convient
The library you wrote the bot in @zenith bane
you can save buffers on a database
turn image into a buffer
then just save it to db
Hi All
Is there any way to save image/pdf files into the mysql database. I am Qt4/C++ using QMYSQL plugin.
I am able to store and retrieve txt files into the database but not any other type of files.
Please suggest.
"I am able to store and retrieve txt files into the database"
BRUH
Look at Users.
@stray garnet hu?
How can 10 Users Join a Guild in less than a Second? tf
Because they can 🙃
That's most likely not what happened.
lol
Your client probably doesn't cache all users (it really shouldn't unless you need it to) meaning it'll slowly cache more and more so you'll see the number raising.
Ok
That too but most libs should show the full count regardless of cache
There isn't a server.membercount for it?
He's not using membercount per server
But if he looped through all and added the membercounts it would be right yes
pretty sure they do
But eris uses a lot less ram than d.js does though or that's what i've heard so 
Yes, because it doesn't cache heavily. But, you can stick get away with a massive bot using d.js
If you're using discord.js master it shouldn't be much different anymore from what I've heard
Discord.js Caches a lot of things in expense of ram but with less bandwith usage.
Eris caches a lot of things but with increased bandwith usage
either ways you can hacky hack d.js to fit your cache needs
Well i mean
You can code it so discord.js doesnt cache
Brings memory down by alot
-p นอกจากชื่อฉัน
not cache members and users = memory down by a lot

