#development
1 messages · Page 859 of 1
then to mix them up you can do this ```js
let minutesAndSeconds = ${Math.floor(minutes)} minutes and ${seconds % 60} seconds
or that yeah
Does anyone know what this is? After updating discord.js, something doesn't work. (ReferenceError: Discord is not defined)
whats your node.js version?
send code?
you need node.js version 12 or higher
also Discord is not defined means that the variable Discord does not exist
did you define Discord in your code
@queen needle the difference between writeFile and writeFileSync is that writeFileSync will stop your process until the file has completed writing
shouldnt it be a const
doesn't matter
doesnt matter much
but you shouldn't have tp change it
const just makes it so the variable can't be changed after decleration
like var Discord = require("discord.js")
@marble juniper I put it this way: const { RichEmbed } = require("discord.js");
so if i constantly update the file i should use writeFile @quartz kindle
yes
cuz with { } you destructered it to only have the RichEmbed variable
yeah(says yeah to sound smart)
if you want it to be Discord just do
const Discord = require("discord.js")
in short ```js
Discord = require("discord.js")
new Discord.RichEmbed()
or
{ RichEmbed } = require("discord.js")
new RichEmbed()```
yes
ok thanks
i just dont bother with rich embeds i dont understand how they are different to real embeds
RichEmbeds is literally just a embed builder
Another question. Is it possible to create a script that will run the bot again after the crash?
ok thank you so much
I want to store the user's time in SQL, but if I load it that way ```js
const accountsss = message.guild.member(message.mentions.users.first() || message.guild.members.cache.get(args[0]));
con.query(INSERT INTO osu (uid, osuid) VALUES ('${accountsss}', '${args[1]}'));```
then <@> may also be there for me to remove <@> sql upload
thanks
What is the maximum of embed fields in embed?
25
or is it?
yes it is, you can have 25 embed fields
just makes sure you stay under the total embed limit of 6000 characters
https://discordapp.com/developers/docs/resources/channel#embed-limits
but is it?
Yes it is
why can't y'all just let me be mysterious
cuz it's #development, not #memes-and-media :)
so I have this problem that if I update 1 thing in my 1 database
the second database gets also updated with the same content
and in my code I am not using the second database
only the first database
so that makes no sense
does anyone use heroku?
Sorry I can't help you, I've never used quick db properly before :^)
move onto better-sqlite3 when 
why would you use a db
s**tpost in #memes-and-media ty
For saving configurations
for example, customisable prefixes, settings, etc
leaderboard scores, mod-log cases
i might have to learn how to use a db then
It's a vital part, yes
what db should i use
uh it depends on what you're familiar with
wdym
you can use things like sqlite
or mongodb
also there are different kinds of databases
there are local file databases
or database's where you need a connection and so on
try them out and then use what you prefer and think is easier to use
How would I get started on setting up a webhook on my server to listen to DBL?
Official DBL wrappers support simple webhooks
I'm not really sure how webhooks work
Just a server running on a machine, waiting for requests
Ah I see
What would I have to do once a server's set up and all? Do you know a good walkthrough perhaps?
On your bot's Edit page and fill out the webhook URL (http://<ip>:<port><webhookPath>) and authorization field
I think I'm either missing that 1% or misunderstanding most of it. To set up that webhook, do I not have to configure something within the server my bot's hosted on?
no
Open a port, that's about it 
the term "webhook" is basically used to mean a reverse request, ie: instead of you making a request to some service, the service makes a request to you
discord webhooks are for sending data to discord that way (discord becomes a webhook receptor, so you can send webhooks to discord)
you correcting my definitions? wanna go? 
Oh okay, that makes sense to me
Shiv u just got 1 upped
Can't believe I got wiped by a JS dev
Humiliating
lmao wut
I hope I'm doing it right this time. I set the webhook's url within the api options for my bot to <ip>:<port>/dblwebhook and the dbl variable is set to const dbl = new DBL('<token>', { webhookPort: <port>, webhookAuth: '<auth>' }, client); but it keeps printing "Webhook running at http://0.0.0.0:<same port>/dblwebhook" instead of the assigned IP
Anyone know how i can get the role size on discordjs v12?
0.0.0.0 just means "this machine"
Hello, someone with this error? Prism is not a constructor
Ah of course
@hybrid ruin ipofthemachine(or your connection):port/dblwebhook
Gotcha, thank you
guildMember.cache.roles.size?
Go ahead
(node:21678) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'roles' of undefined
To get the amount of roles a guild has, you're looking for guild.roles.cache.size
Any time
help what discord permission is required to change (voice) channel permissions
i thought it was Manage Channels but apparently not
hello. i am trying to host my bot ondiscloudbot.com but it says there is an error with my requirements.txt. an somone take a look at it>
const userBest = await osuApi.getUserRecent({ u: 'hheadshot', m: 0 });
console.log(userBest[0]);```
Console:```js
counts: {
'50': '0',
'100': '0',
'300': '315',
geki: '47',
katu: '0',
miss: '17'
},``` 50, 100, 300 ```js
console.log(userBest[0].counts.50);``` HMM???
you cannot access indexes by number like that
you have to use []
counts[50]
counts.bla only works when it starts with a string
a.b works
a.b1 works
a.1b doesnt work
a.1 doesnt work
a[1] works
a["1b"] works
I'm looking for someone to join me in developing a typescript bot powered by discord.js, dm me if interested uwu
someone say a try it and see question xd
save prefix in a schema with guild id
make the db and call it for each message to look at the prefix
can you help me with it, i am new to mongo
Im having an issue with my bot :
Im having an issue with my bot code :
callme = ['smarrbot', 'smart' , 'smartbo' , 'martbot' , 'sartbot' , 'sartbot' , 'smartbo' , 'smartbt' , 'smarbot' , 'smarbot'];
callmevalue = false
ban = ['ban', 'bannir' , 'banir' , 'banir le' , 'bannir le membre' , 'ban le membre' , 'ban the user' , 'ban an user' , 'ban the user'];
banvalue = false
client.on("message", async message => { let msg = message.content
callme.forEach(item => {if (msg.includes(item) ) {callmevalue == true;} });
ban.forEach(item => { if (msg.includes(item) ) {banvalue == true;} });
if (callmevalue == true && banvalue == true) {
message.channel.send("Okay !")
return;
}
if (callmevalue == true) {
message.channel.send("Okay !")
return;
}
})
I don't understand why it is spamming that much for no reason
I have a big problem, I don't know what happens, but my bot doesn't work anymore, I already have the code ready, and it doesn't work, just turn on and nothing else, try another bot just changing the token and it works, but not with my bot's token. :C
first : what the fuck c quoi ce bordel
second : return message.channel.send ?
@earnest phoenix
return; c'était pour couper mon code mais ca sert a rien
it doesn't have to be return
Ignore le 😂
The return isn't the source of my problem, i tried to add it to like block my code but its snot working 😂
@tight plinth
J'avait oublié le ping :')
hm
oh shit
i just understood
I forgot to block bot messages and also reset my banvalue and callmevalue
lol
Cuz new message as its always true cuz don't rest it , of course its looping asf 😂
u know how to do, dont u?
Do what ??
block bots + resetting
I mean block bot i can find that
https://lumap.is-inside.me/SRtVrnoD.png par contre...
Je fait ce que je veux de mon status Mdr
Tu ne me semble pas très convaincu 😂
a bon tu crois?
Un peut
(lets not talk french here)
Yeah we are gonna get killed
yep
Im trying to make an old bot i made before
blocvking boz is ez
@tight plinth is there a way to do like if message.content.contains[myarray]
Instead of looping ?
Does anyone know how to rewrite my code: https://pastebin.com/sg8iz7Gq so that item no. 1 (picture below) will remove when I choose a song. And if I select a song using the link, so that 2 messages also delete, not 3 as in search.
@tight plinth i mean can i just .contains(array)
Because i need to do a for each item in value..
























