#development
1 messages ยท Page 727 of 1
I posted mine 2-3 days ago, still waiting ๐ so takes a bit of time
oh ok
I don't know if anyone else has done it yet or not, but I think I may have just published the first public voice chat audio transcription bot
are there any analytics bots?
I think so
well now there atleast is
Best user analytics for your Discord server. See all the activity in your server live and filter data by roles.
Hue doesnt even work
But stonks does ;D
I thought I had a unique idea
all the other audio transcription bots failed, then?
it listens to each users audio stream independently
it's only designed to allow targeting a single user at a time right now
because it costs $$/min to transcribe audio
regexr is a regex website
and 100 users * 5 mins = 500 mins
also holup
My last name sounds like "regexr"
also I know it's a site
one of my favs
how else do you learn regex?
Stonks?
Do you like the stonks site?
...
what is https://affax.dev/download ?
I'm an indie developer from Finland and I love to code! Join me on my gamedev journey! Hope to see you around here!
F
nice
pls
Yes
cool wobbles bro
bulma is a good css framework
"the system wasn't designed for this"
did you use that?
can i get a hint on how to call a different C# file and use the instructions/commands defined in there
why aren't you using discord.net's command system
what
i like to keep my main file as clean as possible
there is no reason to use internal unless you're making a library
i want those C# files to be able to run as if their code was inside the run.cs
in solution explorer btw
why are you creating classes outside of the project
you seem to not really know c#
it doesn't matter
also i want to keep my main file clean
so if there is a problem one module fails
not all of them
thats my main idea
back to the drawing board
and execute the code in those files as if they where internal to the main file\
i geuss?
you don't know how c# works
not completely yes
@earnest phoenix hes basically trying Todo what most people doing discord.py do
im aware
Having a seperate file for commands
that is what discord.net encourages
but
they do not know basics of a language
no one can really help with that
It's alot of extra work in C# for little improvement
learning c#
not get it spoon fed
Look up how to include external files in C#
Ig
i knew i was using the wrong word
(im dutch so most words i keep forgetting)
(cuz im dumm)
I can't rlly help much with C# I know some of the robotics side of stuff for CPP but that's about it mostly for the C languages
C++ i know
hence why i find it little easier to dive into C#
and i like the idea of what mick gordon said
change the process change the out come
:3
Can't u do a bot in cpp
userprofile = client.getProfile.get(message.mentions.users.first().id);
if(!userprofile) {
userprofile = {
id: `${message.guild.id}-${message.author.id}`,
user: message.mentions.users.first().id,
profile: "Run `~newprofile` to customise your profile! \n `LIMIT : 1-7 words only`" }
}
if (!message.mentions.users.first().id) {
return message.reply('Please use a proper mention if you want to see someone else\'s profile!');
}
client.setProfile.run(userprofile);
return message.channel.send(`${message.mentions.users.first().id}: ${userprofile.profile}`);
}
}```
hi im sorry for the interuption and my bad codes but how do i get the username of the mentioned user?
`message.mentions.users.first().id`
have you checked the documentation for help?
username
uses id
have common sense
good rule of thumb is to check the documentation for help as a lot of the time it'll have the answer
sorry i found the answer after playing around with it 
anyone else having trouble loading https://discordapp.com/developers/applications ?
Integrate your service with Discord โ whether it's a bot or a game or whatever your wildest imagination can come up with.
I think Discord is having a heart attack in the moment
Error fetching applications. Please reload page, or click here to contact support.
I thought I was alone !
ok so it's not just me, ty
My heart was beating so hard lol
haha
and the bot crashed , many things made my heart beat xD
ye
Just me or does the test function for the webhook not work?
Hello! how can i check if a mention (@user) mention a bot like my bot or another? thanks
Get the user for the mention then check if bot.
which library do you use
Lookin like discord.js
Discord.js is a powerful node.js module that allows you to interact with the Discord API very easily. It takes a much more object-oriented approach than most other JS Discord libraries, making your bot's code significantly tidier and easier to comprehend.
^^^
wait
what did i do wrong every time i lauch my bot it launches and after that it does his thing
then exits with error 0x0 (aka a normal shut down)
Well without code I wouldnt really be able to help you 
@app.route('/', methods=['POST', 'GET'])
def webhook():
# top.gg sends data on the latest vote
if request.method == 'GET':
return '<h1>This is for Top.gg only, what are you doing here?!</h1>'
elif request.method == 'POST':
print("- - - - - TOP.GG VOTE - - - - -")
give_reward(dict(request.json))
return '', 200
else:
abort(400)
if __name__ == "__main__":
app.run(host='xx.xx.xxx.xx', port=8083, threaded=True, debug=True) # will listen on port
If I use this with 8083 forwarded correctly and with the webhook info set on the website I should be able to receive votes on xx.xx.xxx.xx:8083, right?
did you fill in xx.xx.xxx.xx?
Yes ofc
Nah it's correct
unless your ip adress is something like 97.16.155.25
it is
but then again YOUR the host
@solar wraith is it breaking on any specific line or no.
I did
me rn ^^^^
good
also your ip adress you forwarded am i right to assume it starts with 192.168?
If I use that exact code a bit different I manage to receive github post requests and get requests but somehow i am not getting the top.gg ones
No that's wrong.
there is your problem
your router needs to have your local ip adress as forwarded
your router handles requests to outside
It does. I run a website on this exact server too
and needs to open a port to your IP adress
hmmmm
for crying out loud where do i break and with what ;-;
cuz break;
doesnt work
The thing is, I can receive post and get requests from other sites like github and just me checking it
But I am not getting anything from top.gg.
hmmm
So I'm assuming the webhook test function broke...?
not sure
but are you forwarding an IPv4 adress?
cuz i cant force top.gg to ping on IPv4
It is on IPv4 yes
try to open xx.xx.xxx.xx:8083 in a browser and see if it logs anything (make it log all requests)
It logs
and it shows "This is for Top.gg only, what are you doing here?!"
return '<h1>This is for Top.gg only, what are you doing here?!</h1>'```
then your webserver is correct
error 401
@slender mountain where do i break?
cuz i tried every where but it refuses to break
So idk what I'm doing wrong. I have to use webhooks since I'm over the ratelimit but I am having so many problems with this.
Wdym, I was meaning if the error happens in any particular place 
well, discord is having issues atm
maybe top.gg is also having them
youtube was also not loading channels a few mins ago
looks like an outage
Everything works fine for me
did you try with and without "http://" in the webhook url?
Yes I did
OMG
KIDDING ME
I found the problem
You have to click "save" first and only after that you can use "test"
lmao
np we didnt do anything
@slender mountain no error 0x0 is just standard normal exit code
no errors
for crying out looud
either no commands at all
or no bot
what am i doing wrong
@earnest phoenix can you tell me how to get my bot not to exit it self
or give me a hint
lol I was pushing my bot's updates to my hosting service using git and it took me over 20 minutes to push all the changes
F
How do I change ttf font into fnt?
maybe use this https://www.fontconverter.org/
Convert your font files with this free online font converter. We convert almost any font file formats into ttf, otf, fon, pfb, afm (and more)
You can't select fnt as output format
F
Anyone knows how to fix this?
TypeError: list.splice is not a function
I get it when I try to remove an item from list
What language @glacial mango
js
hoiii i wanna ask can var randomNumber = Math.floor(Math.random() * 201); have some kind of percentage system? like chances to be exact
70% to get number 1-100
20% to get number 100-150
10% to get number 150-200
@glacial mango that means list is not an array
What do you mean
@earnest phoenix theres probably a million ways to do that, but the simplest way i can think of rn is to run a random number from 0-10, if it returns 0-7, run a random number 1-100, if it returns 7-9, run a random number 100-150, if it returns 9+ run a random 150-200 lol
as long as it work i like it 
@glacial mango splice is an array method, it only works in arrays
an array looks like this: [item1,item2,item3]
but list is defined as an array
ok
@quartz kindle This is the list:
**11.** [Post Malone - Circles](https://www.youtube.com/watch?v=wXhTHyIgQ_U)
**12.** [Post Malone - Circles](https://www.youtube.com/watch?v=wXhTHyIgQ_U)
**13.** [Post Malone - Circles](https://www.youtube.com/watch?v=wXhTHyIgQ_U)
**14.** [Post Malone - Circles](https://www.youtube.com/watch?v=wXhTHyIgQ_U)
**15.** [Post Malone - Circles](https://www.youtube.com/watch?v=wXhTHyIgQ_U)
**16.** [Post Malone - Circles](https://www.youtube.com/watch?v=wXhTHyIgQ_U)```
how did you define it?
post the actual code
and the console.log output
console.log(list)
@earnest phoenix this is no longer working https://hastebin.com/fecijinaso.cs
what is not working
the entire program
there is always a reason
try catch in MainAsync and see what causes it to exist
strong willpower is what causes it to exist
Exception from HRESULT: 0x80131040
This is a mismatch between assemblies: a DLL referenced from an assembly doesn't have a method signature that's expected.
Clean the solution, rebuild everything, and try again.
Also, be careful if this is a reference to something that's in the GAC; it could be that something somewhere is pointing to an incorrect version. Make sure (through the Properties of each reference) that the correct version is chosen or that Specific Version is set false.
@modest maple new one did what you wanted System.MissingMethodException: 'Method not found: 'System.Collections.Generic.IAsyncEnumerable`1<System.Collections.Generic.IReadOnlyCollection`1<Discord.IUser>> Discord.IChannel.GetUsersAsync(Discord.CacheMode, Discord.RequestOptions)'.'
are you using .net framework
why
use .net core
discord.net was meant to run on net core
as well as a ton of other libs
with .net core you get cross platform support and single file app publish
F
which means you can turn all of your code into an executable file like this
yall need to learn how to do keyword searching
^
you don't search for "how to use roblox api in my discord bot pls", rather, you search for keywords which would be "roblox api"
^
i don't write this
Well said cry, well said.
i write roblox web api
Smh
don't be rude
^
^
he is
I'm not
if I'm seemi--
i just ask a simple question
ok now...
no, you're just being offended that you didn't get what you wanted
You didnt
lmao
You expect to be spoon fed
Is there a feedback place?
Not sure
Can someone help with http get requests with a bearer token? :/
just ask your question
^
Affax not positive, but I believe DBL's github serves as a type of feedback
@compact oriole feedback for the website?
Yea
Best user analytics for your Discord server. See all the activity in your server live and filter data by roles.
How does it look?
It also works
(The bot)
fetch('URL.co.uk/api', {
method: 'GET',
headers: {
"Authorization": '1234',
"Content-Type": 'application/json',
"token_type": 'Bearer'
}
})
should work?
@earnest phoenix if your pc is on dark mode, the website starts as dark and vice versa
"Authorization": 'Bearer 1234'
It should be like that ^
Atleast in Discord
Pretty sure
if (command === 'cat') {
const { file } = await fetch('https://api2.com/public-api/stats/ModoSN/pc/generic', {
method: 'GET',
headers: {
"Authorization": 'Bearer 42cfa8f2-f2a8abe493d7',
"Content-Type": 'application/json'
}
}).then(response => response.json());
message.channel.send(file);
error saying it can't send an empty message,
how can i make it send like the raw GET
Is dis C#?
no its probably js
C# and js are both heavily based on java syntax, thats why they are all so familiar
I know nothing ;-;
so how do i do .catch
the hype
why do you have both await and .then 
also
you're mixing async and sync
stop doing that
idk where
that's what comes from copypasting and not understanding concepts
tldr monkey sees monkey does
totaly not doing the same
I dont understand the whole await and .then and the http request stuff, like at all
have you tried research
yeah but discord.js docs are very basic
discord.js docs don't cover async and sync concepts
that is something you should know when going into using the lib
i don't get why so many devs don't want to do research because it won't be "first try"
it's totally fine to read the docs and play around with different methods to see how it ends up with
I don't think you can call yourself a dev if you don't research stuff
psh
you are just a copy paster if you dont do research
it already has .then idk why it matters
question why are we using async?
but if you drop that
async can run while something else is running
if all apps were to be sync the world like you know it today would be extremely slow
i was running C# in vs under a blank solution
and now a dedicated C# .net core solution :3
nice
sooooo
me when i realised this
also
i am storing my command modules in a folder called modules
it can find them
nvm nvm nvm
im taking a look at the documentation first
man
i was so stingy that instead of paying $10 for dbm i learned coding
First time being stingy helped me
congrats lol
xD
feck
it cant find file
like where do i give the command handler a pointer to where it must search
you provide the context to ExecuteAsync
ExecuteAsync gets the message out of the context
and reads its content
then attempts to match your module and commands
in order for executeasync to find the module the class needs to be public and needs to extend ModuleBase<ContextTypeThatYou'rePassingToExecuteAsync>
How slow is using manager.broadcast() or manager.broadcastEval()?
@glacial mango yes you can
you need to uploaded them first though
but you can reference an upload to an embed image
What do you mean cry?
hm ok
true
same with tim
cry is nice dev
gods of this channel
how to invite my bot at this server?
-faq 1 @real crater
@real crater
@loud salmon thank you
How would you manage cooldowns for commands (stored in memory) across multiple shards?
People would rlly need to know more abt how your bot is setup
To answer tht question
a database?
well depends
you could save the time that it will next allow you to run the command again in the database then just cache it in an object or something then when people run the command you only have to compare it to an object then if it seems about right maybe call the db?
or just find a fast db
The issue is what if someone uses the command in a server with shard 1, then tries again on shard 2? It wouldnโt recognize the cooldown stored in the object fro shard 1 because they are separate processes
maybe save it to a external file might be inefficient tho
Or could I store the cooldowns in the file with the shardmanager and have the shards get/set cooldown info from there?
what
no
imo the most effective way of handling cooldown on a sharded bot is to store command usage in a database
but not storing a new document every time someone uses a command
Are we talking about large cooldowns or just small cooldowns to prevent spam?
this works for large & small cooldowns
lemme kinda run down how i would think it would work
I have a ;job command on a 15 minute cooldown
Then just use db
user X runs a command with a 1 hour cooldown and their command usage gets placed into a db like so:
id: X, command: cmdname, lastUsed: current unix timestamp
then if they ever run the command again, check the database for if the difference between now & when they last used the command is greater than the cooldown length or smth
You're concerned that your database would potentially get spammed?
I also have a ;fight command, where you begin a fight with a player. You canโt fight more than 1 player at a time, so if you run ;fight again, it tells you to finish your original fight
Nah
You could cache the cooldown on that shard once they've used the command once
how will other shards be aware of that cooldown
youd have to delve into ipc, which even then is not reliable
Hmmmm
But as said
the idea here is not to have setTimeout or setInterval
database only is actually your best choice because as i said
dbs can perform a lot of operations at once
plus without a cache, your bot is one step closer to being stateless
What does that mean?
stateless simply means your bot doesnt have anything stored in its memory, like caches
dont quote me on this
Is it ideal to be stateless?
as with everything in development :p
depends on how you build the cache
cant speak on behalf of 9000 million guild bots
Honestly dude fuck sharding lmao
Or should I say, sharding the traditional way
Canโt I just do internet sharding with one line or something?
I set my bot to have sharding: auto right?
hi
internet sharding lmao
you dont really need sharding unless the bot is above 2,000 guilds
Yea but my bot is growing faster than I expected and I wonโt have time to figure this stuff out later so I thought Iโd get it out of the way now
fair enough
i know people always say "but duuude you shouldn't shard at 30 guilds" but don't listen to people like that
if your bot is growing fast definitely go for sharding
hmm
well
might have to think about it at some point too den
i think we're gaining about 60 guild a day on average
but its going in a curve shape so ๐คท
... What? If you shard at 30 guilds it will have a negative impact.
Build your bot to be compatible with sharding, but sharding too early is bad
can someone actually explain how sharding works indepth
ik thew basics of it but kinda just interested in how it works in general
Wtf? In my bot (that is under development) and is in 2 servers, i use Auto sharding, and this work well..
^
^^
auto sharding would mean that it only uses 1 shard in that case unless you've set the guild count to 1 server each
If your bot is growing at an insanely fast rate, sure, shard away, but even at 100 guilds, there's still no need to shard
so it makes no difference
i use python AutoShardedBot
That thing determines the preferred amount of shards
so really I'd bet you just have 1 shard running
Ye
But now i don't care about sharding. When i release this and this grow, this just add additional shards.
Yes
But you should be aware that that doesn't mean your code will still work as intended when there's multiple shards

Currently I have no problems, and so much than I searched about discord.py sharding, this shouldn't have any effect to bot work. I know like JS have problems and much others, but i think not python
you're using () to encase all of the {}? shouldnt it be bot.on('messageReactionAdd', (messageReaction, user))
.. Any errors?
just thinking invalid syntax?
messageReaction is undefined
Unless you are using emoji somewhere else
Oh also ids should be strings
Yeh
I don't think the issue is in your messageReactionAdd listener
Actually
That is where it breaks
But it's because you're emitting the event with invalid parameters
var msgReaction = msg.reactions.get(event.d.emoji.name + ":" +event.d.emoji.id);
the reactions are mapped by id pretty sure
so it would just be .get(event.d.emoji.id)
Not sure why you're using the raw events, var and empty if clauses but the above should be what's causing the error ^^ @earnest phoenix
the raw event is needed to handle reactions on uncached/old messages
ah
good to know
would the raw events be fired before the other ones?
uhh
You can just ask stuff here, there's multiple people checking this channel regularly
yes, the raw event is fired first
you can even use the raw event to intercept and modify the data you receive before it is passed to other events
i use it to disable user and channel caching lul
oh
log msg.reactions and log event.d.emoji
Hey, so I'm learning sharding I'm wondering what I should put as the delay between spawning shard I heard I should do a 1 minute delay to allow it time to allow the prior shard to spawn is this correct
hmm?
most libs spawn shards like 5 seconds apart
there is a timeout though (usually 30 seconds) that libs wait for before they realize a shard isnt gonna connect anytime soon
shards can spawn synchronously iirc so dont worry about waiting for one to spawn
5 seconds is the rate limit, anything lower than that and you'll get rate limit errors
guess some libs do 10 seconds by default apparently
i do 5.5 seconds
Hey so I want to have my bot pass over a bit of code if it doesn't need it. Its a report command for mods, and it'll see if theres a channel. If there is, it'll send the report but still send the error message for there being no channel. Code block below.
let reportschannel = message.guild.channels.find(`name`, `reports`)
if (!reportschannel) return message.channel.send(`Uh... no reports channel`)```
.find function has changed a little bit
So you might want to try .find(c => c.name == "reports")
It should work on both ways afaik but just give it a try
Ah thank you, I'll look at the docs for more information.
yw
someone knows how can i create a Webhook with author message avatar and the author message username?
in discord js? @earnest phoenix
yep
thanks :D
np
How would I make a bot make roles ?
Which library do you use
^
if(message.member.roles.some(role => role.name === kevin)){
^
TypeError: Cannot read property 'roles' of null
the code works fine most of the time and then just replys back with this
are you trying to check if a user has a role @spark mantle ?
yes
pretty sure its .has not .some
ahh thanks
It's some
?
And that's not their problem
oh
The guild member is not fetched/kept, so it's null
do you use discord.js?
One message removed from a suspended account.
One message removed from a suspended account.
https://github.com/AnIdiotsGuide/discordjs-bot-guide/blob/master/understanding/roles.md @sage bobcat
Hi all
Does anyone know how I can send a user a DM in discord py?
https://gyazo.com/d0e98629f3a8551f9ca6a61a10c32d82
One message removed from a suspended account.
gern geschehen
One message removed from a suspended account.
lemme see
https://stackoverflow.com/questions/45317305/find-out-if-someone-has-a-role not sure, only thing i can really find is similar to js
One message removed from a suspended account.
One message removed from a suspended account.
thats true
hmmm
One message removed from a suspended account.
ty
https://abal.moe/Eris/docs/Role i did happen to find this @sage bobcat
Eris, a NodeJS Discord library
but not really he;pful
One message removed from a suspended account.
yeah i can't find anything
One message removed from a suspended account.
In eris, i believe there's a members prop
It's in the docs
Nevermind, I don't see it at first glance
One message removed from a suspended account.
One message removed from a suspended account.
I mean, you could just loop through every guild member and check if they have the role.
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
Maybe shorter
One message removed from a suspended account.
Check the roles array of each member and see if it included the role id
My bot has been running for more than 3 weeks normally. Today, it took a long time to respond to the commands, so I restarted and now he does not want to call, giving the error "Something took too long to do". Can anyone help me?
i already try change token and is not working
and now I tried to start the bot on my computer and it worked normally
what can i do?
@steady carbon .js?
@hollow tiger yes
if its computer im not really sure because i coded my first bot 1 years ago using computer and switched to using a website
..?
im not that good at computer stuff and havent hosted a bot running on a computer in a year
I'm using VPS Ubuntu 19.10
hmm
the bot was working until this afternoon
maybe ask someone else im not the person to ask when it comes to network
what is the chance of discord banning my vps ip?
Google Cloud
I doubt discord would block any compliant ips from that host, is it showing any error when booted?
the bot takes 5 minutes to call and then gives the error "Something took too long to do".
Thats strange, what libary are you using and lang
nodejs
with eris or discord.js?
discord.js
maybe.. mysql? kk
Whats the code that connects it minus the creditinals?
user ?
like what lines of code are you using to connect & use the db
let mysql = require('mysql');
let connection = mysql.createConnection({
host: "localhost",
user: "root",
password: "",
database: 'db',
charset: 'utf8mb4'
});
```this?
the connection its ok
Yes, that semes fine at least on the connection ยฏ_(ใ)_/ยฏ
shows "connected"
And then it just crashes and says something took too long?
i used
client.login(token).then("OK").catch(err => console.log(err));
don't show "ok"
and later 5 min
show "something..."
@brave loom Turn on developer options in your discord appearance settings and right click your server / name and click copy ID
Hmm
maybe.. discord was banned my vps address?
Well if it was banned it should not be timing out i believe it would just 401 Forbidden you, or whatever the code is
i don't know what i need to do
were do i right click
my bot is offline for more than 7 hours
i turned it on
you right click on your name to copy your name or on a server icon to copy it
and select copy id
So it just randomly stopped working @steady carbon nothing was modified?
wha?
i launched an update at 11:00 am
and it stopped working then?
right now i'm uploading the last update
wdym on a server icon
@brave loom https://support.discordapp.com/hc/en-us/articles/206346498-Where-can-I-find-my-User-Server-Message-ID-
well good luck @steady carbon, Never heard of this problem before, there is still a chance discord could of blocked you but im not sure if theres a way to tell right now
ยฏ_(ใ)_/ยฏ
and ok @brave loom
it says invalid token
what?
levi, br?
im doing this Discord bots | add your bot
what did you put in your client.login or whatever? A bot token or your ID
my id
are you using discord.js?
yeha
alright, you need to create a discord bot application, for more information look here https://discordjs.guide/preparations/setting-up-a-bot-application.html
ok
so
i did it
now wuut
i created it
do i need to add it to discord?
or is it already added to discord
You need to add it to your server and put the token in your client.login area. All of it is explained in https://discordjs.guide, just look through some pages and you will most likey find what your looking for
@final stone I changed the ip of the machine and now the bot is running but is VERY slow
Maybe it was ratelimited
Do you have any fast actions on your bot
ex, fast changing status?
status is changing in 15 secs
Hmm, thats a possible ratelimit but unlikely, any other things that are on a timer?
or like logs?
setinterval
no
anything that repeats
have only 2 setInterval in bot
weird
have SO MANY .delete(15000) in messages
then deletes it in 15 sec?
and.. this message is deleted after 15 secs
yeah
this is a problem?
relax kaka
create another bot token and see if its faster, if it is you were ratelimited and you should make anything that repeats repeat a bit slower, if not your vps could be having network mantiance slowing it down
Not really sure if there is another way to detect a ratelimit
IM LOST
huh?
what is your bots client id?
I don't think bots can read them from this channel, just in case do it in #commands so you wont get warned
it says im not allowed to link my bots client idea
Hello
ok
and how can i optimize the "api"
do you know?
@final stone
and sorry for mention
optimize the api?
yeah my code
I mean, you. wha?
Can you help me optimize the use of discord api in my code? or at least give me some tips on what to do to use less
Don't send as many useless requests. Kind of confusing what you mean, but most likely won't want to go through your code for that.
random ass discord
One message removed from a suspended account.
@valid frigate send the code
sorry for being a noob but
client.getScores = sql.prepare("SELECT * FROM scores WHERE user = ?");```
How do I make both of these variable accessible in other commands files?
it should be accessable by the client paramater
val embedJsonObject = JSONObject()
.put("title", "some title")
.put("description", "xd")
.put("color", 0)
val requestJsonObject = JSONObject()
.put("embeds", "[$embedJsonObject]")
"webhook url".httpPost()
.jsonBody(requestJsonObject.toString())
yeah about the whole string method
it's part of the http client
tryna send an embed sucks bro
so jsonBody needs a string as it's paramater?
for the most part
it should be an object, not a string
id think so too
also what's the right content type header to send
tried application/json
because ur sending js "{\"embeds\":[{\"title\": \"title\"}] }" and not json { embeds: [{ title: 'title' }] }
okhttp3 is fine
ok so the problem probably has to do with the fact that i'm sending stringified json
yea

dont see any reason not to tbh
yea okhttp3 is op af
yay -1 dependency
how do i make the bot detect if an input is in json?
im tired of the console log errors 
try catch
try {
//success
} catch(ex) {
//errored
}
Cept Danish is implying something's causing his code to throw errors, usually you want to fix those 
Here's my command
{
let messageID = message.content.split(" ")[1];
let editedmessage = message.content.split(" ")[2];
try {
message.channel.fetchMessage(messageID)
message.edit(JSON.parse(editedmessage)); //edit the message in Embed
} catch (err) {
message.channel.fetchMessage(messageID)
.then(message => {
message.edit(editedmessage) //edit the message if its not embed
});
}
}```
So I ran this command
`~edit 643682364303605760 {
"color": 0,
"title": "uwuwwuwuw",
"description": "OWO"
}`
and the picture below showcase the edited message
Sorry if i asked too much but im way too curious

Put the code in an actual codeblock please
if (command === "edit")
{
let messageID = message.content.split(" ")[1];
let editedmessage = message.content.split(" ")[2];
try {
message.channel.fetchMessage(messageID)
message.edit(JSON.parse(editedmessage)); //edit the message in Embed
} catch (err) {
message.channel.fetchMessage(messageID)
.then(message => {
message.edit(editedmessage) //edit the message if its not embed
});
}
}
messy code lol
hey im a noob sooo 
@earnest phoenix I don't know if you can edit an existing embed, I'm pretty sure what you are going to have to do is create a new embed with the same old stuff and change whatever was updated.
yup my goal, im gonna google ๐ข i think the fault is at let editedmessage = message.content.split(" ")[2]; since itll only take the { when i ran ~edit 643682364303605760 { "color": 0, "title": "uwuwwuwuw", "description": "OWO" } and i also need to delete the existing embed in the way
yea
instead of message.content.split(" ")[2]; do message.content.split(" ").slice(1); @earnest phoenix
Thank you anclint#9255! Here's my code if you guys want to critize or give a more cleaner way haha ๐
if (message.content.startsWith('~edit'))
{
var messageID = message.content.split(" ")[1];
var editedmessage = message.content.split(" ").slice(2).join(" ");
var embed = JSON.parse(editedmessage)
message.channel.fetchMessage(messageID)
.then(message => {
message.edit({embed});
});
}```
ok
You could do some research on var / let / const in javascript
Because using var for everything isn't rly the best way to go about stuff
You could split on " " just once and save the output in a variable which you can then use in the rest of your code
It's a good idea to avoid using the same name for different variables, in your case you're just executing one simple line of code in that .then() but if things get more complex it would be difficult to "see" what message is
oh yea i heard the myth where NEVER use var because .... And thanks for the other tip ๐
how to get DBL API Token
your bot's edit page
i cant find
why is my bot auto exiting
do i need to introduce a loop?
@earnest phoenix throw me a bone
xD
any one els
i told you why yesterday
what is your code
had: await _client.LoginAsync(TokenType.Bot, Environment.GetEnvironmentVariable("token_alpha")); await _client.StartAsync();
now i should have had:
Environment.GetEnvironmentVariable("token_alpha"));
await _client.StartAsync();
await Task.Delay(-1);```
try catch you're probably getting an exception
@earnest phoenix is right
its compiling correctly
C:\Users\ekore\Desktop\bot stuff\tanki alpha\bin\Debug\netcoreapp3.0\tanki alpha.exe (process 16172) exited with code 0.
To automatically close the console when debugging stops, enable Tools->Options->Debugging->Automatically close the console when debugging stops.
Press any key to close this window . . .```\
i thought i said i fixed the problem 
how many times do i have to tell you that exceptions are runtime things
That doesn't include runtime errors
VS can't just magically know if there is a runtime error
;-;
And if it did its not like it would know how to fix it because it's not a direct issue with your code but rather the way your code is written
;-;
Nor is it always up to date
cry you said catch errors how?
Try catch
Error?
you're lacking basic c# knowledge
and what is your code
all in here
:}
i asked for your code
basic c# doesn't mean knowing that c# uses () { }
i am used to C++
i do know what () and {} is
{} is used for functions and the main program
Well this isn't cpp
() for internal things inside a function
Then don't do that
I have adhd too, doesn't stop me from learning a language
it requires knowledge of TAP
Jumping into anything without basic knowledge of it is always a bad idea
The only times I have jumped into a language is when I have used similar languages
i have moderately C++ knowladge
i am stuck at the loop stuff
i cant wrap my head around it ;-;
There's a world of difference between cpp and cs
from what I'm seeing you have a misunderstanding between what is a beginner and intermediate knowledge
Discord Bots isn't beginner projects
you need to know the errors
understand them
Sometimes that's the best decision
F
Have I dropped projects because I didn't have enough experience? Yeah, everyone has
i have never been stopped by an error
Getting errors is what programmers lives is
(and that of system admin)
Bruh I gotta add to that; no matter what Language you do the bot wether you have knowledge in a similar language or not you gotta learn the basics of that language before jumping feet first
:3
No matter what language you do your gonna have to suck it up and learn the basics ATLEAST before jumping into a large and unforgiving module like discord
If you learn the basics it will save you a hell of alot of headache in future
i will just struggle my ass through it
It's not worth I tho, why would you rather spend hours upon hours being stuck on an error when you have no idea about the syntax and basic commands when that error could just be a syntax error, inspending a couple hrs learning the basics and not having to deal with those errors like syntax and basic errors
yayyy
i got my secure js sandbox working ๐
.DR Brain SporksDev js-test
create new context for channel 636822959201452042
Sandbox maximum allocation size reached, 10000768 requested in sandbox_realloc
couldnt run: Error: alloc failed
at [anon] (duk_api_stack.c:856) internal
at global (../js/636822959201452042.js:6) preventsyield```
can't use more than a specific amount of ram per request, can't run any code for more than 30ms per request
cant access i/o, except via a set of marshalled function calls
can anyone think of anything else i'd need to secure, to prevent people from being abusive with this?
hoi its noob danish again
Here my youtube search command that didnt success
if(command === "youtube") {
let search = require('youtube-search');
let opts = {
maxResults: 1,
key: '' // dont steal mah api pls
};
let video = message.content.split(" ").slice(1).join(" ");
search(video, opts, (err, results) => {
if(err) return console.log(err);
message.channel.send(results);
console.log(results);
});
}```
I have tried finding useful tips in https://developers.google.com/youtube/v3/docs/search/list but none really helped me out.
When i typed `~youtube owo` the bot send a message `[object Object]` and the console said below
because results is an Array of Objects
hm i just need to get the link one on the object and nothing else
then channel.send(<Object>.link)
i need to learn more sorry for making you spoonfeeding me
thanks
use common sense and there won't be need for that ๐
_<
the answer to your question is yes





wish i did not speak in this chat