#development
1 messages · Page 1489 of 1
bruh
not getting any error that's the thing
I forgot i cant .
does python gives errors, if we try to use function on null or undefined??
^^^
nop3

What
I'm asking..... havn't used python for a long time
Like None.channel
???????????????????????????????//
async def play(ctx, url):
if not ctx.message.author.voice:
await ctx.send("You are not connected to a voice channel")
return
else:
channel = ctx.message.guild.voice_client
await voice_channel.connect()```
y u hv 2 variables??
let object = client.users.fetch('683307434894164016')
object returns a promise?
right?
Yes, await it
kk
fetch always returns a promise
cORouTiNe
async def play(ctx):
if not ctx.message.author.voice:
await ctx.send("You are not connected to a voice channel")
return
else:
channel = ctx.message.guild.voice_client
await channel.connect()```
still doesn't work
I tried using .then
try to print, channel and see what is it actually..
Didn't work
k
What did you do
let object = client.users.fetch('683307434894164016').then(b => b.username)```
@delicate shore using then wont work, u hv to await it
Ah, you still have to await it
ah
can't use await in eval
OR continue your code inside that .then()
;-;
ctx.author.voice.channel instead of ctx.message.guild.voice_client
wait wym
Personally I just use find instead of fetch
then u can write a self calling function!
let object = client.users.fetch('683307434894164016').then(b => {})```
like this?
(async () => {
code
})();```
lemme try
working thanks
await code 😅
Your bot still can't get the value since it can't resolve the promise
You can just change your code to await eval(code)
what's a getter and a setter in objects
Okk
#NeverUseEval or smth idk
getter is function that doesn't require () to call it
what's it's purpose
Like in canvas, ctx.font = "a";. That's a setter, it actually does more than that and like author.tag which is a getter. It takes author.username + "#" + author.discriminator from the parent object
let evaled = await eval(code);
For conveniency
and getter is always, readonly
Yeah
Kk
You need to return the value inside that self calling function
Otherwise you will receive undefined
OH
so getter and setters are read only functions that "get" or "set" stuff?

What is the Best Theme you guys use for VS code?
lmao
Anyone know how I can stop this from occurring randomly? Like the host has enough memory, but I've been told pm2 has some sort of memory limit before it crashes and restarts?
defaulg
Dracula is love
Dark theme
Noice
`` server = ctx.message.guild
voice_channel = server.voice_client
async with ctx.typing()
player = await YTDLSource.from_url(url, client.loop)
voice_channel.play(player, aft)`` doing this now lol
I am dumb so go easy
@delicate shore fetch is a promise
Is it necessary to close mongoose connection ?
frickk
I don't
Any disadvantages?
In your code, you have to await it, your eval code awaits it for you
I dont think u can resolve promises, in eval command. Unless ur eval command function is async function.
He awaited it using await eval()
@rocky hearth which basically every command handler is
asynchronous programming is awesome
tho i like callback hell more
Bet
haha lol
Yes
I tried
didn't work?
let object = client.users.fetch('683307434894164016').then(async (a) => {
await a.username })
)```
If this is what you mean
await a.username
eval members.fetch(); // works
eval members.fetch().then(x => x.user.username); // works
eval members.fetch().then(x => { x.user.username }); // doesn't work, you need to return the value if you use brackets
// works
eval (async () => {
const member = await members.fetch(id);
return member.user.username;
})();```
that was a typo
here
I didn't use it during eval
you know what
`` server = ctx.message.guild
voice_channel = server.voice_client
async with ctx.typing():
player = await YTDLSource.from_url(url, loop=client.loop)
voice_channel.play(player, after=lambda e: print("Player error: %s" %e) if e else None)
await ctx.send(f"**Now playing: {player.title}**" )
``
anyone help
xD
Like I said, either eval client.users.fetch('683307434894164016').then(a => { return a.username; }) or eval client.users.fetch('683307434894164016').then(a => a.username)
Notice the return if you use {}
ohh ok
rip me
or I can just do this
const object = await client.users.fetch('683307434894164016')
const username = object.username
const discriminator = object.discriminator
console.log(username + discriminator)
Otherwise you will receive undefined since the function returns nothing
as a command
Sure
can i send file larger than 8m with bot?
idk
no you cant
hmm
It's 8mb max
unless the server has a boost status that allows higher uploads
plox help me
is there any other way??
whats the problem??
Uploading it on a file server yourself
I don't think it applies to bots?
send ur self lol
Bots can't get nitro so
It does apply to bots
not playing audio
If the server has a higher boost status with higher upload limits, then they can do that
Ah
u use ytdl?
no
lololol
`` await channel.connect()
server = ctx.message.guild
voice_channel = server.voice_client
async with ctx.typing():
player = await YTDLSource.from_url(url, loop=client.loop)
voice_channel.play(player, after=lambda e: print("Player error: %s" %e) if e else None)
await ctx.send(f"**Now playing: {player.title}**" )``
see from here
idk python but you should first create a ReadableStream of the data and pass it to ytdl
nop3
oof i dont use python
js?
yeah
lol
js is awesome
I love python bro
Woah, what do you have against weebs! 😠
defuk :v
anyone know why Audit Logs does this as the reason https://tinyurl.com/y7dky2l4 this is what I use for the reason
let reason = args.join(" ") if(!reason) { reason = "No reason provided" }
and code other code is kickedUser.kick({ reason: reason })
Reason should be a string
You can shorten your code, use args.join(" ") || "No reason provided"
and kickedUser.kick(reason);
oh hey Night lmao
tinyurl.com for uploading files wat
in that case ima head off to bed and try it out later
yes
ShareX?
yes
is there !instanceof a thing?? (not instance of)
I upload the files to google drive incase I need them again so I use a shorten url to make the link look better
I'm pretty sure you have to use !(x instanceof y)
But my ide is not complaining for using that
some websites / apps have a max length for URLs and some websites go ham and give you urls that exceed 2048 chars
anyway gnight flaz ❤️
Gn, have a good sleep
yea, cya ❤️
See ya 👋
google image links be like
yea
Code :
let modules = ["Config", "Music", "Other", "moderation"]; modules.forEach(function(module) { fs.readdir(`./commands/${module}`, function(error, files) { if (error) return new Error(`${error}`); files.forEach(function(file) { if (!file.endsWith(".js")) throw new Error(`A File Does Not End With .js!`); let command = require(`./commands/${module}/${file}`); console.log(`${command.name} Has Been Loaded - ✅`); if (command.name) client.commands.set(command.name, command); if (command.aliases) { command.aliases.forEach(alias => client.aliases.set(alias, command.name) ); } if (command.aliases.length === 0) command.aliases = null; }); });});```
error :
does every command exports the allias property? bcs its undefined
where did you define command.alliases? your snipped is not that easy to read tbh
client.aliases = new Discord.Collection();```
where did you reference your aliases to commands? otherwise your probably want to use client.aliases instead of command.aliases
Does anyone know any sort of website or API that can track the amount of users use my bot commands per day
you could do it yourself with using a Time Series Database and something like Grafana
you get what you pay
It should get the work done
but if you have a credit card Google and AWS offer 1 free year
Till 80 ish server ?
if you dont throw around with resources you can easy run 500 Servers
Is 80 a lot? For a small bot with a few moderation commands, no. For a music bot, yes it's too much
Technology is a lot closer to art and magic than it is to science, and too many times the only answer is "IT DEPENDS"
O
My music bot would probably crash an AWS instantly lmao
depends
It's in 2k+ so
if you pay you can run it
I don't think a 1 GB AWS could handle that
I've had 4 bots and 2 websites all running on a $3/month VPS, whereas some people can't even host one music bot anywhere because music bots take soo many resources.
Mine is in 3k and barely runs on less than 100MB
yea this is why i make a large Circle around Music bots. they are Annoying to deal with. also your probably get more problems if google decides to ban your IP
There are public proxy networks
YouTube usually bans my IP but I used cookies to try and prevent it
Invidious is pretty good
A VPN on your host could work too
Depending on where the proxy or VPN provider you're connecting to is, though, you will get region blocked depending on the track you're trying to load
also yea if you want to run a large Music bot your probably need a large wallet to scale your hardware
Not particularly. You can get by with a few low tier VMs. I source some VMs through OVH in different parts of the world like France and Singapore and that covers audio for those regions through LavaLink. The main VM is the one you might have to put some money into. Even then, Contabo offers some cheap US-East VMs
im done with OVH had my issues with them in the past. if i want a OVH server ive probably go to a OVH reseller they are sometimes cheaper than OVH.
but yea
its possible but gives you headache
I haven't had too many issues. The portal is pretty slow, but not that big of a deal if everything is over SSH. The CPUs could be better is my only complaint. 2GB of ram for $3 and some change is good
i guess the Difference is that ive rented a Root Server on OVH for a while, and had some Game servers running on it
Doubt, you have a set container size and if you require more than what the container has to offer then your processes will crash because they're out of memory or backlog because you're CPU is capped to 100%
hey guys whats the alternative for ctx.filter for node canvas ?
can I look for line breaks on a message?, like... lets say I want the bot to clone the last message from someone with the exact same line breaks
something like this:
User message:
Bla
bla
Bot message (replacing the words):
Ble
Ble
backslash n
\n
hey guys whats the alternative for ctx.filter for node canvas ?
-_-
not that... i ment how to detect it on a message
u mean split it?
huh ?
okay nvm I think I got it
oh just split it like ```js
let a = str.split("\n");
why would I split it

