#development
1 messages · Page 589 of 1
yeah but u didnt read the errors and youre not thinking
why not just delete them through the site or somethin?
Question about an issue with login features to bot for games
@elfin vale i cant delete them
So ive been playing certain games and it asks me to login to vote for a game so i get my ingame currency
try just committing (not pushing) then rming the files
however it wont let me sign it with my main account it only lwts me sign in with my alt why is that or how can i change that?
no, look i have this setup rn. I code on VSC, and push to github, and import from github to my "vps" thats it. But when i code again on VSC and before i push, i gotta take the JSON files on my "vps" and copy paste them on VSC and then push so poeple dont get different money. I wanna ignore these JSON files, so that the files on my "vps" doesnt get changed
@elfin vale
add them to .gitignore, if the files are already on the github repository, manually delete them from there
are the files on github rn?
i cant delete them cuz then they will be deleted from my "vps"
they should be ignored through .gitignore
why would they get deleted through your vps if you are deleting them on github?
if i put them on .gitignore, woont it put them on .gitignore on my "vps"
i don't rly get what you mean, no?
your files aren't going to be ignored. they just won't be pushed to github lol
@elfin vale can we dm so i can acctually show u
ok sure
How do you import them from github? Whatever youre using in your vps to do this, thats where you should set it not to import the json files
So i have to use a computer to sign into my main account...thats kinda dumb.
Because mobile doesnt have access to changing the accounts if its connected to one already
oof.
i think i fixed my bot responding to to other bots...
would this fix my bot responding to other bots xd maybe
it should
hopefully
Hey does anyone know how to make your bot leave every server its in? Im using discord.js
guild.leave;
}); ```
forEach
should do the job
Oh i'll try that, thank you
Lol but why?
Xd
its in a hacking server
What?
What is an hacking server?
why not only remove that server lol
lol do you have the guild id?
client.guilds.forEach(guild => {
if(guild.id === id) {
guild.leave;
}
});
I got the server ID
client.guilds.get("GUILD ID").leave
any errors?
where did you put the code?
in index.js
try putting it in client.on("ready") part
hmm still no result
try my thing than
client.guilds.get("GUILD ID").leave
oh wait I know why it doesn't work
client.guilds.get("GUILD ID").leave() try this
lol you sure your bot is still in that server?
yeah im sure
let me test on another server
ah it worked, finally, thanks for your help
Try by .find

yeah you could have also done it with client.guilds.find(g => g.id === "ID").leave()
nice
np
does anyone know a good tutorial to add music to a bot
You can just use ```js
let guild = client.guilds.get("<ID>");
guild.leave();
Or you can save a couple bytes by not creating a variable lul
thats really just nitpicky 🤷
hm, what's the best way to keep track of guild modlog cases if I'm using sqlite database
I was thinking of using count() to return the amount of cases the guild already has, is that efficient enough?
Anyone know why my bot randomly stopped logging in
Like when I start it it just gets stuck on the version number and doesn’t connect to the api
And I didn’t update the code or anything it just randomly stopped
bruh
Honestly if someone says "bruh" they're probably not interested in actually getting help
you might've gotten ratelimited
if you disconnect and reconnect too often
bots with under 100k guilds are restricted to 1000 IDENTIFY a day
isn't that for every bot?
A whole 1000
Sometimes discord auto resets tokens
You're kidding, right?
IK I'm like 30 mins late
In reference to the snippet I posted above: I know you can accomplish it without creating a variable, I just did it that may to make it more understandable.
@wooden prawn no 🤔
Why is that a thing that happens? Couldn't that break a lot of bots?
yes and it does
Again, why is that a thing?
Abuse
well it intentionally resets after 1000 connects in a day
but often that happens when discord breaks
or discord will just glitch and reset it
the api isnt exactly stable all the time
Never would be a better word for that
i've never had my token reset
discord only resets on too many IDENTIFYs
if your lib breaks and gets into a reconnect issue when discord has issues, it's the lib's fault
What is the minimum time that is aloud for the game the bot is playing to change?
I got this ```(node:6128) UnhandledPromiseRejectionWarning: DiscordAPIError: Missing Access
at item.request.gen.end (C:\Users\chill\Desktop\chill\discord-bot\node_modules\discord.js\src\client\rest\RequestHandlers\Sequential.js:79:15)
at then (C:\Users\chill\Desktop\chill\discord-bot\node_modules\snekfetch\src\index.js:215:21)
at process._tickCallback (internal/process/next_tick.js:68:7)
(node:6128) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
(node:6128) UnhandledPromiseRejectionWarning: DiscordAPIError: Missing Access
at item.request.gen.end (C:\Users\chill\Desktop\chill\discord-bot\node_modules\discord.js\src\client\rest\RequestHandlers\Sequential.js:79:15)
at then (C:\Users\chill\Desktop\chill\discord-bot\node_modules\snekfetch\src\index.js:215:21)
at process._tickCallback (internal/process/next_tick.js:68:7)
(node:6128) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 4)
(node:6128) UnhandledPromiseRejectionWarning: DiscordAPIError: Missing Access
at item.request.gen.end (C:\Users\chill\Desktop\chill\discord-bot\node_modules\discord.js\src\client\rest\RequestHandlers\Sequential.js:79:15)
at then (C:\Users\chill\Desktop\chill\discord-bot\node_modules\snekfetch\src\index.js:215:21)
at process._tickCallback (internal/process/next_tick.js:68:7)
(node:6128) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not hand```
i think its because the bot doesnt have perms like the user removed it
or something
}```
if(gay) return uber.send(your.number)
and thats a fax
a game fax
thanks for watching
is this a good site
Integrate your service with Discord — whether it's a bot or a game or your whatever you wildest imagination can come up with.
what language
discord.js
you can just add checks to the commands to prevent crashes
for kick and ban commands you just need to send and error if it doesn’t have the permission
yeai did that
okay so you can still send a message when they use a command with no perms
if(!message.guild.me.hasPermission('KICK_MEMBERS')) return message.channel.send('i don\'t have kick perms u meme')```
yes
oh epic
It checks if the bot has perms
Fixed
or put it in double quotes
I just typed that out on mobile
you meme
Ew double quotes
you are all memes
No u
send("hi")
send('hi') > send("hi")
Yes
oh yea your on a phone
its litterally one character
one more byte of storage 
ill tell you what
if im short of 1 byte exact
ill make sure to star switch over
it's like adding semi colons
waste of space
you're being less productive
I've proven this scientificly
except not adding semicolons is literally inviting unintended behavior to happen depending on your coding style :>>>
plus you're gonna get fucked for it in anything that isn't js
Sure if you code a 1 line bot
so i changed my bot's token to the new one discord changed it to and now my bot starts fine on my pc but it still gets stuck when i try to run it on my vps
No, I also use java I know how it feels to be forced to use semi colons
waste of time
you people are tripping if you aren't using semicolons
Same
glhf doing that in any professional environment with project guidelines
I dont work with other people
Same
And when I do, I'm one of the main devs
so i tried running my bot on my vps a few hours ago, and it got stuck on the version number, never got to like Connecting... or anything. I checked the discord page for it and noticed that the token was changed. So i went into my code, updated the token, and tested it on my pc to make sure it worked, and it connected fine. But once i move my files to the vps, it gets stuck on the version number again and refuses to connect to discord
no theres no errors or anything
it just gets stuck on like Discord.NET (2.0.1) or whatever
and like i said it runs completely fine on my pc
Oh
yeah ill have to go ask in the api discord
Good evening, it is possible to put a picture in the background of our presentation of our bot? if so can you give me the solution? please
Wdym
Yes, use css, we told you in #memes-and-media
Probably
Fuck
lol
hey. i need a little bit coding help...
i can code cmds an all but have no idea from the examples in #312614469819826177
can anyone help me a little bit?
thats was very nice 😅
Are you asking how to post your server count? @earnest phoenix
yeah
Ask in #topgg-api
ok thank you :D#
No problem
It's not really development related but I didn't see a better place.
So I'll be releasing a new version my bot soon that will adversely affect the functionality of the current system, what i was wondering is if i wanted to release another version of my bot with a new ID that they could move to when they have time, Would i need to create a new bot on discordbots.org or could i have my current one updated?
Thank you
in discord.js how would i make it so that if there is a ratelimit of some kind it would send the details about it in a channel, for example #ratelimits pm me if possible
Docs are a good thing
I wish more people read them
what didnt work?
Wait is it for like other api or discord's api like changing the game to fast?
@wet wedge I believe 15 seconds should be a safe value to go for if you want to have the status change over time
A lot of people do 10 seconds and it seems to be perfectly fine. I myself went to 8 seconds and also seems to be fine after a few months. This is out of my experience though
I'm not exactly sure where to get the exacts of the limits for status changes, but I know for the Discord Presence add-on in VSCode it seems to mention a 15 second limit
That's only rich presence
And rich presence works differently from status updates
It runs locally on your computer
Well yeah. It runs locally
But nevertheless it still calls the Discord API in some way
But still, I'd go for 10 seconds at most with status changes to be safe
Ok
anyone working on or could work on a twitch to discord mirror chat bot? It is rare as dinosaurs when it comes to public bots.
@high lava the application communicates with the discord client over RPC, and the client sends it to the API
Is that not still an API call?
Well I'm pretty sure the ratelimit is on the application-client connection
So how much is the limit on the normal status?
afaik you can update rich presence as often as you want
No, only once every 15 seconds
but the client will only send new data to discord every 2s iirc
Yeah. I swear to has to be less than 15 unless Spotify has some VIP rate limits, because Spotify updates within a second a lot of the time
lt me know what you think from general
and this
I have a part of a code someone sent
client.on("message",(message)=>{tmi.send(message.author.name+":"+message.content});
Half the code done in one line lol
Would connect discord.js to tmi.js
Discord and twitch
Both have onMessage and SendMessage events
thats what he said, Apparently he had a private version
If you guys are working on this or could work on it let me know via dm please ive spent weeks trying to trackdown a public bot that does this the two bots dwitchcord and streamercompanion are down have a good night for now
Hi, I' m triying to create a command that shows an embed, and the bot will react with 2 emojis, left and right, in order to change pages of the embed. Does anyone know where can I find more information about this? Thanks : )
reaction collector
How to make my bot tell me how many people are using it
Dpy
Show server count? amount of users the bot can see?
wouldn't it be what you have for guilds but replace guilds with users?
Ah, ok then
if it's too large put it on hastebin
@bot.command(name='users')
async def _users(ctx):
return await ctx.send(f"{len(bot.members)} members.")
dont work
tried bot.users?
i can, but it makes it harder to help you if you can't test what advise we give
i can't test locally myself as i'm in school rn
let me test
how to add Rich-Presence
nice idea
VPS ??
if __name__ == '__main__':
Setup().setup()
for extension in settings.toggle_extensions:
KonekoBot.load_extension("src.modules." + extension)
for extension in settings.core_extensions:
KonekoBot.load_extension(extension)
# Dry run option for travis.
if KonekoBot.dry_run is True:
print("Quitting: dry run")
close = loop.create_task(KonekoBot.close())
loop.run_until_complete(close)
loop.close()
exit(0)
got this small piece of code implemented for travis-CI so i can test if my code works but recently my builds have been failing with this trace
Quitting: dry run
Traceback (most recent call last):
File "KonekoBot.py", line 82, in <module>
loop.run_until_complete(close)
File "/opt/python/3.6-dev/lib/python3.6/asyncio/base_events.py", line 484, in run_until_complete
return future.result()
File "/home/travis/virtualenv/python3.6-dev/lib/python3.6/site-packages/discord/ext/commands/bot.py", line 210, in close
await super().close()
File "/home/travis/virtualenv/python3.6-dev/lib/python3.6/site-packages/discord/shard.py", line 293, in close
await self.http.close()
File "/home/travis/virtualenv/python3.6-dev/lib/python3.6/site-packages/discord/http.py", line 233, in close
await self._session.close()
AttributeError: 'NoneType' object has no attribute 'close'
The command "python KonekoBot.py -t "TOKEN" -d 1" exited with 1.
using python ^3.6 + discord.py
anyone got some tips on closing the client session?
@hybrid raptor Contabo
for 5 euro you get 8gb of ram and 4 cores, KVM vps as well
I tested them myself and hosted there for 4 months and we never had problems
Ive heard bad things about contabo
Queue master? Wut
How do I make someone queue master on scrimius??
hey
ty
Anyone know how to do the webhook stuff in js with dblapi.js? For me when i try webhook it just errors about the on thing
||```js
dbl.webhook.on('ready', hook => {
// stuff
});
oof
could anyone help me
why doesnt it go all the way to the left too
please help
never mind
i got it
not working
document.getElementById("support").innerHTML = "Destek Sunucusu"
document.getElementById("report").innerHTML = "Bildir"
document.getElementById("websitelink").innerHTML = "İnternet Sitesi"
document.getElementById("edit").innerHTML = "Düzenle"
document.getElementById("github").innerHTML = "Github Sayfası"
document.getElementById("createdby").innerHTML = document.getElementById("createdby").innerHTML.replace(/Created By/, "Botun Yapımcıları")
document.getElementsByClassName("votebutton")[0].innerHTML = "Oy Ver"
document.getElementsByClassName("votebutton")[1].innerHTML = "Davet Et"
@inner jewel
what problem
You need to elaborate on your issue, as saying "not working" provides no information on the issue you are experiencing.
step 1. google/duckduckgo cause that's even cooler
Littearly the first result
@uneven pond only certified developers can use javascript
also read the channel description next time, dont randomly @mention people for help
@harsh nova thats a different one, that will not work
do you actually need certification to use js?
how would i make this open in a new page
you can't with location.href="..."
so you need window.open
read the docs i sent
then you're doing something wrong™
no U
where are you doing this?
Where to host bot
what
Any website to host bot
?
Vps
I can't
then glitch.com or a vps
then vps
Cough... Google/amazon... Cough....
My free 12 months in google expired, now im paying uh.... Like 1$ per month?
Uses glitch.com
once again, google or amazon are great vps's and are free for 12 months
12 months is more than enough time to both test your bot's feasibility and save some money for another vps or to continue the service
even if, its not that expensive to pay for a vps, literally dont go to starbucks for one day and you already got enough money to pay a monthly vps
exactly lmao, skip starbucks once a month and you got yourself a vps
[Command("echo")]
public async Task sendEcho([Remainder]string UserMessage)
{
// execute some code...
}
Is it possible to do something like [Command("")] so the bot listens to all messages?
is there a way to get a users username if my bot is not in any mutual servers to that user?
dont use JDA
.JS
sorry i didnt specify it right
Cannot read property 'username' of undefined
^^
yeah
?
yeah?
do you know what a promise is
a promise is something that makes people sad if you break it
const DBL = require("dblapi.js");
const dbl = new DBL('dbltoken', { webhookPort: 5000, webhookAuth: 'pass' }, client);
// Optional events
dbl.on('posted', () => {
console.log('sended');
})
dbl.on('error', e => {
console.log(`Error: ${e}`);
})
dbl.webhook.on('ready', hook => {
console.log(`Webhook http://${hook.hostname}:${hook.port}${hook.path}`);
});
dbl.webhook.on('ready', hook => {
console.log(`Webhook http://${hook.hostname}:${hook.port}${hook.path}`);
});
@zinc condor
try this
My shard file: https://paste.tscforum.com/purqtuoriv.js
my index file: https://paste.tscforum.com/palbrdzsmf.php
Like i wanna use shards, but how would i do that because i already have port runing in my index file, so i have to connect them some how
help^^^^^^^^^^^^^
what does a shard and the HTTP port have to do with eachother?
Youcant run two servers on the same port
how
so only run the server on shard 0 then
why would i do that
he literally just said why
Because you cant run 2 servers on the same port
or, you know, make your website separate from your bot
shard id
no
not shard count
Lol
😑
seriously
yes
just dont have your bot and the website in the same process
i dont understand
I think it may be his vote handler
maybe
look at the route he defines
yes, we realize
we've given you multiple ways to fix it friend
wait is that the only thing in your index file?
well, i said i dont understand
The most obvious way is to separate your website from your bot
@amber fractal no
Just use a different port
how do i change the port for shards
...
That doesn't solve the underlying problem
you cant lmao
you just run it on 1 shard, or make the bot and the website different
how tf do i do that
There's no reason for them to even be in the same code
you can run things on certain shard id's
Wait, I didn't read all the messages what even is he doing
and what nik said
He's running separate shards
and the shards each are trying to run a website on port 3000
so plz tell me what to do, dont tell me we already told ya mate
your bot code and the code for your website shouldnt be in the same file tho
Take your website code
and separate it
take code
put code in new file
node file.js
do i name the new file file.js
it can be whatever you want
if that's all the code for your website yea
glitch
no
hi ken
tell me why
How's that uptime robot
could you imagine if DBL was hosted on glitch?
@languid dragon It isnt? 
the fact that you have to trick your host into thinking that your bot is a website should be a red flag
and that its being "actively used"
but i need the webstuff in index.js cause of the vote thing
the vote thing is listening on the listener
What do you want me to do? Wave my wand and say that everything is fixed?
what do i want you to do, i want you to dont be mad and sacrastic, thats 1
I'm not mad, friend
Well, what do you do with the votes?
That's the path I would go
That's what I would do
Separate out the vote handler and make it use a discord webhook instead of sending through the bot
this will work right
it will take my bot thing in the index and put it in this file
so now bot.guilds.size works etc
I don't know
for some reason i got this error
throw err; // Unhandled 'error' event
^
Error [ERR_UNHANDLED_ERROR]: Unhandled error. ([object Object])
at Client.emit (events.js:178:17)
at WebSocketConnection.onError (C:\Users\chill\Desktop\chill\discord-bot\node_modules\discord.js\src\client\websocket\WebSocketConnection.js:374:17)
at WebSocket.onError (C:\Users\chill\Desktop\chill\discord-bot\node_modules\ws\lib\event-target.js:128:16)
at WebSocket.emit (events.js:189:13)
at _receiver.cleanup (C:\Users\chill\Desktop\chill\discord-bot\node_modules\ws\lib\websocket.js:211:14)
at Receiver.cleanup (C:\Users\chill\Desktop\chill\discord-bot\node_modules\ws\lib\receiver.js:557:13)
at WebSocket.finalize (C:\Users\chill\Desktop\chill\discord-bot\node_modules\ws\lib\websocket.js:206:20)
at TLSSocket.emit (events.js:189:13)
at emitErrorNT (internal/streams/destroy.js:82:8)
at emitErrorAndCloseNT (internal/streams/destroy.js:50:3)
but i got it on 2 bots on the same machine
so idk why oof
Ugh I hate that error
client.on("error",e => console.log(e))
explaim someone please
im java btw
com.google.gson.JsonSyntaxException: java.lang.IllegalStateException: Expected BEGIN_ARRAY but was STRING at line 7 column 1 path $
at com.google.gson.Gson.fromJson(Gson.java:899)
at com.google.gson.Gson.fromJson(Gson.java:852)
at com.google.gson.Gson.fromJson(Gson.java:801)
at com.google.gson.Gson.fromJson(Gson.java:773)
at com.hikaribot.requests.Response.toService(Response.java:41)
at com.hikaribot.scheduler.jobs.GithubChangesJob.lambda$null$0(GithubChangesJob.java:52)
at com.hikaribot.requests.Request.handle(Request.java:88)
at com.hikaribot.contracts.async.Future.lambda$send$2(Future.java:81)
at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
at java.util.concurrent.FutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.IllegalStateException: Expected BEGIN_ARRAY but was STRING at line 7 column 1 path $
at com.google.gson.stream.JsonReader.beginArray(JsonReader.java:350)
at com.google.gson.internal.bind.CollectionTypeAdapterFactory$Adapter.read(CollectionTypeAdapterFactory.java:80)
at com.google.gson.internal.bind.CollectionTypeAdapterFactory$Adapter.read(CollectionTypeAdapterFactory.java:61)
at com.google.gson.Gson.fromJson(Gson.java:887)
... 12 common frames omitted```
so wait
Are you trying to decode it to a class?
do i just do client.on("error",e => console.log(e))
and thats it
cuz two bots failed
@zinc condor
...
question
is this your code thats erroring
well its a combo of two projects
im trying to do a merge type thing
anyway for my current working project how do i post my server count to the dbl site
like it says N/A right now
?
@hushed berry that thing we did, makes my bot shut down randomly
fuck
everything works, exept it shuts down after 5 min
{"error":"Unauthorized"} when I try to POST to the API. How do I send the token
What does "as an http header" mean
you send the token as a header in your POST request
anybody know how to make guild count show on the site dbl in java?
nop use DBM
rephrase
ok yes hello how would i display the guild value on dbl site for my bot http://98.213.232.85/stats
@zinc condor they have a java library: https://github.com/DiscordBotList/DBL-Java-Library
other than that, you can manually send a POST request
ok
to send a manual POST request, check this (scroll down to the bottom): https://discordbots.org/api/docs#bots
@kind roost if that is json, starting with[ and ending with ] means its an array
so you have to access it using array indexes, for example variable[0] for index 0 (in javascript)
let me check
[Command("echo")]
public async Task sendEcho([Remainder]string UserMessage)
{
// execute some code...
}
Is it possible to do something like [Command("")] so the bot listens to all messages?
@quartz kindle i do not understand that
@zinc condor what is it you dont understand?
let field = 'text'
if (field.length >= 1024) return
.addField(text)
That would work ?
I want to check if the length of that field = 1024
If true stop
If false it add the fields
And how i do that
RichEmbed.addField(), where RichEmbed is the variable you set the embed to.
As I said, where RichEmbed is the variable you set the embed to.
You're not forced to name every embed variable embed
So instead, I wrote RichEmbed which is the class for it
Won't work since you're breaking the constructor with other code
Depends what you're trying to do, which I have no clue
Wait. I got this
I know that much
This just makes sure to only put 1021 characters and then it replaces the last 3 with "..."
oh alright
But the id isn't going to surpass 1024 characters anyway, so that statement is never going to run
dont use free hosting
.addField("description",field < 1024 ? field : field.substring(0,1023))
^ I need to learn that format, but that is better
its quite easy
var1 > var2 ? = if(var1 > var2)
response1 : response2 = { response1 } else { response2 }
condition ? true : false
I've seen it used all the time, but never really understood that's how it was structured. thanks
the difference is that it takes the result and returns it immediately, where a regular if doesnt
so you can use it to structure sentences for example
the name for it is "ternary opterator" if you want to google it
Ok. I see. This looks like it could come in handy. Thanks
Is using arrow functions in browser JS a bad idea?
@quartz kindle field.length btw. Not just field
@hushed berry only if you want to support old browsers
if you're like "fuck IE", then go ahead and use them
why is this happening? it's sending messages twice now (discord.js)
Two instances?
lmao
Just reset the token @grim aspen
for some reason my websocket connection keep crashing my bot. Do i have this setup right?
dbl.on('posted', () => {
console.log('Server count posted!');
})
dbl.on('error', e => {
console.log(`Oops! ${e}`);
})
and I have my bot under bot instead of client
const bot = new Discord.Client();```
I just want to know how to fix this issue.
you say websocket but send code for a dbl webhook
🤔
this is my error and it has correlations to the webhook
WebSocketConnection.onError(/root/node_modules/discord.js/src/client/websocket/WebSocketConnection.js:374:17)
at WebSocket.onError (/root/node_modules/ws/lib/event-target.js:128:16) ```
what makes you think that they are correlated
because webhooks dont touch websockets
because today is when I added the webhook and today my bot crashes every hour
show your full dbl code
you are most likely using free hosting that isnt strong enough to handle so many requests
const bot = new Discord.Client();
const DBL = require("dblapi.js");
const dbl = new DBL('key', bot);
dbl.on('posted', () => {
console.log('Server count posted!');
})
dbl.on('error', e => {
console.log(`Oops! ${e}`);
})
And I'm not using a free hosting, I'm using my vps
the code looks correct. do you get the server count posted logs?
yes
you're not using any webhooks anyways
lmao
so its not related to webhooks
alright.
you can try removing the dbl code and see if the error stops
so confirm it is indeed caused by dbl
I tested that this morning and the errors did stop
but when I re-added the script above, my errors came back
you can try switching from dbl to manual posting
alright
some php developer here?
I have some if statements in an asynchronous function, is there a way to make evaluating the if statement and then (if true) executing the code in a blocking way? In short, is there a way to make the evaluation and execution of an if statement blocking in JavaScript?
I hosted my bot on heroku and it get online but command not working
No errors
I use to host it my self
But when I host on heroku
Bot get online but no command working
@zealous veldt depends on what you mean by blocking
as in the entire node event loop or just that function
nodejs is async in design which is meant to be non blocking though
thats why promises and callbacks exist
I return an asynchronous promise as part of a message handler, I have an if statement in that to check if the author is a bot. Because it's asynchronous, that if statement is essentially useless.
if(msg.author.bot) resolve();
oh then I think you should either throw an error so you can catch it in the message handler
I suppose I could make the checking a blocking function, and pass resolve () as a param
or add some return data in the promise
what does your message handler even do after resolving
Nothing as of now, I just make it a promise so I can easily await it later when I add more to the message event
yeah well like I said you could throw an error
Yeah
or just reject the promise if it is a bot
Yeah
likely, I'll experiment with some solutions in a bit
let promise1 = new Promise( (resolve, reject) => {
let dataReceivedSuccessfully = false;
if (dataReceivedSuccessfully)
resolve('Data Available!');
if (!dataReceivedSuccessfully)
reject('Data Corrupted!'); })
promise1.then( (message) => {
console.log(message);
}).catch( (message) => {
console.log(message);
})```
That would always reject
yeah I know how to pass data
my original question was just about the possibility of blocking if statements
well afaik promises/async functions are async so its either resolve or reject
Fix: do you actually have a command handler 🙃 ping command does not create itself
lmao
this is server is only for discord bot
just ask your question here @magic sail
no need to get someone specifically
just post your problem and someone will get to it
ohh
Is it possible to send raw svg data as an image in an embed?
Is it possible to make a bot which collect information from different server and show them in a single server
@fossil oxide
I am having a problem with the editPermission I am trying to make a lock channel command and it keeps erroring.
const everyone = message.channel.guild.roles.find(r => r.name === '@everyone');
const reason = args.splice(0, args.length).join(' ') || `This channel has been locked by ${message.author.username}#${message.author.discriminator}`;
message.channel.editPermission({
overwriteID: everyone.id,
allow: 1024,
deny: 2048,
type: 'role',
reason: reason
});
Am I doing this wrong?
TypeError [ERR_UNESCAPED_CHARACTERS]: Request path contains unescaped characters
I am using Eris
So my bot exists for several months now, just like it's on_shard_ready event, but only now at this random moment during it's several days of uptime it finally posted it
Can someone please explain me how does that event even work
when the client has been populated that even is fired
which means when the client downloads all guilds
well this doesn't seem the case for me, if you read my messages at all
you receive a READY event if you reconnect (not resume)
so it doesn't happen on startup?
Dear people; I have python 3.6.5 installed but it won't pip install discord.py
MBA-Leerling-10123:~ ZL109819$ pip install discord.py
DEPRECATION: Python 2.7 will reach the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 won't be maintained after that date. A future version of pip will drop support for Python 2.7.
Collecting discord.py
Using cached https://files.pythonhosted.org/packages/97/3c/2a97b47fd8839f8863241857bbd6a3998d1de1662b788c8d9322e5a40901/discord.py-0.16.12.tar.gz
Collecting aiohttp<1.1.0,>=1.0.0 (from discord.py)
Using cached https://files.pythonhosted.org/packages/09/5a/7b81ea8729d41f44c6fe6a116e466c8fb884950a0061aa3768dbd6bee2f8/aiohttp-1.0.5.tar.gz
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/private/var/folders/z4/fh92f59s4_7_494pvnk20mmm0000gq/T/pip-install-gvGyeQ/aiohttp/setup.py", line 60, in <module>
raise RuntimeError("aiohttp requires Python 3.4.2+")
RuntimeError: aiohttp requires Python 3.4.2+
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /private/var/folders/z4/fh92f59s4_7_494pvnk20mmm0000gq/T/pip-install-gvGyeQ/aiohttp/
Anyone has idea what I am doing wrong?
Or how to solve
in the future, put such long copy-pastes into codeblocks that's easier to read
Ofc.
You're on python 2.7
It's Terminal
Is this a mac?
Yea
Ah, pip didn't worked either
Last time it worked, but that's already long ago. But laptop got reset so need to reinstall
try with pip3 install discord.py
MBA-Leerling-10123:~ ZL109819$ pip3 install discord.py
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.6/bin/pip3", line 7, in <module>
from pip import main
ImportError: cannot import name 'main'
Otherwise to get voice support you should run the following command:
python3 -m pip install -U discord.py[voice]
This worked for me I think
This is the right api I hope
cannot import name main that is concerning...
Yes, very weird I don't understand
Well I try if it works now
When I import Discord into Idle
make sure idle isnt using 2.7
why do you hate it
Because of the chances in command and there is less support
you mean async is better?
Also, I got stuck within the first few lines when I used rewrite
You don't have to use async
I heard async was bad
But idk a lot about that.
Well and now it's aiohttp who fucks
Uwusum
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/aiohttp/connector.py", line 924, in _wrap_create_connection
await self._loop.create_connection(*args, **kwargs))
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/asyncio/base_events.py", line 804, in create_connection
sock, protocol_factory, ssl, server_hostname)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/asyncio/base_events.py", line 830, in _create_connection_transport
yield from waiter
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/asyncio/sslproto.py", line 505, in data_received
ssldata, appdata = self._sslpipe.feed_ssldata(data)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/asyncio/sslproto.py", line 201, in feed_ssldata
self._sslobj.do_handshake()
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/ssl.py", line 689, in do_handshake
self._sslobj.do_handshake()
ssl.SSLError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:833)
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/Users/ZL109819/Documents/Test.py", line 1212, in <module>
gopbot.run(Token)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/discord/client.py", line 519, in run
self.loop.run_until_complete(self.start(*args, **kwargs))
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/asyncio/base_events.py", line 468, in run_until_complete
return future.result()
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/discord/client.py", line 490, in start
yield from self.login(*args, **kwargs)
*ssl
@surreal peak
Hey
Mmh
Did yous ask
I see it stated in the rules you need to ask to send a invite for your bot @earnest phoenix
Or am I wrong

