#development
1 messages ยท Page 603 of 1
no
if you know any js then its probably a good place to start. you might know some of it from html when you use script tags
Okayy
like i said, almost every language has a library that will make it easy (well, easier) for you to make a discord bot. the final product isnt going to be affected much by your decision
especially if youre a beginner
its commonly recommended to learn a language before making a bot though, because youll be learning 2 things at once (the library and the language) which is more difficult
So basicly no difference between python, javascript and c++
I think im gonna start w/ c++
in terms of discord bots, not much (that will matter to you)
It doesnt look to hard
they are vastly different in other uses
but for discord bots specifically, theyre just different paths to the same goal
sure
I mean if you're good at it ofc
JS and Python are mostly popular and easier than C++ sadly.
Believe it or not
Ohw... okay
i recommend js if you know no programming languages and only want to make a discord bot
its probably the simplest and has a lot of support and tutorials out there to help you out
I actuarly ((((bad grammar so sry))) want to make applications in the future
well it depends what you want to make
ok good luck
If i in the future need some more info, can i just send you a dm?
I agree with what syztum said. I prefer Js and Python bc it's easier although game devs mostly use C++ interestingly enough.
C++ is a very good language to know
its not that interesting. c++ is much lower level and is thus much faster
Because it's incredibly versatile and very efficient
you need that speed for games
games usually do c++ because it's fast and has predictable performance
In fact many languages are made in c++ lul
std::cout << "c++ sucks dont @ me" << std::endl
eg no gc so you won't have a (pseudo)random pause when you don't expect one
So js python or c++
honestly, your first language doesnt matter that much
Oh. I mean I don't see C++ very often and is hard to understand for newcomers (at least for me) so that's why I said that in the first place.
The best is just All of em๐ xd
for a beginner, c++ is much harder
theyre all similar enough that once you know one itll be easy to hop
c++ is hard to get into
although in some cases GC'd langs can win (in theory c++ could win even in those cases, but such code would be unmaintainable)
id say yes
modern c++ isn't that bad
considerabily id say
I know this seemed like a noob question but I don't see anybody asking about it nor in the rules as far as I looked everywhere so I'm unsure so here:
If I use a music extension/module for my bot, will it still be allowed to be in DBL or it just counts as cloned/forked repo. I'm making like a simple Discord.js bot using Node.js and say I want to use a npm music module (e.g discord.js-musicbot-addon) for my Discord.js bot. Thanks in advance. (I hope it's detailed enough.)
you could start with c/c++
I would reccomend starting with java if you want to stick with c style syntax, as if you start with a strictly typed language it's easier to learn other stuff along the line.
in fact, a lot of people do
ye most universities start you in c++
I mainly started with JS and I'm finding it incredible hard to pick up strictly typed languages
I already answered that for you @barren sky
My first lang was C#
yeah
Oh
i started with js and strict typing isnt hard at all
Wasnt that difficult
that's one of the problems
Im only 15 btw
use ts youll get the hang of it quicc
To young?
I'm 15
your age doesnt matter
It's how much time you'll put into it
going from strictly typed to "untyped" is usually easier
I started with c# but pretty quickly switch to js so that kinda screwed me over lol
Tnx for the advise
there are devs way better than me at 15 lol
Lell
@dusky marsh In which channel and where to find your answer. (I just couldn't find it then. Also ping as my reply so I'm sorry if you hate pings.)
if you want to start with c++, i'd recommend one of the newer versions
Okay
they add stuff that makes your life easier
It's canarado from darkos server lol
What version is the newest?
c++17
tnx
ill be so hype when they get to 69
Lmao
unfortunately ill probably be 69 myself and not find it that amusing anymore ๐
My mind will always be with such humor
But i gtg to bad
Bed*
Almost 3am
Tnx for the advise everyone
Seeya๐๐ป
https://docs.neilcorp.fr/ someone doesn't see css in mobile ? bc i dont see him and idk if its me, on computer its working
Documentation de NeilCorp.
Doesnt work on my computer either
I delete it from google adsense
anyone know when the Stats event is sent on Lavalink or SharpLink?
@eager rivet POST your server count https://discordbots.org/api/docs
lavalink should send stats every 1m
opinion
typescript = js + java = java for web
yo wassup justiiinnnn
nothing
how many guilds you have
what features your bot have
@earnest phoenix
on the other hand u should prob get a vps
I'm making a chat filter, but i want the servers admins,owners to be able to turn it on/off if anyone can help this is my code : `client.on('message', async message => {
let msg = message.content.toLowerCase();
for (x = 0; x < profanities.length; x++) {
if (msg.includes(profanities[x])){
message.delete()
return;
}
}
});
`
@earnest phoenix do u know how to use a db?
How can I send a message to someone special from botum?
Get user id, Then send him @grave sundial
message will send to my botum
Why you need it?
@grave sundial what lib
my bot how to send a special message
Mk so I ma using this new linter cause someone recommended it
and I am getting this error
which errors everything else using stuff from discord.js
how do you get certified bot?
Apply for cert
@eager rivet hi
oof did you fix the wrror
No
how are you importing d.js? are you using es6 imports or commonjs modules
commonjs module
can you show the code that gets you the error?
aha youre welcome
Like 10 seconds ago it was
thats how i fix problems ๐ค
Ah mk nvm it just took a while to load it is erroring now
smh
what are the requirements for cert
?
if you dont look, the error isnt there >:(
Lol
show me the erroring code
aw big rip
send your code
bot.channels.get('566571862415638528').send(@everyone Vote for the next mode)
yup, that's confusing
did you disableEveryone when creating the Client?
you mean the permission?
no
no
what library is that, discord.js?
yeah
you can enable it in the .send() as well I think
or well, disable
.send('whatever', { disableEveryone: false })```
yes sending @everyone works anywhere unless the lib has it's own rules
Okey i am a bit new to Discord.py Rewrite ๐ฎ So i am wondering why i get this error
Command raised an exception: AttributeError: 'Member' object has no attribute 'server_permissions'
On this code @commands.command() async def kick(self, ctx, User: discord.Member=None, *, reason='No reason was given'): if ctx.message.author.server_permissions.kick_members: if not user: await ctx.send('Please specify a user') else: embed = discord.Embed(color=0x80ffff) embed.add_field(name='Member', value=member, inline=False) embed.add_field(name='Kicked by', value=ctx.message.author, inline=False) embed.add_field(name='Reason', value=reason, inline=False) await ctx.send(embed=embed) await ctx.kick() else: await ctx.send('You dont have permission to use this command')
I know but what do i change it to?
have you tried reading the rewrite docs?
yes
You don't need to do that
my bot was thrown from dbl What is the reason
I am just saying it i have better stuff to do today
I do not want to look truh that again
So no kick command
oof
lmao
i mean, if you actually want to program stuff, you absolutely have to read and understand docs, as they are everywhere and required for everything
is someone pro js?
try{}catch(e){}
?
still stops bot
// code
} catch(e) {
console.log(e.stack)
}```
and what if error did happen during try?
and regardless of the error i want him to complete whole what is in try?
The try function just trying something, if he cant its returning a error, its not possible to complete the whole
thanks
Np
How come this:
for (i = 1; i <= 2; ++i) {
console.log(i);
}
// 1
// 2
doesn't do the same thing as:
for (i = 1; i <= 2;) {
console.log(++i)
}
// 2
// 3
?
because the ++i in the for line sets the variable for the next loop, not the current one
statement is executed before incrementExpression
Ok thanks
you dont know how to make one ?
yeah
I have a voting system on my bot but the problem is that I have to wait a few minutes before the vote is taken into account by my bot is it normal? ๐ค
which page do you recommend for endpoints anime? [json
https://i.imgur.com/6ywvUUF.png
extern crate discord_rpc_client;
use discord_rpc_client::Client;
use crate::types::CommandOptions;
pub fn rpc(opts: CommandOptions) {
let mut a = Client::new(opts.client_id);
a.start();
a.set_activity(|x| x
.state(opts.state)
.details(opts.details)
.assets(|a| a
.large_image(opts.large_image)
.large_text(opts.large_text)
.small_image(opts.small_image)
.small_text(opts.small_text)))
.expect("Failed to set activity");
}```
ihave no idea how to fix this
someone pls help this has been like pissing me off for a while now 
js how to get all member(with bots) and all channels FROM ALL GUILDS????
STOP SHOUTING??!!
<client>.users has all online users from all guilds
to get offline users you need to either fetch them, or enable all users in your client settings
isn't Client.users a collection of users that weren't offline as in READY
iirc discord doesnt even send all online users if the member count is big
wait in jsdoc how do you do it like discord.js redirects string to the mozilla definition?
?
I have a voting system on my bot but the problem is that I have to wait a few minutes before the vote is taken into account by my bot is it normal? ๐ค
@amber fractal yes but in jsdoc how can i make that auto
like how look at discord.js.org and go to the docs, when there's a "string" type parameter
its auto linked, in jsdoc how can i make it redirect to another link instead of typedef
like this
have you tried digging through the source code
jsdoc source code or this source code?
d.js' website
i believe it's this https://github.com/discordjs/website/blob/master/src/util.js#L27
take a look at http://usejsdoc.org/tags-external.html
Identifies an external class, namespace, or module.
anybody willing to offer me a bit of help with spinning up my bot on heroku?
#memes-and-media for that please @rugged pond
oh sorry :x
What am I doing wrong? I get this: AttributeError: '<class 'discord.client.Client'>' object has no attribute 'latency' , and as far as I know, Client class has a latency attribute. (https://discordpy.readthedocs.io/en/latest/api.html#discord.Client.latency)
i just need to know the basics damn
i have my github repo and my client.login(process.env.BOT_TOKEN) on heroku is a config var with my token as it's value
the config var is also named BOT_TOKEN
have you created a Procfile
so is the problem with pushing to heroku?
i don't know what the problem is tbh
or is your code on heroku but it wont turn on
the code is on github..
yes but heroku has to know about it
you need to add another remote to push to heroku
ive always used the cli so i never have to visit their website again
ugggghhhh
if its deployed, try going to the dunos and swapping them
you need to turn on the dyno you specified
uhhhh idk man
ive always used the cli and im not at my desk to test shit for you lol
oof
you can try clicking more and logs for some sort of error
So I'm using discord.js
was wondering what best way to get users count is?
bc client.users.length is always wildly off
same
like I could go through each guild and summ the guild.memberCount, but like there will be overlap and stuff
yea but it also counts bots
if you want to remove certain users, you can filter the collections beforehand
I think you can filter out bots can you not?
but you wont be accurate since not everything will be cached
just reduce the guilds collection on memberCount
the overlap wont be significant enough
if you can only have unique users then youll have to cache EVERYONE
heroku is shit
not news
my issue is
I have several servers
where people are in multiple servers
but yea
imma just add them all up
and accept slightly higher stats
bc I'm too lazy to implement it properly
it would also be too inefficient to implement unique user count
the users collection only stores the cached users
try it and youll see very different results
I get the exact number of members
just without bots
if I did memberCount
I get nine
and if I take out the bots I get the same amount
client.users.filter(user => !user.bot).size
this returns
try it on a bot with a lot of users
for example, my bots users collection has 25k while membercount is 50k
yea
I got 11 at first
but I just restarted my bot
and I got the appropriate amount
But I understand what you mean
its not accurate in the slightest, especially when your bot grows
that will work for small guilds
on larger guilds it breaks
also filter(...).length is horrible
you generate a ton of garbage
reduce would be better
who used .length?
Ye
as collection.filter returns a collection
users.reduce((a, user) => a + (user.bot ? 0 : 1), 0)
what
filter(...).size is horrible
you create a new huge collection that's thrown away immediately
users.reduce((a, user) => a + (user.bot ? 0 : 1), 0) returns the number of users minus the bots
this is horrible in general
by the looks of it anyway
yes
it'll break if you have uncached users
eg a guild with > 250 members
smaller guilds have all members sent always
larger guilds have only online members sent
others will be missing until they do something, when they'll be cached
can you dont.. just
client.guilds.reduce((members, guild) => members + guild.memberCount, 0)
you cant not count bots accurately
thats ridiculously inefficient
it's just iterating a collection and incrementing a counter
but youre right i even mentioned that myself when this started. you can get accurate counts but it would be really annoying
at Object.run (/home/kawaii/Clap Bot/commands/cuddles.js:41:33)
at process._tickCallback (internal/process/next_tick.js:68:7)```
is it not
new Discord.MessageEmbed() ?
Oh wait
Just notices the error
xD
anyone want to shed light as to why the system isnt saving the modifications done to each planet
anyone here every deploy a bot to heroku, were there any gotchas? Changes you had to make to the .json's or any thing?
mine crash with npm errors everytime i try to start them
Eh
Back again
So I made a bot and have it in my server
And need help on how to get code into it
what library are you planning to use
the programming language library
for the record discord.py has a command handler
should probably backtrack, learn a language and then come back to this
I have the line of Python Code
like discord.js (node.js) or discord.py (python)
Lines
but you don't understand them great go learn python
you should learn the language before you try and make a bot
^^
I only need to do a calculation, but if I have to do that i'm just gunna give up
const Discord = require('discord.js');
const moment = require('moment');
const fetchVidInfo = require('youtube-info');
module.exports.load = (client) => {
// eslint-disable-next-line dot-notation
client.commands['remove'] = {
conf: {
name: 'Remove',
desc: 'Removes a song from queue',
usage: '-remove {index} or @Clap Bot remove {index}',
},
async run(message, args) {
if (!message.member.voice.channel) return message.reply('You must be in a ``VOICE CHANNEL`` to use this command!');
if (!message.guild.members.get(client.user.id).voice.channel) return message.reply(`${client.user.username } must be in a \`\`VOICE CHANNEL\`\`, use -join to make it!`);
if (client.music.queues.get(message.guild.id).length === 0) return message.reply('There are no songs in the queue!');
const player = client.music.players.get(message.guild.id);
const input = args[0];
if (!input) {
message.reply("You must tell the bot what song you want to remove based on the songs' position");
}
const index = input - 1;
console.log(player.queue.splice(index, 1));
},
That is erroring
It is the discord.js npm package
๐
so no I didn't rename it at all
also I have this error as well
I just started using eslint lol
@lusty dew the second one is because they expect you to return something if you ever return
its to keep your code consistent
the first one uhhh im not sure
i just googled the error and it seems like everyones disabled it
i dont have the rule off myself so im not really sure what could be causing the problem
ah that makes sense
Yea
gratz 
consistent return is a finnicky rule
@mint cradle string.isdigit() could be done instead
Returns boolean value
@mint cradle
verb = 'using'
print(f'{verb} f-strings instead of concatenation is better')```
They are telling you how to use f strings
they told you how to use f strings and how to use variables in the f string from outside
Is this for the RespondBlyat() function?
Idk
Oh just random
concatenation like
print("Hello " + "I am " + "your friend")
when you add strings together
I suggest like shivaco suggested use f strings
(but I don't understand what there was said)
hello = "Hello "
iAm = "I am "
yourFriend = "your friend"
print(f'${hello} ${iAm} ${yourFriend}')
I think you can put all the same variables in one ${}
I can't remember though
@mint cradle They also give better performance from what I have heard
@dusty cipher the problem with json isn't only the size but the concurrency issues
Also everytime you read from it you read the whole file
And then parse the whole file
damn
well
hmmmm
it wont be a problem to sawp to my sql i just wanted to know how much is effective , but seems dondish u are right
nested objects looping is nuts
Firebase is best
i'd say up until about 10mb, a json db is manageable, if you use it correctly
thanks i got my own server ill see how json handling going if not i can simply swap to mysql
just avoid disk access as much as possible and you should be fine
ie: read file once and save it in a variable, do operations to it, and only write back to disk when absolutely necessary
โค
also be very careful and make sure you're writing valid data (keep backups)
because any error will destroy your entire database lul
Is this python?
someone recommending to use a json "db" in a non-ironical way must be the most retarded thing ive read today
use sqlite if you want a small managable db
im not recommending it, im saying its manageable and plausible if used correctly
specifically because the question was about json limitations
2mb json file works just fine so far
i was wondering for bigger thats all about it
many websites, web apps nowadays also work on jsons
sorry for my intrjection
json dbs are totally fine to use
nothing bad will happen
carry on
I use json files however people does have preferences on what's superior
yeah its really all about preference
it just depends on size of db i guess thats all
yeah
and what
constructor(player) {
if (!(player instanceof Player))
return super(iterable)
super()
this.player = player
this.onEvent = this.onEvent.bind(this)
player.on("event", this.onEvent)
}
this code makes no sense I understand from this.player down but above that I don't
My friend told me to use it
and explained it
I understand a good bit of it
just i don't see why
my linter is screaming at me telling me not to duplicate super()
is that not allowed?
just dont tell those nerds who engineer sqlite with a test coverage of 100% and about 1.6 million test cases that all their work could just be replaced with json files
that would really ruin their day i guess
i wont , and im just coding since 2 years now im just thirsty guy try's everything but at one point i find my way
lmao
sqlite is pretty much one of the best dbs in the world atm
but it still has a learning curve that json doesnt have, so its also a matter of lazyness/skill
Ive been trying for the past hour to get my AWS SSL to work
and sure enough it just wont
No error or anything
Ive set up the cloudfront
And it just doesnt
Do you guys allow nsfw bots at all?
I think as long as your bot doesn't directly state the use of nsfw stuff on the site, it's fine
can someone tell me how I make my bot go online, please? I'm a bit new ๐
ask it nicely
^
@rustic edge Do you have any start to the creation of your bot, or are you starting fully from scratch
I have only one command
What library is it?
what did you code the bot with?
with Node and Notebook++
]]faq 3
Click the link to get more information on the question:
3) How do I make a bot?
i suggest u follow guides that are linked there to learn a bit about programming since you seem new
owki thank chu
Question
How can I do something like
-help [command name]
Probably should have put that in code locks eyes
-help [command name]
I want to be able to do that
just check args?
yea I had the idea of doing
if(client.commands.has(input)) return //stuff here```
but that doesn't seem to work
well it depends on what framework/command handle you're using
^This guy gets it
then make a library
well tru
i remember my professor talking about how libraries can avoid the compiling time, but i forgot what he meant bc he showed us like this whole 3 step process
it was complicated
if you compile parts of it to a library, you won't have to compile them again
until they change
how would i check if the message author is a bot?
python
im not trying to check if it is my bot
i have been told it is menber/user.bot
Under the weather and havent had coffee
message.author.bot would return True
@earnest phoenix true for both original and rewrite of discord.py
@commands.Cog.listener()
async def on_message(self, message):
if message.author == self.bot.user:
return
user = await self.bot.pool.fetch("SELECT * FROM leveling WHERE userid = $1 AND guildid = $2", message.author.id, message.guild.id)
if not user:
await self.bot.pool.execute("INSERT INTO leveling VALUES ($1, $2, 1, 0)", message.author.id, message.guild.id)
user = await self.bot.pool.fetchrow("SELECT * FROM leveling WHERE userid = $1 AND guildid = $2", message.author.id, message.guild.id)
await self.bot.pool.execute("UPDATE leveling SET xp = $1 WHERE userid = $2 AND guildid = $3", user['xp'] + 1, message.author.id, message.guild.id)
if await self.lvl_up(user):
embed=discord.Embed(title="Congrats!", colour=discord.Colour.blurple(), description=f"{message.author} is now level {user['lvl'] + 1}", timestamp=datetime.datetime.utcnow())
embed.set_footer(text="GBot")
await message.channel.send(embed=embed)```
this is my code, i just don't know how i would put it in
if message.author == self.bot.user:
return
if message.author.bot:
return
if youre trying to return on the author being a bot
@earnest phoenix
I was testing it. Thanks, it worked
i dont want bots on my leaderboard or my bot sending level up messages
@zealous veldt the library grows
owowowo
@earnest phoenix Big oof
Smh
nice advertising
refresh maybe idk
i don't want to advertise -.-
It says ???
hopefully it works
ok
your bot is not in this server so it's going to appear as "???"
oh...
My collab trolled me on github and added a DM leave message -.-
ok..
So that is the reason?
why would i know?
And is there a way to add it again to this server? I already deleted that line.
ok, thanks.
So what npm package do i use for mongo
Mongoose is quite nice
What
Anyways looking at the mongo docs
db.inventory.insertMany([
// MongoDB adds the _id field with an ObjectId if _id is not present
{ item: "journal", qty: 25, status: "A",
size: { h: 14, w: 21, uom: "cm" }, tags: [ "blank", "red" ] },
{ item: "notebook", qty: 50, status: "A",
size: { h: 8.5, w: 11, uom: "in" }, tags: [ "red", "blank" ] },
{ item: "paper", qty: 100, status: "D",
size: { h: 8.5, w: 11, uom: "in" }, tags: [ "red", "blank", "plain" ] },
{ item: "planner", qty: 75, status: "D",
size: { h: 22.85, w: 30, uom: "cm" }, tags: [ "blank", "red" ] },
{ item: "postcard", qty: 45, status: "A",
size: { h: 10, w: 15.25, uom: "cm" }, tags: [ "blue" ] }
]);```
I suppose "inventory" in db.inventory is a table in the database?
Huh
Right
]]faq 9
Click the link to get more information on the question:
9) How do I report Bugs / send Feedback?
thanks
hey guys looking for bot host will pay 20$ after 2 every 2 month for 2 year
not understand
Someone want to make a discord.py rewrite Help menu together? DM me
How can i access variable from another shard? [Discord.js]
@lyric radish broadcastEval
Example of broadcastEval
it is arranged in the order of shards
Shard 0 Data is the first item on that arrray and so on.
"this" is your client in broadcastEval, so for example you want to get a user
client.users.get(id) will be this.users.get(id)
On discord.py embeds how do i get title, desc and icon_url because i have tried alot of stuff but didnt work
@sinful lotus or internal sharding
@topaz fjord Internal sharding is fine up to 10k guilds depending on youur code structure
going more than 10k guilds would be not favorable for internal sharding
Can someone help me about the script to show the total number of total server where my bot is present
please
language and lib?
@sinful lotus whats the downsides of internal sharding on 10k+ guilds?
@quartz kindle Javascript itself
you think node cant handle much more than that?
yeah single thread limitations but that would depend on your bot functions
if you do a lot of cpu intensive task on your bot without relying on sub process
ah true, but then you also need a multicore vps
yeah im on the cheaper side for now
im at 800 guilds
my bot isnt ready for sharding, it needs a rewrite
im thinking if i go for internal or normal sharding
I dont see you need a reason for sharding if you are less than 1.5k guilds even
yeah im not gonna do it now
cluster sharding if you dont mind
for example we have 10k guilds in a bot
it is possible to have 5k guilds in 2 process
its achieved by cluster stuff on sharding
where in 1 process will have 2 internal sharding or websocket connections
so 2.5 + 2.5 = 5k guilds
it is a good method cause for example I have 10k guilds and I would do normal sharding
I would need 4-5 process on normal sharding to accommodate that
and that would consume more memory due to user caches not being shared
where in on the cluster route
5k guilds can share the same user caches
which will bring you better memory consumption
yeah
because you will only need 2 process
vs 4-5 process
but if you want more performance over memory
then traditional is better
even if running more than 1 process per cpu?
like if you have 4 processes but 2 cpus
yeah your os would give your 2 process per each core
I run 26 shards on 16 core system
I dont have problems
cpu usage hovers 8-16%
alright, thanks for the explanation
no problems
why my bot on discordbots.org have gray dot and question marks? xd
its not approved yet
uh, ok thanks
don't even attempt internal sharding without zlib-sync + erlpack lol
if we're talking discord.js at least
@sinful lotus whaddya mean
I used zlib-sync + erlpack + bufferutil on my bot
its not internal sharding
but my bot crashed due to heap allocation failure
memory leak
lmao
I removed zlib-sync but used and kept erlpack + bufferutil
no more leak no reconnects
same to that
uws caused me a lot of issues
reverting to ws + erlpack & bufferutil was perfect
probably wont change it again
@earnest phoenix Discord.js
hey um does anyone here use node.js
just ask your question
what do i do if node is saying there's an error on a line that doesn't exist in my code
the text doesn't exist either
it's saying line 109, but my code only goes up to 107
can you post the code?
i also keep having issues with the ending brackets to close off the code, because before it was saying that was the error.
that's the final command, i'm using discord.js
I don't know how to fix it
look closely
that's how the brackets were on every other line of the tutorial i followed
you opened two brackets, but closed only one
i think
}})
Sometimes you look at it for so long, it takes another set of eyes.
but its better if the second set of eyes explains/shows the problem, and doesnt just spoonfeed lul
it's throwing this error now, did i not do the brackets right?
i didn't even add a semicolon
@calm token your client has a guilds property, it's a collection of all guilds your client is in, just use size on that
@earnest phoenix that part looks right, maybe you have another open bracket somewhere that you forgot to close
Okay thanks !
I just checked, and all of the brackets are closed off right
It's just this particular one
it's saying there's an error that doesn't even exist
@earnest phoenix Unexpected End of Input suggests that there could be an extra bracket somewhere
or possibly an open array bracket or parenthetical.
I have basically no knowledge of javascript so discord.js was not a good choice for me to start out with apparently
https://www.robhitt.com/blog/balance-parenthesis-js/
Drop your code into this ugly thing and see what it says
Not 100% foolproof, but it can catch those obvious mistakes
The final string is balanced so im gonna check other stuff
It might make sense to drop the whole file in
yo, you can download an IDE like vscode btw and get a plugin called "Bracket colorizer"
colors pairs of brackets the same so you know if they open and close and stuff
very good and useful
I'm using Notepad++, because using Notepad was b a d
I was using basic notepad to make the js files
All the individual things are balanced I think
eeeeexcept my commands
frick
i have no idea how to fix this
this is the code im using
i followed a tutorial for the majority of them
because No Javascript Or Discord.JS Experience
client.on("message", async message => { is never closed
do i need to close the parentheses?
you always close parantheses when the function is done
@fiery birch had the right suggestion. I'm sure there's a good syntax highlighter/linter for Notepad++ that will point out discrepancies. When I get hit with one of these issues, I make a copy of the code in a separate file and start deleting functions until the error is resolved, then add them back one at a time.
client.on("message", async message => { should be client.on("message", async message) => {
i think
idr
really recommend vscode over notepad++ if you're willing to try it tho
yeah it T'was Not It
client.on("message", async message) => { is invalid
where do the brackets need to be?
wait what should it be @inner jewel
look around line 95, after the last command function in that set.
a new client.on("message", (message) => { is started, but the previous one (started at line 25) is never closed with });
OH MY GOD IT'S FIXED
god im stupid i forgot about the beginning part
aaaand it crashed because i don't know how to define msg
It's good practice to write the closing brackets before you start into the the rest.
when you start a function, do something like:
(args)=>{
} //close it right now before you go back and fill in the rest
then just arrow up a few lines and get to it
how do I define the msg?
client.on('message' msg => {
//...
})```
semicolon
picky
colon
dont need it
client.on('message', msg => {
//...
})```
you needed a comma
np
)
and iโm pretty sure a semicolon is needed at the send of that statement
it isn't
oh kay
but i'd recommend using it since JS can sometimes fuck up ASI (automatic semicolon insertion)
i just fucked up the code oh my god
yeah js doesn't care about semicolons. Just pick whether to use them or not, and be consistent.
I'm using Discord.JS
do you know javascript
also i still can't figure out how to define msg
we told you
A Busy Person's Guide to Understanding Automatic Semicolon Insertion in JavaScript.
you should learn the language properly first before making a discord bot with it
I'm used to using Discord Bot Maker coding systems
you defined message
as the arg
line 98 is where it's defined.
so you need to use message.reply not msg
everywhere else in that code, you've defined it as message, not msg
oh im dumb
have you learned javascript
I haven't touched javascript since i did a basic course that I never finished in seventh grade
pay attention to the actual errors you're getting. They're usually pretty up-front about what's going on. (x is not defined means you haven't set up that variable.)
if the error is confusing, hit google. (or ask here, these folks seem like a helpful bunch)
+1 code academy to brush up on the basics
Both are rad. The big thing is making sure you understand why it's failing instead of just fixing.
Then, the next time you get that Unexpected end of input, you'll think Oh hell, I must have dropped a bracket somewhere
I know the defining variables thing is important because of a specific error i kept having in GameMaker that I didn't understand until I used my best friend google
oh i forgot to say thank you
THANK, HUMANS
can somebody pleease tell me how can i use oauth2 in my discord.js app
thanks from now
I think you go to the developers page, then click on the oauth2 tab
...
great joke dude
๐ฆ
what do you need to use it for?
for login
dude im literally clueless about anything that doesn't involve creating the bot application
i wasn't sure what you meant anyways
what is "np" please ?
no problem
ah okay thanks you very much
np
why would a user need to log in for a discord.js app
because they will have something in a json file and when they enter the file will get printed in to the screen
*a data
if anybody wants to help me please DM me thanks from now
is this for a webpage
]]moreinfo
If you want people to be able to assist you, please provide more information, such as what library and language you're using, the code in question and what you are trying to do and/or what is causing the error.
Ok so basically
I have a bot thats using Discord.JS
I made a music system, how ever the queue is a bit bugged and I can't seem to fix it
Whats happening is
When you first call the bot, it all works well
but when the bot leaves the channel and the players is destroyed
and you call the bot back.
The songs get stuck in the queue
once the bot has stopped playing the song requested, it'll sit there and not do anything
queue wont even shift
No errors are logged to console.
Why not?
im hovering between 35%-45% cpu usage from what i suspect to be internal sharding
that normal?
maybe?
What library
Hello everyone, someone would have an idea to make the bot repeat a phrase that one chooses?
Hi, fellow Hugo
is there an accepted "best practice" for how to handle a bot not having the permission to speak in a channel?
so far i've just failed silently but i've observed that some people spam a command expecting it to work
and then get frustrated and just kick the bot thinking it's broken
if the bot cant speak theres nothing you can do short of dming them or messaging in another channel
both of which are very annoying
just make sure your bot is well documented and has clear instructions for how to use it and what permissions it needs
booru.posts({tags: input, limit: 1}).then(posts => {
const index = Math.floor(Math.random()*posts.length)
const post = posts[index]
console.log(post)
});
I am getting undefined from this, but the documentation for the npm package says to do this.
const booru = new Danbooru('https://testbooru.donmai.us');
I have it requesting from the test site
Mk I got it to work with the test site
const key = 'Nahyoucan\'thavethis';
const login = 'GodlyFoox';
const authenticatedBooru = new Danbooru(
`https://${login}:${key}@sonohara.donmai.us`
);
authenticatedBooru.posts({tags: input, limit: 1}).then(posts => {
const index = Math.floor(Math.random()*posts.length)
const post = posts[index]
console.log(post)
});
then I tried this
and I got undefined
does anyone have this error with discord.js 'Invalid WebSocket frame: RSV2 and RSV3 must be clear'?
asking for nsfw help
Yeh
oh
Danborru is a NSFW api
oh
hello?
What
you need command handler
im using Java Script

whats that
He asked what a comamnd handler was
Yeh I realized
it is something that helps you load commands from another folder
so you dont have to put all your commands in one file
you can have a command called
hug.js and have the hug command in it
pat.js have the pat command in it
and the command handler loads those commands and makes them usable
Like for python
i use JS
Ye