what I was looking for is to copy a message and replace some stuff but preserve the break lines
I was breaking my mind with no reason
.replace()
hmmmm
I mean, splitting, doing your replacing and then joining with a breakline is a way of doing it. But yes .replace is the way to go
i thought u want to replace every last character from every line break
wait is there a COMPETING status ?
Yes
what other statuses are there ?
listening watching playing streaming
watching playing streaming listening competing ?
Nope, only for users
For statuses?
yes
Yes
it's offline in discord.js
How did you set it?
client.user.setPresence({
status: status,
activity: {
name: status_text,
type: game,
}
});
setTimeout(function(){
client.user.setPresence({
status: status,
activity: {
name: status_alt.replace("{{guilds}}", client.guilds.cache.size).replace("{{members}}", client.users.cache.size),
type: game_alt,
}
});
}, 5 * 1000);
}, 10*1000);```
It could be a bug with discord.js
İm using discord.py good ?
is it possible to make a custom command name? just like custom command prefix in discord.py
100% possible
how?
I mean, custom command name per guild
is there a way for users to change a command name?
s!eval const listedChannels = [];
client.guilds.cache.get('317068464215031818').then(async (guild) => {
guild.channels.forEach(channel => {
if(channel.permissionsFor(guild.member.me).has('VIEW_CHANNEL')) listedChannels.push(channel.name);
});
})
message.channel.send(`You have access to: ${listedChannels.join(',')}`)
thats not this easy tho, since you load all commands on startup you need to hot reload all your commands each time someone updates the custom prefix
TypeError: client.guilds.cache.get(...).then is not a function
-> causing lag
hmm...
in js its easy
you still need to hotreload or atleast push the new commands into a collection
yea in js is possible
but idk in py
s!eval const listedChannels = [];
let guild = client.guilds.cache.get('317068464215031818')
guild.channels.cache.forEach(channel => {
if(channel.permissionsFor(guild.member.me).has('VIEW_CHANNEL')) listedChannels.push(channel.name);
});
message.channel.send(`You have access to: ${listedChannels.join(',')}`);```
probably yes
nice, finnaly got an idea how to handle the WS stuff but now im stuck somewhere else, exporting an Object async since its generated when the Websocket connects. Probably there is a easy fix but rn im stuck somewhere
Ok so
const listedChannels = [];
let guild = client.guilds.cache.get('317068464215031818')
guild.channels.cache.forEach(channel => {
if(channel.permissionsFor(guild.me).has('VIEW_CHANNEL'))
listedChannels.push(channel.name);
});
message.channel.send(`I have access to: ${listedChannels.join(',')}`, { split: true });```
RangeError [SPLIT_MAX_LEN]: Chunk exceeds the max length and contains no split characters.
What I could think of is to make a dict that has server ids as keys and another dict as value which has key (the custom name) and the value (the real command name).
custom_commands = {some_server_id: {'asdas': 'ping'}}
then patch the get_context method of the bot. This is a snippet of get_context method, you can do something like, ```py
some code
guild_id = getattr(message.guild, 'id', None)
actual_command = custom_commands.get(guild_id, {}).get(invoker, invoker)
ctx.command = self.all_commands.get(actual_command)
return ctx
Though I'm pretty sure there's an easier way to achieve this, it's just how I would do, I guess. I'm not sure either if this is gonna work with group commands
const guildDB = await handler.useGuildDB(client, message.guild.id) guildDB is undefined on console.log
any clue?
what database did you use?
mongo
problem with handler.useGuildDB
and you want to create a new Collection for each guild?
no
hmm
hi
yes
Thank you for the response! It took me some time to understand the code. I will try that solution. It will be easier for me because I disabled DMs on my bot.
Its creating db but cannot fetch data from database
I imported handler where USERDB is
any help
use {split: { char: "," } }
Since your separator is a ,, not a newline
how can you define an object in js like
let obj = {
thing1: 69
thing2: -
}
//how do i make thing2 the value of thing1? or do i have to do
let obj = { thing1: 69 }
obj.thing2 = obj.thing1
```?
Alright Thanks
const guildDB = await handler.useGuildDB(client, message.guild.id) guildDB is undefined on console.log
data is saved in db
but cannot fetch it
@pale vessel any help. ?
I'm not sure what handler.useGuildDB is
const handler = require(''./model/db")
data is saved in db
but cannot fetch it to use.
you're not actually returning the value
it's inside the then()
try adding return before await client.mongo()
so that it would actually return the data from that then() cb
client.mongo() is connection to db
Yes
ok
Worked Thanks
p.s. return await is redundant, since you'll need to await it either way when calling the function so you can remove that await (return client.mongo())
👍
is there another way to do
let obj = {
thing1: 69
thing2: function() {
return this.thing1
}
}
``` without using a function? i mean it doesnt really matter if there isnt but is there?
just call the key in the object?
You can make thing2 a getter at least
Without a function using this keyword wouldn't help since it's locked to the window
let obj = {
bruh: "Test",
moment: get function() {
return this.bruh;
}
};
obj.moment; // Test```
when i do that it says unexpected token function
I think get doesn't work on anonymous functions
o
let obj = {
bruh: "Test",
get moment() {
return this.bruh;
}
};
this works
if message.guild.members.cache.random() gets 1 random member from the server
how to take 2 random users from the server?
like so im 100% sure that both of them aren't the same person
random(<number>)
Yes
Collection.random is an actual method?
it works for me
Yes it's
Collection is just a class extending Map with additional helpful methods
I know what Collection is lol
Loggers
at NativeTopology.close (E:\DiscordBot\node_modules\mongodb\lib\core\sdam\topology.js:333:38)
at E:\DiscordBot\node_modules\mongodb\lib\mongo_client.js:269:21```
getting this err
When that line is taken out, the function works.``` https://stackoverflow.com/questions/59942238/mongoerror-topology-is-closed-please-connect-despite-established-database-conn
return await client.mongo().then(async mongoose =>{
try{
let data = await guildSchemaDB.findOne({ id: guildID });
if(data){
return data;
}else{
data = new guildSchemaDB({ id: guildID });
await data.save().catch(err => console.log('MongoDB guild DB error'));
return data;
}
}finally{
mongoose.connection.close();
}
});
}```
read what the solution is.
When that line is taken out, the function works. which function?
bro dont make fun of me for this cause i dont understand regex much but will this regex filter it only so it will show a valid channel?
like if it doesnt have # or <#id> it will return a message
const regex = / [ <#> ] /gm```
and i made it an array thingy cause if i removed it it would only look for <#> not < and # and > and # and <#>
but its probably not
if its wrong dont roast the fuck out of me. i just thought of it 10min ago
connection.close?
should i remove it?
So you're trying to match valid matches of a channel in the message?
yes
hey
voice_client = client.voice_client_in(server)
player = await voice_client.creat_ytdl_player(url)
players[server.id] = player
player.start()```
can someone help?
bot not playing the audio
you spelled create wrong
If some kind of handler is silently blocking errors from reaching you, you should remove that
how?
Idk. I don't code in Python
what did i do wrong?
lol
async def on_member_join(member):
await ctx.send(f"welcome {member} to {ctx.guild}")```
is this code wrong?