its not that i don""t try
its just i don't know how to do it if its even possible
process.exit()
will this work?
oh wait
wrong channel
my bad
just ignore what I said
so, does anyone here have experience with pgadmin4?
I'm almost losing my head trying to fix "CSRF session token missing" issue
i need help ... i need to know what prefix is
__s!__somecommand
^-----prefix
the prefix is a command ? like !something ?
the prefix is something that comes before the command
why are you asking
it could be:
__!__somecommand
__%__somecommand
__prefix!__somecommand
__--__somecommand
__!#$__somecommand
or anything else
pls meme
i just wanted to know because i am trying to add a new bot
ok, go on then
How can i log a Enmap Map like: console.log(the_enmap_thing)
does it respond to commands etc because if it doesnt then close the website right now
Hello
of course it respond commands
can someone help me make a prefix command in mongoose
aight then carry on
All i've got so far: ```js
try {
let guild = await GuildModel.findOne({ id: message.channel.guild.id, prefix: prefix });
if(!args.length) {
message.channel.createMessage(the prefix is: ${guild.prefix});
} else {
GuildModel.findOne({id:message.guild.id}, (err, db) => {
let nP = args[0];
})
}
} catch (e) {
console.log(e);
message.channel.createMessage(`error\n${e}`);
}```
@digital ibex what's the issue?
I would just use findOneAndUpdate using the $set operator on a prefix key
if you use a database then you just need to update the prefix column
this is my first time using mongodb compass
I don't use mongobd, so I can't help u with that
I gave you an option you could use
but in sql would be a simple update transaction
I just connected to the compass and i dont know what to do from here to make the command
Are you using the official mongo driver from node or another package to interface with it?
Help me pls :c
anyone know anything about glitch?
i am using mongoose
Yes, mag.
Alright, I don't know much about mongoose, but it should have a findOneAndUpdate in it which should work the same
does glitch support node 12
okay
I would also look into upsert as well, but you don't need to
@hasty valve you can just go into the package.json and then find where the node version is located and then just change the number to your desired version and then it will beginn an install process so yeah you can update node on glitch
How to clean all messages sent by bot in my dm? (Discord.js)
You fetch all messages by bot, and delete them.
fetch the messages from the dm channel
can i get the code?
Code it yourself :P
We'll help you on your way :)
Okay. thank you ill try it
Use a mobile device, and copy text - and it should be there. Or fetch message
wut
yes
was gonna ask what language you used in your error eval code block
then i realised its just js
```js
```
ty
yeah
would i do it like this?
let newPrefix = await GuildModel.findOneAndUpdate(filter, update, {
new: true
});
To change prefix?
yeah
what is your modal?
this? ```js
const Guild = Schema({
id: String,
ownerID: String,
memberCount: Number,
prefix: String
});
ye, it's fine
you would do something like this
await GuildModel.findOne({
id: guild.id
}, async (err, guild) => {
guild.prefix = (prefix)
await guild.save().catch(err=> console.log(err);
});
I've not been able to use findOneAndUpdate
but I'm sure you're able to
with this you would find the guild you would want to change prefix of
with the guild id
and you would update the value and save it
the GuildModel will be the one to your guildSchema file
If you use it correctly, yes.
There’s like a web panel to see your data base entries with mongo right?
Wdym, Boss?
Ya I’m pretty sure it has it I’ve used it before
what would i define my prefix as then in my command handler file?
Wou would need to use the findOne again
and find the guild.id
You need to set it as a variable
like let guild =
with eris its message.channel
Oh
and with d.js guild takes a channel property as well
wdym?
You named the variable prefix
to call for the prefix you would need to use prefix.prefix
also remember to use await before calling the guild.findOne
What do you have so far?
okay
You got it?
so like this? ```js
const Guild = require('./models/Guild.js');
let prefix = await Guild.findOne({id: message.channel.guild.id })
instead of let prefix = use: let guild = so we can define the prefix after
okay
How can i detect if a message contains a mention ? old methods don't seems to work..
then you can define the prefix let prefix = guild.prefix
What method @earnest phoenix does not work?
const GuildSettings = require('./models/Guild.js');
let guild = await GuildSettings.findOne({id: message.channel.guild.id })
let prefix = guild.prefix
like that?
Yes.
uh
@elder vine ```
let member = message.mentions.members.first();
if(!member) message.channel.send("Please mention a valid member of this server"); return;
if(!member.kickable) message.channel.send("I cannot kick this user! Do they have a higher role ?"); return;
What djs version?
oh, ok
You need to create a collection first
Last one
with the modal
what is a good name to call it?
Alright give me a sec XPY.
.cache
message.mentions.members.first() should work?
so i should just call it "Guild"?
Yep
wdym make it using code?
You could use some of your old code in the message event:
const GuildSettings = require('./models/Guild.js');
let guild = await GuildSettings.findOne({id: message.channel.guild.id })
then just use if(!guild) to check if the guild doesn't exist.
no
if guild does not exist you would need to make it exist
by making a new GuildSettings
@elder vine doesn't work for me
Alright so.
let newGuild = new GuildSettings({
modal_here (with filled in values)
});
await newGuild.save().catch(e=>console.log(e));
so
id: String,
ownerID: String,
memberCount: Number,
prefix: String
Your modal right? so
id: guild.id,
ownerID: owner.id,
memberCount: members,
prefix: default_prefix
how do i Fetch a message and edit this message? (djs 12)
textChannel.fetchMessage('123456789012345678');
@digital ibex where am i suposed to add it ? That cache shit is so fcked up 😂
like my Bot sends a message and then restarts. Fetch the message and then edit
yeah ik, but shrug
let member = message.mentions.members.cache.first();
you could write the id of the message in a temporary file then when it restarts make it read the id in the file then fetch the message delete the file and THEN edit the message @sterile minnow
change ur <member> to that
at least thats how I would do it
or use your db
salut smartbot ban @[LEXA] Smart
Did you use v12 Tayron?
yes
probably use .cache
channel.messages.fetch('123456789012345678');
channel.messages.cache maybe? idk
(node:2880) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'first' of undefined
let member = message.mentions.members.cache.first();
iirc that is
.cache is not a thing..
it is
not in message.mentions
da heck
Why glitch :(
xD
.cache is v12 btw
I guess read here
bc i'm broke lol
$3/month for a pretty good vps
its Undefined
also
https://little-files.glitch.me/data?file=83PZ61JM.png https://little-files.glitch.me/data?file=17AN50ZM.png
You change the values to what it should create in the new guild, @digital ibex
where would i put it?
you could try awaiting it@sterile minnow
i try
oh
but you need to use the other part i sent too
How would i check if someone sent a message in a certain channel? Using discord.js btw
im so confused leny
yeah, and im more confused :/
What did you write down so far?
if(!guild) {
id: guild.id,
ownerID: owner.id,
memberCount: members,
prefix: default_prefix
}
``` haven't put it in it yet bc there will be syntax errors
not quite
:/
yeah i know how to get the channel and all im just trying to is send a message everytime someone else sends a message in a certain channel basically
if(!guild) {
let newGuild = new GuildSettings({
id: guild.id,
ownerID: owner.id,
memberCount: members,
prefix: default_prefix
});
await newGuild.save().catch(e=>console.log(e));
}
So any fix for my code ? 🤔
Well - wdym Puddin?
okay
Lile i have a suggestions channel, and it gjves them bot currency for every message they send in suggestions
like if(message.channel.id === "id") {
let channel = client.channels.cache.get("send_id");
if (channel) channel.send(message.content);
}
So im rryna to make the bot give the reward everytime a message is sent to the message author in the suggestions channel
Hold on
ok,
So i have a suggrstions channel.
Everytime a member sends a message in the channel, i want it to give them the reward
What im tryna ro do is figure out how will i make it so the bot will know when they sent a message
this is what i have in my message event
use the message event puddin
const GuildSettings = require('./models/Guild.js');
let guild = await GuildSettings.findOne({ id: message.channel.guild.id });
let prefix = guild.prefix;
if(!guild) {
let newGuild = new GuildSettings({
id: guild.id,
ownerID: guild.owner.id,
memberCount: guild.memberCount,
prefix: 'a!'
});
await newGuild.save().catch(e=>console.log(e));
}
``` minus everything else unrelated
and- oh
guild.id would be like: message.guild.id
oh
ownerID is message.guild.ownerID or message.guild.owner.id
^
and an existing guild would be ```js
let oldGuild = GuildSettings.findOne({
id: message.channel.guild.id,
ownerID: message.channel.guild.owner.id,
memberCount: message.channel.guild.memberCount,
prefix: message.channel.guild.prefix
Yep
oh
not message.channel.guild.prefix
oh?
why the unnecessary .channel?
GuildSettings.prefix?
He's using eris
using eris
uh
the default for any guild prefix
ok
How can i overwritePermissions to all the roles in a server?
ok, this is what i have
use a loop
forEach role
no
const GuildSettings = require('./models/Guild.js');
let guild = await GuildSettings.findOne({ id: message.channel.guild.id });
let prefix = guild.prefix;
if (!guild) {
let newGuild = new GuildSettings({
id: message.channel.guild.id,
ownerID: message.channel.guild.owner.id,
memberCount: message.channel.guild.memberCount,
prefix: 'a!'
});
await newGuild.save().catch((e) => console.log(e));
}
let oldGuild = GuildSettings.findOne({
id: message.channel.guild.id,
ownerID: message.channel.guild.owner.id,
memberCount: message.channel.guild.memberCount,
prefix: 'a!'
})
forEach is slow
Well, you don't want to abuse Discord API
wdym
that'd cause api spam
api spam = against tos
no the last part
the oldGuild would be only id: message.guild.id
nothing else needed
not against ToS, just rate limited, afaik
like rainbow roles = api abuse /bannable
wdym?
well
probably wait for like a second after every role?
how do i do it
so remove everything else apart from id?
The findOne looks for all values and looks in db for existing values
it doesn't matter as long as your bot respects ratelimit headers, which if you're using a library, it probably does
memberCount, prefix, and ownerID can be different from times to times. but ID will never change.
Hi, I have a very weird problem: DMchannels' IDs seem to change after a few minutes. I'm doing a client.get_channel(dmchannel_id) a few minutes after storing it into a dictionnary and it returns None all of a sudden
the other way around
the problem is when you keep doing the same request over and over again which at that point it becomes api abuse - updating overwrites on each channel isn't
discord.py I assume KindleTune?
Yes
everything apart from id remove?
yea
channel.overwritePermissions(message.guild.roles.forEach), {
SEND_MESSAGES: false
}```
will this work without abusing?
What's with discord.py @elder vine
const GuildSettings = require('./models/Guild.js');
let guild = await GuildSettings.findOne({ id: message.channel.guild.id });
let prefix = guild.prefix;
if (!guild) {
let newGuild = new GuildSettings({
id: message.channel.guild.id,
ownerID: message.channel.guild.owner.id,
memberCount: message.channel.guild.memberCount,
prefix: 'a!'
});
await newGuild.save().catch((e) => console.log(e));
}
let oldGuild = GuildSettings.findOne({
ownerID: message.channel.guild.owner.id,
memberCount: message.channel.guild.memberCount,
prefix: 'a!'
})
``` like that leny?
why forEach?
but all roles
I'm just asking so someone else can help, since I don't know .py
or use a for() loop
@pale vessel wdym
woz that right?
each role will not be able to send_messages
oh
everything else is values that can change
Itay, you can provide the guild ID so "everyone" won't be able to see the channel
I used everyone
Hi, I have a very weird problem with discord.py: DMchannels' IDs seem to change after a few minutes. I'm doing a client.get_channel(dmchannel_id) a few minutes after storing it into a dictionnary and it returns None all of a sudden, just like if the ID was no longer valid (shouldn't it remain unchanged?)
Idk if its good enough
@lyric hawk No DM channel ids vary
I guess it is cause then only users with permissions can type...
you should store user ids
Well thanks,
and then get the user object and send via that
Oh okkk
Thank you for your help
So you can send either via dmchannel id or userid?
No difference?
Actually @digital ibex move this part:
let guild = await GuildSettings.findOne({ id: message.channel.guild.id });
let prefix = guild.prefix;
to the bottom under the if(!guild) {
}
//here
and remove the oldGuild variable
okay
discord.py: once I get the member, how can I change his nickname?
so, ```js
if (!guild) {
let guild = await GuildSettings.findOne({ id: message.channel.guild.id });
let newGuild = new GuildSettings({
id: message.channel.guild.id,
ownerID: message.channel.guild.owner.id,
memberCount: message.channel.guild.memberCount,
prefix: 'a!'
});
await newGuild.save().catch((e) => console.log(e));
}
let prefix = guild.prefix;
you can also do
if (!guild) {
guild = ...
}
...and then use guild```
^
Yea, that's actually better
okay
discord.py: once I get the member, how can I change his nickname?
??
assuming genders smh
let guild = await GuildSettings.findOne({ id: message.channel.guild.id });
if(!guild) {
guild = new GuildSettings({
id: message.channel.guild.id,
ownerID: message.channel.guild.owner.id,
memberCount: message.channel.guild.memberCount,
prefix: 'a!'
})
await newGuild.save().catch((e) => console.log(e));
} else {
//code
}
so like that?
let guild = await GuildSettings.findOne({ id: message.channel.guild.id });
if(!guild) {
guild = new GuildSettings({
id: message.channel.guild.id,
ownerID: message.channel.guild.owner.id,
memberCount: message.channel.guild.memberCount,
prefix: 'a!'
});
await guild.save().catch(e => console.log(e));
}
let prefix = guild.prefix;
yea
Yea
what happens to the guilds the bot is already in now?
Isn't this in the message event?
Whenever they message, the bot will make a new Document for the guilds on MongoDB and it can be used as prefix.
Just try it, and see.
some bots show title with hyperlink how can i do this on my bot?
but where?
oh, okay
.setURL("url") @potent tree
thanks
You can also use text in the setDescription etc.
There you go
now, run the bot. And type something in a channel where it's in.
It should create a document
Then hit this:
https://leny.is-inside.me/oG2MWDpf.png
i refreshed it as well
Weird
oh
Any errors?
What error?
Did you fix?
did it create it now?
xD
more errors
im fixing them, they're just mistakes like guildsettings is not defined
ok
?
no errors
this might be the issue
i might be looking in the wrong place?
oh, yeah
it was :/
sorry
oh, nice
why do they have the same ID but different owner IDs?
I am not sure why you're even storing ownerIDs / memberCount
they don't
you can get that with the guild ID
i want to make a blacklist feature, where if the owner is blacklisted, the bot leaves
and membercount is just for me tbh
ok
I will sent a picture of my guild storage
but yea, why two of them..
most of it gets migrated in the rewrite
so it only gets the preifx and shit it needs
Lot's of customizations, I like it.
yeah
allows for most things to be changed
I need to create an api so I can make do stuff on web
around 3k docs per small storage
yikes
it would be way more but people arent really active in this server
In this server?
yeah
I have no "big" servers
and I only have 34 servers in total
by I have I mean the bot is in
Hmm
Well, I recently had to migrate my bot to a new token. So I had to get all new guilds
why?
Lost 2fa access to the Team Owner accc
OOF
only around 450 guilds tho
that sucks
still way more than my bot
So I coded this to send with every cmd, to hope that people would readd the new one before it completely goes down:
https://leny.is-inside.me/Eefesm0L.png
it doesnt need to exist lul
and u have to send an id or passport
or driver's license
await member.edit(nick='Test') Why doesn't this line change nickname in Test? (discord.py)
no errors
let guild = await GuildModel.findOne({ id: message.channel.guild.id });
let prefix = guild.prefix;
if (!args.length) {
message.channel.createMessage(`the prefix is: ${guild.prefix}`);
} else {
await GuildModel.findOne(
{
id: guild.id
},
async (err, guild) => {
guild.prefix = prefix;
await guild.save();
}
);
}
} catch (e) {
console.log(e);
message.channel.createMessage(`error\n${e}`);
}
await member.edit(nick='Test')Why doesn't this line change nickname in Test? (discord.py)
Can someone help me?
@elder vine uh, its not logging when a message is being sent
change nickname in Test?
Sense = None
what could be the problem? (Could not extract html5player key: https://www.youtube.com/s/player/4fbb4d5b/player_ias.vflset/en_US/base.js)
Im having issues understand the discord.js new update where embeds are changed and my code is not working:
let statusembed = new Discord.MessageEmbed()
.setTitle('Update Patch: 0.1')
.addField('Added Some X Dinos')
.addField('Lowered Melay.')
message.channel.send(statusembed)
}```
looks correct to me?
oh
You need a title and a description in the .addField function
You just provide titles
Ok
@cinder patio if (message.content === "-status") {
let statusembed = new Discord.MessageEmbed()
.setTitle('Update Patch: 0.1')
.addField({title: 'Added Some X Dinos'})
.addField({title: 'Lowered Melay.'})
message.channel.send(statusembed)
}
Thats my code now
It isnt showing the fields tho how come?
the format for a field is
.addField(name, desc, inline?)
...check the docs
ty
Sea
i was told to come here for help
i can help you set up a bot that will loop the song you want
alr
Oh
Hmm
Theres this site
That tells you how to do that
I forgot its name
Wait
I remeber
No
A YouTube tutorial
For how to create a simple music bot
not every has an interest in programming and learning so much just for getting a bot that loops a song
psst chances are that tutorial is fucking useless
@surreal folio i can help you set one up
@mossy vine the tutorials on yt is outdated but some in the websites are good
i know what im talking about i literally made what he needs two years ago
Same
Maybe fisquoro
He made P74Y
A music bot
But
Hes very pushy
Very very very very very pushy
Fisquoro isn't on here
Tho
It's pretty obvious why
A creator of youtube simulator
Remember that bot?
I was one of the 1st 10 to add it
Sure.
I gotta go... Maintence issuses
does anyone have any good resources that could help me to better follow rate limits?
what rate limits are you trying to follow?
rate limits are dynamic so they might change at any time without warning, and most libraries have systems in place to correctly follow them
so you dont actually need to do anything other than not abuse the api with some unreasonable function
mainly discords since i've gone over a couple times
i use discordjs
so is there something i might be missing?
are you running some function in a loop?
are you doing some forEach with an api call?
oh shoot
im a literal
idiot
sandwich
i was looping a function
in the middle of some random command
thanks i guess lol
lmao
oh actually a real question
if i do go over a ratelimit
is there something passed so i can tell the user?
or will discordjs just wait before sending it?
if its message ratelimit it will wait
hi
(if you hit message ratelimit it would be pretty useless to tell the user through a message)
cana i use external animated emojis using a bot
alright cool thanks
yes
@gritty bolt discord.js actually has systems in place to prevent ever hitting the real discord api rate limits
if you get a rate limit error, its most likely discord.js's own rate limit prevention system warning you, not an actual discord api rate limit error
oh
well that looping function actually was shutting off my bot
it was real bad
like i dont even know how i didnt shut the whole server it was on down
if the process goes on an infinite loop it will eventually crash itself
but it shouldnt affect the whole system much, aside from a cpu usage spike
how many times does a process do the loop before it crashes?
wrong place
I'm sort of confused, what does this mean
like, what
max of 3?
why?
what is the point of that if its a max of 3
you can choose servers to display on your bots page
the servers must be listed and have your bot
basically just a showcase of "hi these servers use this bot"
yes
this is from 2014, but its a good example Are you curious how many recursive calls you can make on your JavaScript engine? How many recursive calls? The following function lets you find out (inspired by a gist by Ben Alman). function computeMaxCallStackSize() { try { return 1 + computeMaxCallStackSize(); } catch (e) { // Call stack overflow return 1; } } Three results: Node.js: 11034 Firefox: 50994 Chrome: 10402
cant you change that tho
you can
oh so I see it calls itself in its code
the stack size is actually not limited to number of loops but to size in bytes
as your looping continues, the stack size increases in memory
and if it exceeds a certain size in bytes, it crashes
I ran it and got 12568
so depending on what your function does, which variables it uses, how much memory it is holding, the amount of loops you get will be different
also, some loops will be infinite and ignore the stack size
doesnt that just say if size doesnt exist use 1?
thats a true infinite loop, it wont crash until you kill the process
yes
the above rules however only apply to recursion, ie functions inside functions
stuff like while(true) will still be infinite regardless
how often will it check a while function?
1ms?
it seems a bit random
const time = Date.now() + 3;
let x = 0;
while (time > Date.now()) {
x++;
console.log(x);
}```
not an efficient function
but it should return the amount of tries it does
in 3ms
and it was anywhere from 40 to 70
This would very much be affected by the specs of whatever is running it
Also keep in mind that your os decides which process gets "processor time" at which point
oh yeah
and who knows what node does behind the scenes
do you?
what cpu do you have?
ryzen 9 3950x
simply executing it from a different type of terminal also changes the result heavily
hmm
lemme see what it does on powershell and cmd
wait I dont think I can
because I use an ssh
is there a way to check all common members between two servers
or i just have to loop through entire members
d.jsv11.5
all common? I think you loop though
you can make it more efficient by checking the larger server for the members of the smaller server
Alright thanks
For some reason I can't find this on Google so it's probably a stupid question, but if I create a websocket with ws (js) how do I know what the URL of said websocket is
I want to connect to it externally so I can't use localhost
And the connection just times out of I attempt to connect with the public IP of the server it's hosted on
your websocket runs in a port right?
then the url should be ws://YOUR.VPS.IP.ADDRESS:PORT
does it work if you try locally with localhost?
if it works with localhost, but not with public ip, then there's a firewall blocking, or blocked port
I (probably stupidly) deleted all firewall rules listed for the instance and that changed nothing
So I'm stumped
check if your hosting has any firewall system in its admin panel
I'm using AWS so I just changed the network security group settings
then idk, i havent used AWS before
Oh right, thank you for your help though
Hey, would anyone know how one would convert a .js script into .py ??
there is a translator I think
^
if there is its likely garbage
and you can optimize a lot
not to mention library differences
are you sure its relevant to #development
yes, i do
i have no idea what that even is
@woven sundial have you checked the configuration docs?
i took a look there and found this
i need help
i made my bot in c# but when i do command it says "Unknown Command" on console
Markdown it with ``````
what?
delete the second one pls
and remove your token
asap
wdym second one
O
The second file
i am confused
@earnest phoenix the Program.cs.txt has your Bot token in it
yes
string token = "Njk3OTE1NDExOTY2MTk3OTcx.Xo-O2Q.CI4cUuNL4OD54Daa_uAfxGlo75U";
omfg
LOL
@earnest phoenix your token is your bot password
with that token anyone can login and hack your bot
Time to regen your token
it will just get taken down by a mod
regenerate it
STILL
this can still fuck up your account
good
now lets try this again
wdym regen it asap
what is asap
People can do bad stuff with it
as soon as possible
as soon as possible
Ok
now what is problem in my bot
so no solution?