Ight
i wanted it to send a message in a certain channel if the bot was removed from a server, or added to one
hope you can help
I never understood what f stats for
f is for formatting things in {} isnt it?
well I just use .format() in that case
Can you help with my command tho?
this is async?
Yup
well yeah
but
my friend has a really advanced bot, and he is trying to do that, but he cant do it
So
im asking here. bcoz its easier?
Fair but
atleast hes tryi9ng
this is what he has for it so far.
@client.event
async def on_server_remove(self, server):
embed = discord.Embed(description=' Neko has been leaved the server `{0}`'.format(server), color=botcolor)
embed.set_footer(text='This message was requested by Neko')
embed.timestamp = datetime.utcnow()
channel = server.get_channel("555533937208852500")
await self.client.send_message(channel, embed=embed, server="382290709249785857")
But, can anyone help me, still
I don't think anyone can, considering that you are using the outdated version of the library
you said that's async, now it's rewrite
Boi
await self.client.send_message(channel, embed=embed, server="382290709249785857")
I recognize rewrite when I see one, and this is not it

What language are you using?
oof I only know discord.js
oof
ree async py
Py for noobs
@ruby dust fstrings added in 3.6
Helpful when you have too many {} in your code
Also afaik its performance is better than on .format()
so it basically replaces the .format()?
real shit, what's a websocket close 1001 code
Basically yes, it is
But with more comfortable visual part
1001 indicates that an endpoint is "going away", such as a server going down or a browser having navigated away from a page. @scarlet bane
right but does discord's WS change that at all or
Like, does discord mean something different?
That will probably be "Connection lost" from Discord and you can't do much, I believe
Do you get 1001 from vc or?
i believe thats a cloudflare disconnect
isnt
Cus it gets locked in a resumeloop after that happens a few times
Like, i get 1001 3 times in a row, and then the only thing i can do is do a full reconnect
all future resumes cause a 1001
until i reconnect without a resume
hi guys
help
pip install dblpy
Traceback (most recent call last):
File "/usr/bin/pip", line 11, in <module>
sys.exit(main())
File "/usr/lib/python2.7/dist-packages/pip/init.py", line 215, in main
locale.setlocale(locale.LC_ALL, '')
File "/usr/lib/python2.7/locale.py", line 581, in setlocale
return _setlocale(category, locale)
locale.Error: unsupported locale setting
when installed libs such error
what is your locale
oh, its empty
cool.
@white sky what operating system is this
@scarlet bane ubuntu 16.04
Using spoilers for that isnt the best idea...
dont worry
@white sky can you show me the result of locale?
its taken care of
locale
locale: Cannot set LC_CTYPE to default locale: No such file or directory
locale: Cannot set LC_ALL to default locale: No such file or directory
LANG=en_US.UTF-8
LANGUAGE=
LC_CTYPE=UTF-8
LC_NUMERIC="en_US.UTF-8"
LC_TIME="en_US.UTF-8"
LC_COLLATE="en_US.UTF-8"
LC_MONETARY="en_US.UTF-8"
LC_MESSAGES="en_US.UTF-8"
LC_PAPER="en_US.UTF-8"
LC_NAME="en_US.UTF-8"
LC_ADDRESS="en_US.UTF-8"
LC_TELEPHONE="en_US.UTF-8"
LC_MEASUREMENT="en_US.UTF-8"
LC_IDENTIFICATION="en_US.UTF-8"
LC_ALL=
@scarlet bane
try locale-gen
I got 0 respons while installing apache2 on Raspbian 7, what happened?
@white sky
locale-gen
Generating locales (this might take a while)...
en_AG.UTF-8... done
en_AU.UTF-8... done
en_BW.UTF-8... done
en_CA.UTF-8... done
en_DK.UTF-8... done
en_GB.UTF-8... done
en_HK.UTF-8... done
en_IE.UTF-8... done
en_IN.UTF-8... done
en_NG.UTF-8... done
en_NZ.UTF-8... done
en_PH.UTF-8... done
en_SG.UTF-8... done
en_US.UTF-8... done
en_ZA.UTF-8... done
en_ZM.UTF-8... done
en_ZW.UTF-8... done
id_ID.UTF-8... done
Generation complete.
pip3 install dblpy
Traceback (most recent call last):
File "/usr/bin/pip3", line 11, in <module>
sys.exit(main())
File "/usr/lib/python3/dist-packages/pip/init.py", line 215, in main
locale.setlocale(locale.LC_ALL, '')
File "/usr/lib/python3.5/locale.py", line 594, in setlocale
return _setlocale(category, locale)
locale.Error: unsupported locale setting
hm
export LC_ALL="en_US.UTF-8"
export LC_CTYPE="en_US.UTF-8"
and then ```
dpkg-reconfigure locales
yep
nvm
dpkg-reconfigure locales
Generating locales (this might take a while)...
en_AG.UTF-8... done
en_AU.UTF-8... done
en_BW.UTF-8... done
en_CA.UTF-8... done
en_DK.UTF-8... done
en_GB.UTF-8... done
en_HK.UTF-8... done
en_IE.UTF-8... done
en_IN.UTF-8... done
en_NG.UTF-8... done
en_NZ.UTF-8... done
en_PH.UTF-8... done
en_SG.UTF-8... done
en_US.UTF-8... done
en_ZA.UTF-8... done
en_ZM.UTF-8... done
en_ZW.UTF-8... done
id_ID.UTF-8... done
Generation complete.
And what if you do the pip install now
works?
👍
❤
@quartz kindle oh huh, oddly enough, the arrow functions worked just fine in IE
unless my framework is doing some magic
it's probably transpiling to older stuff
if (message.includes("everyone") || (message.includes("here"))) return message.channel.send('No')
It's no possible ?
How can I do this?
i forget what @ here looks like in code
Just test it in a private server and see
but @ everyone and @ here are not normal text
Hein ?
No i just want if my message content everyone return
Juste this
How can i do this ?
Just check for mentions smh
No i just want if my message content everyone return
Just this no mention
Who can help me ?
if (message.content("everyone") || (message.content("here"))) return message.channel.send('No')
I test this but message.content is not a function error of the console
if (message.content == "everyone" || message.content == "here") return message.channel.send('No')
how bout dah?
?-?
if (message.mentions.everyone) return message.channel.send('No');
Or that ^ that will probs be 10000000 x better lol
Was taking a stab in the dark without reading the context
nope, you don't have to change anything, it sees both everyone and here mentioned if you do that
How can I see sir is the bot sending? ex : if (messageauthor.bot..mentions.everyone) return
It's possible ?
And thanks he work @steel heath
You mean: if (message.author.bot && message.mentions.everyone) return;? This will only catch if a bot mentions everyone/here
@lofty hamlet im not sure, is it python?
that's nodejs
its not i dont think
i use the same code for my bot
xd
nodejs is not a language, never was never will 😩
oh okay thx
@heavy agate for future reference "&&" and "||" don't exist in python
@scarlet bane it exists
no
I also didn't know that
it's and and or