``@client.command(pass_context = True)
async def play(ctx, url):
if not ctx.message.author.voice:
await ctx.send("You are not connected to a voice channel")
return
else:
channel = ctx.author.voice.channel
await channel.connect()
server = ctx.message.server
voice_client = client.voice_client_in(server)
player = await voice_client.create_ytdl_player(url)
players[server.id] = player
player.start(``
)
Like I mentioned, I don't code in python. You should probably read Discord.py docs for voice
loal
This is just me as well, but I would advise against trying to make a music bot unless you really have the money and know-how
ctx isn't even defined
events don't have ctx passed except on_command-ish events
i want help with the music thing rn
if you don't get any error, you probably have on_command_error event which suppressed the error like Papi said
wait
nop3
i don't thin
k
Traceback (most recent call last):
File "C:\Users\schwt\AppData\Local\Programs\Python\Python37\lib\site-packages\discord\ext\commands\core.py", line 85, in wrapped
ret = await coro(*args, **kwargs)
File "c:\Users\schwt\OneDrive\Desktop\Projects\py projects\bot\bot.py", line 164, in play
server = ctx.message.server
AttributeError: 'Message' object has no attribute 'server'
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "C:\Users\schwt\AppData\Local\Programs\Python\Python37\lib\site-packages\discord\ext\commands\bot.py", line 903, in invoke
await ctx.command.invoke(ctx)
File "C:\Users\schwt\AppData\Local\Programs\Python\Python37\lib\site-packages\discord\ext\commands\core.py", line 859, in invoke
await injected(*ctx.args, **ctx.kwargs)
File "C:\Users\schwt\AppData\Local\Programs\Python\Python37\lib\site-packages\discord\ext\commands\core.py", line 94, in wrapped
raise CommandInvokeError(exc) from exc
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: AttributeError: 'Message' object has no attribute 'server'```
loal
?????????????????????????????????????????????/
Are you following an old tutorial
That's meant for async branch, not gonna work on rewrite branch without making changes, I'd just make new one instead of porting it kekw
hello quick.db i can't install
I'm getting an error
check the docs
@earnest phoenix do you have windows-build-tools installed?
I had quick.db once, it deleted itself lol
I can’t reinstall it, as my operating system rejects the download
imagine using quick.db
Mongoose should handle connection closes whether they were graceful or not
Pretty sure it connects over ws
there are people who close the connection after a query but i dont think its necessary
If you pool your connections, you can
only that your bot is in 75 Guilds IIRC
also dont make now 75 Guilds yourself this will flag you
Well, they also check for if your bot has experienced artificial growth such as if you create a bunch of guilds

so no member requirement
Pretty sure they also don't count guilds the bot owns
adding the bot to DBL can also cause your bot to get flagged
(if the bot suddenly get to 100 Guilds in 2 days)
We don't know for a fact if there is a member requirement or not. For the sake of answering and logical thinking, I would say yes because only having 1 person in each guild your bot is in excluding your client is suspicious
lmao m asking generic growth
yeah ur bot can't 1) not be in to many guilds from the same owner(s) and 2) not get too much servers too fast
if you bot grows normally its fine
That's perfectly reasonable, I'd say
You shouldn't be worrying about verification, though

I can't check exact numbers because no presence intent
cached 2970 guilds at 169k users
well this are only cached members
Legendary users
Nais
BTW I have to still host my bot
And I don't even have a penny

now i have to figure out what the best way would be to export an Object created by a Websocket connection into another file to use it there. Database would be possible but could cause laggs if i get more guilds.
json :)
well its a json object
and writing it to a file would be stupid. since it gets hammered with 275 writes
Honestly though, I'd get a redis instance or make your own worker which syncs to disk periodically and implements a K, V storage system. Redis is really good for storing predictable key items

yea would be the next idea. but it doesnt really needs to be stored. initial the idea where to just keep the stuff in memory of the same process.
What exactly are you storing?
Oh. strings really take up a minimal amount of memory
yea
also it doesnt need to be persistent since i get the list anyways every time the WS connects.
Yeah. That reminds me. I need to start storing guilds in memory again.
Thanks, I suppose

I also need to start storing voice states in memory as well. Those are volatile data which is returned to you after every identify. Doesn't make sense to store persist
this is getting annoying. i would like to not use Redis but i guess i have to. or does someone here knows a nice way to export an Json object async ? (the object recives data after a Websocket connection where made)
?
Türk. Varmı
Tamam
Hey, anyone can help me real quick with an issue on my discord.py code? 🙂
No because we can't see your code
Bot A post an embed and edit it.
Bot B (mine) takes that embed and duplicates it.
But my bot only duplicates the original message not the edited version.
I can post code if someone might have an idea.
msg_bot = await client.wait_for('message', check=is_bot, timeout=2)
try:
_embeds = msg_bot.embeds[0]
except IndexError:
return
msg = await client.wait_for('message', check=is_correct, timeout=15)
msg_content = msg.content.lower()
if msg_content in ['a', 'b', 'c', 'd', 'e']:
msg_new = await ctx.channel.fetch_message(msg_bot.id)
_embeds_edited = msg_new.embeds[0]
# msg_content_bot = _embed.description
footer = _embeds_edited.footer.text
image = _embeds_edited.image.url
author = _embeds_edited.author
author_name = _embeds_edited.author.name
author_image = _embeds_edited.author.icon_url
color = _embeds_edited.color
timestamp = _embeds_edited.timestamp
embed_duplicate = discord.Embed(color = color)
embed_duplicate.description = re.sub('<[^>]+>', '', msg_content_bot)
embed_duplicate.set_author(name = author_name, icon_url = author_image)
embed_duplicate.set_footer(text = footer)
embed_duplicate.timestamp = timestamp
embed_duplicate.set_thumbnail(url=image)
await msg_bot.delete()
await ctx.send(embed=embed_duplicate)
await msg.delete()
if msg_content in ['a', 'b', 'c', 'd', 'e']:
After that, the original message gets edited.
Than i take the ID and try to duplicate that embed.
@quartz kindle
Oops my bad
Uh can you guys help me?
That HERE!
And then it shows a link how do I do that?
[HERE](google.com)
Obviously yes
you can't use it for field names
Hm
only in description and field values
:)
Reduce the \n that you put between the fields
but I think one space would look more compact and nicer
ah, just some multipurpose
by the way, you can set the title url
set it to your support server invite
I did
But it just said
what's your bot library?
Wdym? Sorry I’m kinda new to coding
like discord.py or discord.js
Like setTitle("helping commands").setURL("https://discord.gg....")
Which?
Can you show me your embed code
hello when i made a bot and i added a music command to it, but it stopped working today while it was working yesterday, it does not give an error in cmd, what can i do?
did you try restarting ?
have you tried putting it in rice
@pale vessel it’s very long tho
only the top portion
Remove that setTitle() inside that
the interesting part is that it does not give an error in cmd
the one with red underline
show some part of the code
can I send from direct messages?
@earnest phoenix it should be showing error Fix that Damn .setTitle line
remove what you added earlier
@earnest phoenix please delete the file you sent
let me guess, token?
yt api token
remove that setTitle and the rest
why
why is the .setURL inside that shit
Your YT token is in it
Idfk
ok
@near stratus where should it be? I want it like this
should i delete
you can add it in your description
Fine I’ll try that
@earnest phoenix gimme a moment I'm watching it right now
@earnest phoenix use the description as MD
@earnest phoenix Nothing personal but which country are you from.
(The names are kinda ..... ummm..... you know ..... wei..rd ..... )
@near stratus like what
im from turkey
Uh aGananna(anahhahabahhayabaga not working
yes I know the letters in Turkish language are a bit complicated compared to other countries
@near stratus
yeah I'm looking at it
anyway I'm going to study a little while you're looking so I might not be able to answer
Can't you do it normally like Text
Inside description
okay
I'll need some time getting it
Yes
does it frigging work ?
DM’s :)?
I'm downloading again
What is the node version?
Why is it not working lol?
Lol

Maybe try learning JS and it’s syntax before making a bot
Before you make a Discord Bot, you should have a good understanding of JavaScript. This means you should have a basic understanding of the following topics:
- proper syntax
- debuging code
- basic features (vars, arrays, objects, functions)
- read and understand docs
- nodejs module system
As much as we d like to assist everyone with making their bots, we rarely have the time and/or patience to handhold beginners through learning javascript. We highly recommend understanding the basics before trying to make bots, which use advanced programming concepts.
Here are good resources to learn both Javascript and NodeJS:
Javascriptinfo: https://javascript.info/
Codecademy: https://www.codecademy.com/learn/javascript
FreeCodeCamp: https://www.freecodecamp.org/
Udemy: https://www.udemy.com/javascript-essentials/
Eloquent JavaScript, free book: http://eloquentjavascript.net/
You-Dont-Know-JS: https://github.com/getify/You-Dont-Know-JS
NodeSchool: https://nodeschool.io/
CodeSchool: https://www.codeschool.com/courses/real-time-web-with-node-js
Evie s Accelerated JS: https://js.evie.dev/
Please take a couple of weeks/months to get acquainted with the language before trying to make bots!
Can anyone help me out with autoroles and reactroles
Sure
Python 3.8*
sorry I don’t do python
I can give you a basic idea of how it works

Python is easier
ok so I assume you have a database?
I know
Lmao
I also one time got nuked
Dude
Like every server i got ove 5k members git nuked
Bruh
Already 7
My one 2k server got nuked
I want a small comunity for this reason
One admin did it lawl
Yeh same
People don't know the pain of getting server nuked
Anyways my bot is rn in 23 servers and 4k members
And it ain't even hosted
then get a Host
Pro or wot
or get something that can run it at your home
Umm where?
who invites a Bot who is not aviable 24/7?
Mine is running on android root with linux raspbian Touchscreen mod
Lawl
24/7
Nais
@scarlet stratus lmao
Anyone share his good support server
But its good
Why r u not verified?
@earnest phoenix lawl
Huh?

Waah

U looks like a knowledgeble person @scarlet stratus
Which I don't find these days
Lol
I am sure there are a lot of genius people here
BOTGHOST
Ik
BAHAHAHHAAAAAAA
I asked which language he said swedish I was like waw wtf
I am just a 16 year old that started coding with 13
I m 14
Oh nice
If genius is considered someone who doesn’t use bot creators then I’m a genius lmao
thats like 70% ther answers here
Lawl
I wanna make a bot in rust but I need to get more of the basics down
"what is library"
What is a bot creator?
shit, it’s shit.
+1
the i want to code a bot but not learn any language are the best
kekw same.
any other less bad free hosting then replit
i dont want my files to get stolen xd
@near stratus im come
get a paid one
I'm trying to get a message and a embed in the same message, Like when you post a image and message, You have the text then the image, I want to do this with a embed, I checked the docs (discord.js) and I can't find it, but i did it with a webhook a year ago though, and i forgot how to do it, is it webhook only?
it*
vps @stuck pike
or like i said yesterday look into the 1 year free credits AWS or Google Offers
vultr gives you free credit
also look into github student pack
you might have a misconception
an embed is a part of a message
right so I just send a embed and a message in the same message?
I meant that
but yes, look into https://discord.js.org/#/docs/main/stable/examples/embed
Oh I didn't see the bottom bit
setting images is possible with these two methods
https://discord.js.org/#/docs/main/stable/class/MessageEmbed?scrollTo=setThumbnail
https://discord.js.org/#/docs/main/stable/class/MessageEmbed?scrollTo=setImage
the former is the smaller image on the right hand side, the latter is the big image at the bottom
So it would be message.channel.send('hello', embed)?
correct
Alr, thanks
if you don't want to send text you can completely omit the first param
does anyone knows best host for discord bot
because heroku don't host discord bot 24/7h Exactly
Yes i know
rent a vps from galaxygate/digitalocean/any other trusted provider
hmm does it free?
no
the resources your bot uses have to be paid for, someone has to pay for the power your bot uses
and it's going to be you when renting the vps
there any free hosting because i don't have creadit card
or paypal
bank transfer works for some hosts too
seems like a you problem 🤷♂️ you won't find any quality host for free
look into creating a debit card
hmm my country is poor don't had paypal and cards
Amazon has pretty good free plan, but requires credit card link for activation
a vps is super cheap
look into creating a debit card with your parents, you can't go in debt and you can only use money that's on the card
this is also possible with a giro account
ok
stats.json doesn't contain valid json
send stats.json screen (careful not to leak credentials like tokens and passwords)
you don't have valid json format in that file
I'd say you're trying to write a wrong format into that file then (line 68 in your index.js)
JSON format looks like
`
{
"value1": 30,
"value2": "string",
"value3": 3,
"object": {
"objectValue1": "string",
"objectValue2": 15,
"objectValue3": 180,
}
}
`
a json file cannot be fully empty
I'm pretty sure an empty string is not valid json
an empty valid json still needs to have {}
so what should i exactly do @smoky herald @quartz kindle @cinder patio
M just 14 so for now i cant
i need a decent free one
for now
You likely won't find one.
rip
could use AWS free tier
I think it lasts a year but the low-power EC2 instances after that are super cheap, like 20 bucks a year or something
@karmic merlin fetch the user with client.users.fetch('id') which returns a promise, resolve it and then send the message to the user using send() method
let member = client.users.fetch(req.vote.user);
member.send('something')```
? @grave mist
and this
let member = client.users.fetch(req.vote.user);
member.send('something')```
in this
app.post('/dblwebhook', webhook.middleware(), (req, res) => {
// req.vote is your vote object e.g
console.log(req.vote.user) // 221221226561929217
}) // attach the middleware```
Im a biggus noobus in bot building so how do you verify your bot?
Do you know about JS promises? @karmic merlin
not a lot
Im a biggus noobus in bot building so how do you verify your bot?
what do you mean ?
WHAT DO YOU mean "WHAT DO YOU mean? how do you verify your bot?
yes but how do i check my bot by testing it
Ohhh
Well then, to make it simple for you, I can spoon feed but you'll have to learn about how to resolve JS promises eventually
client.users.fetch(req.vote.user).then(user => user.send('something')).catch(error => console.error(error))
or
try {
const user = await client.users.fetch(req.vote.user);
user.send('something');
} catch (error) {
console.error(error);
}
That's how you resolve promises using .then or await with catching the error (if it happens) and throwing it in the console
it'd be a good idea to read up on Promises since most things nowadays are asynchronous.
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise
The Promise object represents the eventual completion (or failure) of an asynchronous operation and its resulting value.
await is only valid in async functions.
and I put it in the event ready?
No, I've already said where you'll do that in #topgg-api
yes I no
in this
but
the webhooks must be put in the event ready? @grave mist
Well, that's your choice to put wherever you want, personally, I wouldn't put it there
Anybody else here on Eris and have their bot lose connection to Discord every single time?
Eris should auto reconnect byt it doesnt
After a few mins or hours the bot will just shit itself and not reconnect
did you get errors?
Yeah hold on
you're not
nobody sucks at programming
i can prove you wrong
Happens regardless of what hardware its running on
yea your bot is not sending Heartbeats properly
if you miss to many Discord thinks the connection is dead and cancle the connection
it's heartbeat stopped and it literally died
Poor bot
websocket is fun, if you understand how it works.
Press F to pay respects for the bot
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
How is that possible
this code is fine just inefficent
people be like: i dont know how to code stuff so i suck and i can never be better
that's the definition of n o o b
Nub
ive worked on the past few days on making a Dashboard for my bot. the Landing page is a White page with a button in the top left corner saying login
If any of the results are null the entire process crashes
sure the entire backend works but i suck
well yea bcs its not really well made. did you want to get all results at once?
i would make a Loop and then push the results into an array
What is this error
type: 'error', message: 'WebSocket was closed before the connection was established',
It keeps happening randomly and idk how to prevent this
if something errors out you can then just handle the error properly
Yeah the author could've just use Promise.all and convert all the callbacks to return promises instead and work from there while handling cases for when the weather info couldn't be found
but still so many requests for that
well he makes a freaking check for every country. just make an array with the countrys you want to check and then use a loop and use the countries as query item
will clean up the entire code a lot
also he will probably get Rate limited by the API
bcs he makes 25 API calls each time this code runs
It's not a Turkish bot, it's a German one
The level of disappointment I have is so large it needs to be a string else js cant handle it
weather.find({search: "Germany
well after this it searches for like 6 States, Disneyland and the Big Ben
hell was too much for ye, eh?
i think the entire bot is a meme that maybe works
i have seen hell
the entire internet is a copyright infringement hell of memes
that screenshot terrifies me more than hell
well thanks to lite we did open it
Anyone know what this is WebSocket was closed before the connection was established
your Websocket connection failed. did you get an Error Code?
lmao i've fallen in love with netdata
litterally says what happened
the funny dials go brr
Of course it does yet no server can explain how it occurs or how to prevent or fix it
discord.js
uhh
does ur anti virus block anything and make the websocket close
which version of discord.js
hmm









