#development
1 messages ยท Page 888 of 1
Can I out from youtube or insta ?
we should move to #memes-and-media so I dont get yelled at
What is git hub ?
a site for developers
@distant warren I have one that plays a card game and DMs the players their hands, so I know what you want can be done
Just about what's most efficient
@sinful belfry if I centralize it in one channel all of the people there will see each other
i mean so that people DM the bot and it forwards the message to a specific channel that only you can see
i think the most similar bot to what you need is like a ticket bot
I don't need the replies to be centralized, I am okay with having one on one conversations with each member
basically I can do it now by just DMing the message to each one manually but I just wish to do it more efficiently with something that sends it to all of them automatically
honestly it's just starting multiple one on one conversations
oh ok
I am sending the same task to all of them and they can ask me questions about the task but their questions should be private
that's all
it sounds easier if you make a server and just set up multiple channels where only one person and you can access each channel
then you could either make an announcement channel or just send the task to each channel individually
if I send the task to each channel individually I might as well not create the channels and just dm the task
yeah, you could
also when you create a server aren't people able to see everyone on that server from somewhere?
not necessarily
we should really move to #general
sorry idk why that guy said to move before
the array is the output of case1 as far as i understood
So I am hosting my own Discord bots on servers on my residential internet connection...It's 400 Mbps down, 20 Mbps up. When I host my own bots, they time out constantly. I moved one to an EC2 instance and it has had no issues. My question is--is it the ISP or do I need to do some kind of port forwarding?
hi
does anyone know why my auto mod thing isn't deleting messages? Code: ```js
let badwords = [ 'hi', 'bye' ];
let content = message.content.split(' ');
if (badwords.some((e) => content.some((c) => c === e))) {
message.delete().catch((e) => {
console.log(e);
return;
});
}
no errors
So I am hosting my own Discord bots on servers on my residential internet connection...It's 400 Mbps down, 20 Mbps up. When I host my own bots, they time out constantly. I moved one to an EC2 instance and it has had no issues. My question is--is it the ISP or do I need to do some kind of port forwarding?
Breh that speed is plenty for a bot lmao
might just be your location
Also note that discord api constantly oscillates, so it might just be common disconnections
Because discord is, ahem, a stable platform
The EC2 instance has had none in the time period my server would have had 10.
But maybe the EC2 instance is nearer a Discord datacenter.
I was also wondering if I needed to DMZ the bot server or add some kind of port forward/filter/trigger.
I think you have to hard code every word like:
message.channel.messages.cache.get or find(message.guild.member(message.author).lastMessageID).then(async (message) => {
await message.delete();
})
}```
@digital ibex
Just curious for other developers around, how many lines of code is your largest bot?
like mine is around 10k
Does anyone know how to do modified emojis?
https://discordapp.com/developers/docs/resources/emoji
Integrate your service with Discord โ whether it's a bot or a game or whatever your wildest imagination can come up with.
assuming
Idk, never counted
@earnest phoenix i don't think u have to
Ah, then you've got my largest one beat, lol.
But more than 500k for sure
@digital ibex idk... I said maybe
But mine also has zero comments and very little whitespace.
what is the equivalent to .includes for an array? like, .includes takes a string, whats .something which takes an array?
ok
isnt the equivalent to includes for an array, includes?
no
cant you do array.includes(thing)
If you make an array of arrays, includes will take an array
But I guess this ain't the case
Just make an iterator to compare the two arrays
let oof = ['hi', 'bye'];
for ( const ofs of oofs) {
/* what do i put here */
}
Turn it into a function and use in your code instead of writing it every time
idk
but .includes(string)
Yeah, you block bye, then someone comes with by3
.includes(array) ?
Then by-e
tbf you can have a word filter but at least make it user customizable
there are ~1111998^1990 ways to bypass your filter
uhhhh
Link filters are doable, but word filters are a no-no
just include every known character in the filter, can't bypass it then 
Not even big companies can do it
the unicode spectrum is huge
you can't make a filter on a service which literally allows you to send 120k+ different characters
What's the maximum length of a guild role's name?
@sudden geyser try to create a role in you server with as many chars as you can write, then count it
if its not a word filter then?
Few ones that kinda work are url filters and texts with patterns
ok, for now i#, just going to create a simple word filter
and create an option to add more stuff
I could see a word filter working a bit better if the program was restricted to a certain set of characters
but something like Discord allows practically every known character
idrc about the filter tbh, i'm going to add an option to add mroe stuff anyways
I think I fixed it...maybe. Putting the bot host in the DMZ has stopped the timeout issues, or at least they are less frequent.
Depends on the operating system and language.
How can redis help a discord.js bot?
I mean, for example Dyno uses mongodb and redis as databases. Why it isn't using only monogo, but redis too
If you're using Discord Bot Maker, very difficult.
If you're hosting your own like me, easy.
How can redis help a discord.js bot?
I mean, for example Dyno uses mongodb and redis as databases. Why it isn't using only monogo, but redis too
@wheat jolt probably because one is a main db while the other is a cache db
I have a very strange issue. I am using the following bit of code to wait for a reaction, and it works fine. But the moment someone else also runs this command, which generates a seperate message with a reaction, makes it so that when the first user hasn't responded yet, the bot will not respond to their reaction anymore, but will respond to the second user's reaction.
However, I do still see a log in the console that the timer ended, from both messages. The first user's log shows that the bot collected 0 reactions, even if the reaction was clicked.
?docs vote
@fresh kernel how do you define dodoembed?
Like this
try changing all your var to let
It didn't change the behavior
gonna need to see more code then
another suggestion is to use message.awaitReactions() instead of createReactionCollector
Oof. Do you mind if I send it in private? The entire file is 300 lines until that part
I haven't tried that
I'll get back to you in a moment then
i g2g but try that
in line 23, you're trying to use the lock variable even though you're outside the run export.
and now ?
well the error says it's on line 8
the channel property is not present.
are you sure the arguments you passed to the run command are correct
as in exports.run = async (...) => {...}
You're running it with (client, message, args) but it's expecting (message, prefix, client)
so what should i change ?
you change variable names to make sense
Don't just copy paste code without understanding what it does
botconfig-token isn't a valid token
remove strings ""
yes remove the strings
bot.login(botconfig.token);
๐
i try
now you are referencing the token you pasted in the json file
hm
why are you in the node modules folder
^
Go to the main folder yes
The bot folder
or cd .. in your terminal
You have to open the console in the bot folder
is that token even right
that doesn't look like a bot token
you went too far lol
then node index.js
Yes
yes because index.js is in node_modules folder
why
move those last two files to bot/
like, drag them to the folder named bot
and then try node index.js again
do you know how to drag a file into another folder
where's index.js
and botconfig.json
inhale deeply
now node index.js
๐
oh lord
you never even made a new instance of the client class
you need to define bot
define
wjat
im eng trash
here's this guys code https://cdn.discordapp.com/attachments/272764566411149314/702925930590371971/unknown.png
const bot = new Discord.Client()
I highly suggest you read up on JavaScript basics
^
^
My first JS project was a Discord bot
^ to parm also I think that client token is wrong just from the prefix
But I had years of experience in other languages 
here?
bruh
oh deleted
that ain't a token
OPS
That's not a bot token and you also shared the whole thing
rip
don't ever do that
I forgot
at least it's not a real one
kek
is it worth downloading a reaction library to handle embed menus?
or is it not so much work to brute force the coding?
no
why not just create your own?
no no no no no
wrong token
Just wanted that answer before I dove into learning it
that doesn't even say token anywhere
thanks ๐
That's entirely the wrong thing
- Don't show your token.
- That's your client token, not your bot token.
- You should read up on documentation.
as mentioned before you should learn the basics of javascript first
maybe this will help you https://www.w3schools.com/nodejs/
maybe programming in general
@sonic lodge
you can't pull things out of thin air
Can you help me at dm
pLs
im new to js
would
really just look at https://www.codecademy.com/learn/introduction-to-javascript
what kind of infrastructure
lol
oopled
what?
can you help me ?
let's not busy here
I'm not him but this is a great place to get help rather than dm 
oh
sure
yes, and also i really don't have the time
what should I do
there have been various sources sent above that will probably help you
ok
ie
come back here when you're finished
show me ur powers, sensei
available meaning
okay so i big dumb
how do i get the user that joined to tag them with a GuildMemberAdd
discord.js
client.on("guildMemberAdd" ,(message, member) => {
welcomechannel.send(I WANT TO TAG THE USER HERE)
welcomechannel.send(embed)
}
@nocturne dagger
yes?
member.author
message ?
welchannel.send(member.author)
^
TypeError: Cannot read property 'author' of undefined
does not work
welchannel.send(member.user.tag)
^
TypeError: Cannot read property 'user' of undefined
kk
How do I make a voting command? Would i redirect to the vote page on top.gg or is there a function?
you redirect them to the vote page
disk usage?
yes
which language do you use
get os-utils to save yourself the trouble
@summer torrent js
UnhandledPromiseRejectionWarning: TypeError: moment.duration(...).format is not a function
let actividad = moment.duration(client.uptime).format(" D [dias], H [hrs], m [mins], s [secs]");
npm install moment-duration-format
i do that
and say ```js
UnhandledPromiseRejectionWarning: TypeError: moment.duration(...).format is not a function
This is actually CSS, I'm working on my bot's dashboard, is there a way to use a selector like :hover for a specific element? Not by class or id but rather like:
<div class="parent">
<div class="child":hover { color: red; }>Text</div>
<div>
That way only this child class would have the transition
@fallow quiver The only way I can think of that would be through javascript and onmouseover
So something like:
<div class="parent">
<div class="child" onmouseover="(this).style.color = 'red'" { color: red; }>Text</div>
<div>
Just without the pseudo code
@earnest phoenix define moment-duration-format in your code
just require("moment-duration-format")
ok
@fallow quiver Well to achieve what you want I'd probably use mouseenter and mouseleave.
the bot say NaN
I suppose I could use class + id to get a similar effect
That'd be the best approach in my opinion.
EDIT: And a classical approach 
@summer torrent the bot say NaN
what
Hi can anyone tell me how to set my bot to streaming tried everything nut nothing seems to work
What library are you using? @earnest phoenix
bot.user.setPresence({
game: {
name: 'with my friends',
type: "STREAMING",
url: "streaming url (twitch)"
}
});
client.on('ready', () => { console.log("Connected as " + client.user.tag) client.user.setActivity("+help to start", { type: "STREAMING" }) })
@summer torrent ok
is in spanish
if(command === "botinfo"){
let actividad = moment.duration(client.uptime).format(" D [dias], H [hrs], m [mins], s [secs]");
let embed = new Discord.RichEmbed()
.setTitle('Informaciรณn del bot')
.setColor(0xff0000)
.setAuthor(`Creador: ${client.users.get('507367752391196682').username}`, `${client.users.get('507367752391196682').avatarURL}`)
.addField('CPU', `${(process.cpuUsage().system / 1024 /1024).toFixed(2)}%`, true)
.addField("Memoria", `${(process.memoryUsage().heapUsed / 1024 /1024).toFixed(2)}%`, true)
.addField("Discord API", `${Math.floor(message.client.ping)} ms`, true)
.addField('Uptime', actividad, true)
.addField('Ping', `${Math.floor(message.createdTimestamp - Date.now(), true)} ms`)
.addField('Numero de servidores', client.guilds.size, true)
.addField('Numero de personas', client.users.size,true)
.setFooter(`${client.users.get('652244414412095528').username}`, client.users.get('652244414412095528').avatarURL)
message.channel.send({ embed })
}
@earnest phoenix that is works for me. Check your moment version
You can place it inside an event, I'd place it in the ready event personally.
u r 12v?
yes
๐ค
@earnest phoenix
bot.on("ready", () => {
// stuff inside here
});
no like ik that but like the outline
hmm?
```js
code
```
game: {
name: 'with my friends',
type: "STREAMING",
url: "streaming url (twitch)"
}
});```
ok thx
If you add the "js" part it'll highlight code.
game: {
name: 'with my friends',
type: "STREAMING",
url: "streaming url (twitch)"
}
});```
game: {
name: 'with my friends',
type: "STREAMING",
url: "streaming url (twitch)"
}
});```
have to do it on a separate line
ok
bot.user.setPresence({
game: {
name: 'with my friends',
type: "STREAMING",
url: "streaming url (twitch)"
}
});```
yup
ok thx guys !!!
bot.user.setPresence({
game: {
name: 'with my friends',
type: "STREAMING",
url: "streaming url (twitch)"
}
});``` didnt work
still says playing
because that url needs to be real twitch url 
client.user.setPresence({
game: {
name: '+help to start',
type: "STREAMING",
url: "https://www.twitch.tv/beastatfnbr"
}
});```
how i change this to 11v?
moment.duration(client.uptime).format(" D [dias], H [hrs], m [mins], s [secs]");
thats alr
client.uptime is same on v11 n v12
and moment duration format has nothing to do with discord.js version
why say NaN?
well you do something wrong
client.user.setPresence({
game: {
name: '+help to start',
type: "STREAMING",
url: "https://www.twitch.tv/beastatfnbr"
}
});``` correct??
idk
wat that\
"You should try it and see"
I know domains are cheap rn but I've seen an influx of domains that are just videos like that
It is SFW
uhh not really SFW 
I guess I meant it didn't have any dirctly explcit images
Well it's gone now so no worries
eh got it thx
za warudo

you can't get a .gov domain unless you're actually making a website related to the government
iirc
ikr 
How do I actually POST to webhooks.
I'm trying this
local url = "https://discordapp.com/api/webhooks/ID/TOKEN"
local res, body = http.request("POST", url, {content = "test"})
is that lua?
yes it is
@earnest phoenix do you mean webhook.send?
he's doing a raw POST request to the webhook url
^
idk if discordia actually supports webhooks, if so, you should use that
@paper cliff it doesn't, that's why I'm doing it raw lol.
yes makes sense
i'm not really familiar with lua modules so i can't really help u unfortunately
@earnest phoenix you have to pass a header "Content-Type" to "application/json"
i think
ah
and make that JSON
maybe
the third parameter should be a string containing JSON
not really sure about that but if that can helps
I think fallenthetaco is a long name, anyone know a better name for my discord bot?
Like this? @woven sundial
can you stop?
also, why did you ping this random guy lol
@earnest phoenix is it working with correct headers and a JSON body?
Move to #memes-and-media if you're not going to be posting anything relevant for this channel. @elder moss
bad troll
aint good dude
"let me think"
let me think
All of you should stop, too.
Agreed, bad people right? Where the mite for them? @slender thistle
@elder moss You were told to move to #memes-and-media, last warning.
yes sir!!!

I think fallenthetaco is a long name, anyone know a better name for my discord bot? sorry for the repost, just spam got in the way
is it related to development stuff?
Not really fit for this channel.
agreed sir
Hi guys, I have an issue with my dynamic embed, could you help me? Basically I want that everytime a reaction is added, it gets removed and the bot switches the embed content. But with my code it removes both my reaction and the bot reaction that was created at the beginning at the code:
https://hatebin.com/adijjqwnlt
why are you creating six reaction collectors when you could have it all under one?
I need differenet reactions to switch different amount of pages and in different directions,
@paper cliff solved the problem ๐
local headers = {
{"content-type", "application/json"}
}
local payload = {
content = "test"
}
coroutine.wrap(function()
local res, body = http.request("POST", "https://discordapp.com/api/webhooks/ID/TOKEN", headers, json.encode(payload))
end)()
You can do that in one reaction collector
@paper cliff But then I would have to put 6 if inside that
Has to be sent as a string.
But then I would have to put 6 if inside that
and it would get real messy
@opaque seal keep an array of the emojis you're using then check if the reaction added is in that array.
and check the user ID of course.
@opaque seal keep an array of the emojis you're using then check if the reaction added is in that array.
@sudden geyser each reaction does a different thing, I didn't explain that prob
the way you're doing it requires six new event emitters.
6 if conditions blocks is probably better than 6 events
and you can avoid multiple conditions blocks anyway
yeah so in the collect event, check which reaction it is.
r is an instance of MessageReaction. Calling .remove on it removes all reactions from the message which are the same.
Check out the .users property which allows you to remove a reaction from a specific user: https://discord.js.org/#/docs/main/stable/class/MessageReaction?scrollTo=users
ris an instance ofMessageReaction. Calling.removeon it removes all reactions from the message which are the same.
that's what confused me the most, because when I tried it the first time it only removed the reaction I added, not the bot reaction, instead once I added more events it started removing all reactions
6 if conditions blocks is probably better than 6 events
and you can avoid multiple conditions blocks anyway
so better if I check in the event?
that's what confused me the most, because when I tried it the first time it only removed the reaction I added, not the bot reaction, instead once I added more events it started removing all reactions
I still don't get why this happened
Well, what version of Discord.js are you using?
v12
did you just migrate from v11?
no
Okay so v12
that's what confused me the most, because when I tried it the first time it only removed the reaction I added, not the bot reaction, instead once I added more events it started removing all reactions
On v11, it's.removefor a specific user. On v12, it's.users.removeinstead. You shouldn't have more than one event in the first place.
so better if I check in the event?
It's better you have one event rather than six.
How I can use megadb on py?
maybe that's why he's asking how to run it on py
although i don't think that would be possible
It is possible, but its not for beginners at all
thats where it gets very complicated
Hello!
I just had a question. Why is my ping command saying API Latency: NaNms instead of a number? Here's the code js receivedMessage.channel.send("Pinging...").then(m => { let ping = m.createdTimestamp - receivedMessage.createdTimestamp m.edit(`Pong!๐ __**Bot Latency:**__ ${ping}ms, __**API Latency:**__ ${Math.round(client.ping)}ms`) })
because client.ping on the newer versions is no longer a thing
if you use v12 you need to do client.ws.ping instead of client.ping
hello bot is not in the turkish category, what is the reason?
@ember bluff this is not the place to ask, go to #general or #memes-and-media
hey i'm using lavalink in my bot the bot is working fine in my pc but on the vps host it won't run somesongs the api return nothing
any idea?
it should log at least an error on the server
it did
What are pros and cons of giving a link to git repo with it's source code?
Hello, someone knows how to write text in json with spaces?
Hey, I'm the one actually making it
The Lavalink search seems to be returning a null value despite apparently getting a match in the following code:
It doesn't say that it got no results, but sets track to null and errors later down the line. This only occurs with some youtube videos and only on a linux vps, not on a windows machine.
yup
@severe verge why do you have the same if check inside each other 
Because it does another search
Also Response.Items.Count will always be 0 if there is not match?
Does anyone know how to use Discord.js's Kurasuta cluster lib
I would have also thought that. I believe that it's adding a null item to the list but I don't know why, and it's only on linux
Getting a little bit lost in reactions atm
the reaction.message returns the object I want (the richembed)
but I can't seem to find a way to pull the reaction out of the collection
Are you using ReactionManager?
that's the part of the datablock I'm trying to assign to a variable
Nah, just winging it off client reaction event
oh its its own object?
You could probably check the reactions property of the message
reaction.message.reactions I believe
yeah that returns a smaller group than the full .msg
Yeah I want to assign or compare the emoji
Assign the emoji to the message ok
how would I use applications.builds.read scope, I already did the token exchange now all I need is the URL to read user's applications. Does anyone know the URL that I'm suppose to go?
message.react if you wanted to add a reaction
right, I'm already adding the reactions
Yeah so comparing?
I'm trying to get the program to tell me what emoji was reacted on top of that
like left/right arrows
yeah so reaction.emoji.name should give you the emoji
If that's what you're looking for at least
is it an array if there are multiple reaction emojis?
I think it just gets the emoji for a single reaction
https://ghostbin.co/paste/kouaj so thats my rps code and if i get rock and the bot gets scissors it says its a tie
hey, why my bot don't have the servers right here ?
you need a webhook i believe
and how i make it ?
@feral haven you need to use the dbl api
go to the site and click api
should have all the info their for your chosen lang
for posting guild count
ok thanks
does anyone know what i did wrong? it says "TypeError: Cannot read property 'member' of null." the line of code in questions is const member = message.guild.member(user);
also i defined user
guild is null
Just debug your code and use console write to see what parts are causing issues tbh
ok
const user = message.mentions.users.first();
Are you checking if your messages contains any mentions in the first place
Hi
https://ghostbin.co/paste/kouaj so thats my rps code and if i get rock and the bot gets scissors it says its a tie
actually you dont need that block at all, you dont need a lot of stuff in you code
this also looks wrong
it should be + 0
Math.random() returns a value between 0 and 0.9999, so multiplied by 3, it can return between 0 and 2.9999, +1 will make is 1-3.9999, floor it will make it 1-3
array indexes are 0-2 not 1-3
also you already floored it, no need to parseInt it
oh
and you definitely dont need parseInt("1")
which is literally the same as writing 1
so i can just get rid of this line let comp_res = parseInt(comp) - parseInt("1");
yes
and for random, you dont need to add or remove anything from it
just Math.random() * 3
and then do i just change all the comp_res to comp
yes
now the command doesnt send a message?
and you dont need to parseInt it again in comp_val
no need for () either
also this part, you make it so i becomes the value that you beat, not the value that you chose, was it on purpose? nothing wrong with it, just making sure we're on the same page
if you chose rock, you get 2 which is the index for scissors
its not up a number, its just the numbers are incorrect, not sure if you did it on purpose or not
paper is 0, rock is 1, scissors is 2
also, the way you coded it, you could do !rps rockscissorspaper and it would chose scissors for you
how does your code look now?
where would i use the !rps rockscissorspaper
is this - js { lbdata: Object } what i put into the mongoose schema if i want to do the equivalent to this? - ```js
lbdata[userID] = [Object] // <- lb stuff
you wouldnt, just saying if you did, thats what would happen
is one able to do that with mongodb anyway?
crap
why does it look like you're taking the hard route?
hes taking the super overly and needlessly complicated route lmao
@grizzled raven i think you need to specify the object's contents in the schema as well
tbh i copied the code cause i didnt think i could code this command now i think i could without this many problems but i dont want to mess up
but
if i choose paper and it gets scissors i win
for some reason
what
@queen needle if you coded it yourself, you'll probably get a better version of it
something simple like this would work```js
let choices = ["rock", "paper", "scissors"]
i = choices.indexOf(args[1].toLowerCase())
if (i === -1) return message.channel.send("invalid input lol")
//check who is the winner cause im lazy ๐
that whole code is really shit lmao
ill try my own verison
no but like
or mixed type
yeah i do that for values that are definite, but are you able to do something like this js example?
let object = {}
// some random stuff happens, a user did something and got a score of 4
object[user.id] = 4
or would i have to use an array for that instead?
i guess you should use mixed
Would anyone know if this is the "proper" way to use the new embeds?
https://images.vinniehat.com/i/grl35t5bn0rbe6o.jpg
It just look so odd with the title
How it's so dark compared to the actual second line
idk, i dont use mongo nor mongoose
or you can use a map
then you do object.get(user.id)
if i was doing like if(args[0] equals to another varible would i use == or =
what happens if I leak my vps IP 
99% chance of nothing
@abstract crow those are field names/titles, not much you can do about it i guess
@abstract crow are u old mod ?
if you dont like them, you can hide them, and write a bold title in the field content lol
so i figured out how to do the tie for the rps command but how would i do winning and losing
i use sqlite
oh ok
@queen needle cant get easier than directly comparing them
i could do it but there has to be an easier way then writing all the possible responses
you can simply do like this, no need to over complicate when you dont know how to make it better ```js
if(me === comp) { tie }
else if(me === "rock" && comp === "paper") { lose }
else if(me === "rock" && comp === "scissors") { win }
else if(me === "paper" && comp === "scissors") { lose }
else if(me === "paper" && comp === "rock") { lose }
else if(me === "scissors" && comp === "paper") { win }
else if(me === "scissors" && comp === "rock") { lose }
i forgot about else if
and im not using comp let bot = rps[Math.floor(Math.random() * rps.length)]
this way you know exactly what your code does and you have full control and understanding of it
im using bot
it doesnt matter
i beg to differ
that is disgusting
what matters is that he can read it and understand what it does
switch makes it thicker anyway xd
well no
i understand else if more then a switch
once they get comfortable they can move on to other things
i see
let tie ={ message.channel.send({
embed: {
color: 15158332,
title: "Rock Paper Scissors",
fields: [
{
name: "Your choice",
value: `\`\`\`css\n${args[0]}\`\`\``
},
{
name: "My choice",
value: `\`\`\`css\n${comp_val}\`\`\``
},
{
name: "Output",
value: "Tie. New balance: " + coins[message.author.id].coins
}
]
}
});}
message.channel.send(tie)```
would that work?
no
remove the { }
that approach wouldnt work anyway
you should save the embed, not the sending of the message, if you want to send it later
you could also do this ```js
let i = yourChoice // 2 for example - paper
let j = theirChoice // 3 for example - scissors
let winner = ((i > j && !(i === "scissors" && j === "rock")) || (i === "rock" && j === "scissors"))
woah im slow xd
My bot keeps getting killed off discord voice channels with error code 4014, the api docs say it got kicked but it didnt, it didnt lose connection to internet either..
but otherwise just stick to something like js let result; if() else if() {} if() else if() {} .... if(result === "win") { send win embed } else if(result === "lose") { send lose embed }
rps is a fun way to play around with optimization
there are so many ways you can try to optimize it
so many ways to design it
so many bots with it
xD
i will choose a bot based on how well their rps code is optimised LOL
lmao
also, would there be a point where your bot would be too big for sqlite
then keep trying
depends on how you use it, but most likely no
how big is your sqlite file?
about 10mb lol
oh ok mines like 2mb
sqlite supports sharding
how to
just use it normally?
honestly it depends on the library you use it with
but sqlite itself supports concurrent reads from multiple process, just not concurrent writes
for writing it uses a queue instead
better-sqlite3
if one process is writing, another process will wait in the queue
better-sqlite3 does all of this automatically
yes, better-sqlite3 waits 5 seconds by default
๐
if a write takes longer than 5 seconds, it will throw an error
but most writes take milliseconds anyway
especially if you use wal mode and disable synchronization
yea i already have wal mode on
it works
good job
here's a statement from the SQLite website
The SQLite website (https://www.sqlite.org/) uses SQLite itself, of course, and as of this writing (2015) it handles about 400K to 500K HTTP requests per day, about 15-20% of which are dynamic pages touching the database. Dynamic content uses about 200 SQL statements per webpage. This setup runs on a single VM that shares a physical server with 23 others and yet still keeps the load average below 0.1 most of the time.

you can use client.fetchApplication()
this will get information about ownership of your own bot
Alright
sql.run(DROP TABLE rank);
sql.run is not a function
idk if you can see ownership or other bots tho (probably not)
better-sqlite3
better-sqlite3 uses the following syntax: database.prepare("query").run/get/all(params)
yea
oh I forgot about run()
thx
How can i get a bot?
look for a bot you like on the internet and invite it
for example, go to top.gg and search for a music bot
and click the invite button
Ok thanks
are you allowed to kick an old bot, and reinvite it under a new account? I rereleased my bot under a new profile, but I decided to change it back to the old one
its the same pfp and name
but different server count, id, and such
pretty sure it still has to go through queue
yes
team
Pro bot
you might be in the wrong server
if you set an id property in a schema, will mongoose's _id id getter override it?
@mint cypress go to discord.gg/probot
if(message.content.startsWith(PREFIX + 'blackjack')){
var a = 11;
var card = [2, 3, 4, 5, 6, 7, 8, 9, 10, a];
var c1 = card[Math.floor(Math.random()*card.length)];
var c2 = card[Math.floor(Math.random()*card.length)];
var cardtotal = c1 + c2;
message.channel.send('Your cards are a ' + c1 + ' and a ' + c2 + ', with a total of ' + cardtotal + '. Do you want to hit (:thumbsup:) or stand (:thumbsdown:)?').then(sentMessage => {
sentMessage.react('๐');
sentMessage.react('๐');
});
const filter = (reaction, user) => {
return ['๐', '๐'].includes(reaction.emoji.name) && user.id === message.author.id;
};
message.awaitReactions(filter, { max: 1, time: 10000, errors: ['time'] })
.then(collected => {
const reaction = collected.first();
if (reaction.emoji.name === '๐') {
message.reply('You decided to hit');
} else if (reaction.emoji.name === '๐') {
message.reply('You decided to stand');
}
})
.catch(collected => {
message.reply('You didn\'t do anything, so now the game\'s over.');
});
}``` how could i make it add to their score if they hit thumbs up and if they hit thumbs down tell them they won unless their score is above 21
can someone send me simple discord.js economy system
everything i see doesn't work
DM me pls

If it doesn't work, you need to fix what doesn't work.
@queen needle you're waiting for reactions on the message the user sent, not the one the bot sent.
oh
I want to make a game that relies on custom emotes, if a bot is sharded will all shards be able to access the custom emotes? or will only the specific shard that's connected to the guild containing the emotes be able to use them?
I want to make a game that relies on custom emotes, if a bot is sharded will all shards be able to access the custom emotes? or will only the specific shard that's connected to the guild containing the emotes be able to use them?
@wild thorn all shards belong to a single bot
so custom emotes are shared
nice, that's actually a very good practice
Anyone has any idea how to make the request for PUT/guilds/{guild.id}/members/{user.id} to join a member to a guild?
const options = {
method: 'PUT',
headers: {
'Content-Type': 'application/json',
'Authorization': `Bot ${process.env.BOT_TOKEN}`
}
}
await fetch(`http://discordapp.com/api/guilds/${targetserver}/members/${userinfo.id}`,options)```
this is what ive tried
where bot_token is the bot token, targetserver is the id of the server where the bot has permissions to create invites and userinfo.id is the id of the user
im not sure where to add access_token and Bearer ${token}
where token is the token generated with the application with guild.join permission
Can someone help me make a setprefix command?
I just want a simple one that uses fs, however I'm not experienced within fs in any way, I'm going to read the documents though.
can i ask why fs?
I've seen fs before about how it's able to read a file and also edit the file then in the prefix/command definer you can change it to detect if the guild has a set prefix.
So if I do a setprefix command it'll change the package file and make the prefix.
i personally recommend to use a database
Like MongoDB?
since reading and writing files constantly can break files
specially json files
whatever you want
Hm.
Ty.
i use sqlite, local, free, unlimited
ยฏ_(ใ)_/ยฏ
Now, can someone help me? https://discordapp.com/channels/264445053596991498/272764566411149314/703075536217309287 ๐
should i ask whats your hosting provider?
Heroku.
ah lmao
I'm a small developer and not wanting to pay for a VPS yet.
d.js
To put url in codes do you have to put the https://
well
well, shouldnt say this since many people think its the wrost "hosting" service
use glitch.com
but you can use ^
I have a bad past with glitch.
well i mean
it supports npm fully
ยฏ_(ใ)_/ยฏ
so i mean
I'll recheck it out. Ty!
personally i mean for a free option it's great imo
Like I want to put the url for my youtube do I have to put https:// for repl
Using
const options = {
method: 'PUT',
headers: {
'Content-Type': 'application/json',
'Authorization': `Bot ${process.env.BOT_TOKEN}`
},
body: `{"access_token":"Bearer ${token}"}`
}```
I get
```{ message: 'Invalid OAuth2 access token', code: 50025 }```
someone?
await bot.change_presence(activity=discord.Streaming(youtube.com/demoniceagleyt)(name=f"/mhelp | {len(bot.guilds)} Servers", url="www.$do1.com"))
yeah, glitch is good, free, "reliable" and uptime is 99.99999%
??
What did i do wrong
await bot.change_presence(activity=discord.Streaming(youtube.com/demoniceagleyt)(name=f"/mhelp | {len(bot.guilds)} Servers", url="www.$do1.com"))
discord.Streaming(youtube.com/demoniceagleyt) don't look right
glitch, totally """""""""""""""""reliable""""""""""""""""" and free
What do i do then
you put that inside quotation marks
and add the protocol before the url
most likely it's https://
I put the url inside quotation marks?
@tired cloud does it work if you exclude Bearer or is that required?
await bot.change_presence(activity=discord.Streaming("https://www.youtube.com/demoniceagleyt")(name=f"/mhelp | {len(bot.guilds)} Servers", url="www.$do1.com"))
you need a comma after each key/value (whatever you call it in python, I can't remember)
also, name=f"/mhelp | {len(bot.guilds)} Servers" will probably not work
But thats my prefix
you need a comma after each key/value (whatever you call it in python, I can't remember)
@sudden geyser Wdym?
Let me try
?
your command's syntax is probably wrong
Can u change it
you gotta use , between arguments
unfortunately no, I don't know much python
but that seems quite wrong
check the docs for your lib
I did its not helping
Kuu whart part is wrong about the syntax?
await bot.change_presence(activity=discord.Streaming(https:
youtube.com/demoniceagleyt)(name=f"/mhelp | {len(bot.guilds)} S
ervers", url="www.$do1.com"))
^
SyntaxError: invalid syntax```
without bearer it throws error
invalid json parse
with bearer it runs but { message: 'Invalid OAuth2 access token', code: 50025 }
but accesstoken works because it works to get member info using http://discordapp.com/api/users/@me
Im trying to make the bot have the streaming status
if you set an id property in a schema, will mongoose's _id id getter override it?
await bot.change_presence(activity=discord.Streaming(name="put anything", url=my_twitch_url))
@true tundra
Not working
await bot.change_presence(activity=discord.Streaming(name="YouTube", url=https://youtube.com/demoniceagleyt))
Kuu whart part is wrong about the syntax?
@sudden geyser pretty much everything after the first url I guess
Show me the error
@opaque kite
await bot.change_presence(activity=discord.Streaming(name="
YouTube",url=https://youtube.com/demoniceagleyt))(name=f"/mhelp
| {len(bot.guilds)} Servers", url="www.$do1.com"))
^
SyntaxError: invalid syntax```
client.channels.cache.get(client.config.channels.botReportsAuditChannel).send(embed);
Hey, anyone see anything wrong here?
Is there any npm module for Discord.js music that's on v12?
I'm not sure.
lavalink afaik
Saying can't read 'send' of undefined.
client.channels.cache.get(client.config.channels.botReportsAuditChannel).send(embed);
@pine aspen the channel it's getting don't exist
Ok.
make a mechanism that creates the channel if it doesnt exist
https://discordpy.readthedocs.io/en/latest/faq.html#how-do-i-set-the-playing-status @true tundra official docs
whats the api thing to say the server your bot is on
@opaque kite Im trying to do stream status not playing status
servers
You can do that check it out
@true tundra why python .. switch to discordjs
Im on chromebook






