#development
1 messages · Page 955 of 1
send it to liv
lib*
discord.js likes to do a lot of the steps for their users because they know most of their userbase is dumb
but by doing that you lose the customisation
hey stack, how can i check if a user has blocked my bot because i made a rickroll command that dms the user a rickroll link?
You can't
penis
problem solved
ah yes
it was sarcasm shivaco
i tried a catch block but it didnt work ://///
did this man just refer to this channel as stackoverflow
Solid
yes
you can catch the promise
<Promise>.catch(r => doShit()))
alternatively, <Promise>.then(r => doShitIfSuccess(), r => doShitIfFail())
i fixed it lmao
alternatively ```js
try {
await something();
}
catch(err) {
error
}```
but that's wack tho
im pretty sure that doesnt work on promises
yes i left out error8)))))
it does
ye it does
await is the key
oh you are awaiting it
imagine using await/async i make a CATCH PYRAMID like a real PROGRAMMER
(node:19472) UnhandledPromiseRejectionWarning: DiscordAPIError: Cannot send messages to this user
(node:19472) UnhandledPromiseRejectionWarning: DiscordAPIError: Cannot send messages to this user
well
o h
try reading the error
i didnt add await hahahahahaahahahhahaahaahahahahhfwuskgakeugiueaygkeaugkeaugr
that might help
@pure lion show code
i fixed it for real this time
if only there was a website
gusymad
where you could see that
see what
i made CODELyon
ok
how can i make when user vote get a role
let support = bot.guilds.cache.get("563708914265358336");
if (support === undefined) return;
let role = support.roles.cache.find(r => r.id == "716983765993259078");
let member = support.members.cache.get(vote.user);
member.send("Thanks for voting for luffybot")
if (member) {
member.roles.add(role).catch(error => {
console.log(`this user not in support server`);
});
}
});```
Where can I find all the rate limits of discord?
docs
@earnest phoenix nope
any error?
nope
@earnest phoenix
let support = bot.guilds.cache.get(configf.bot.supportserverid);
if (support === undefined) return;
let role = support.roles.cache.find(r => r.id == "716983765993259078");
let member = support.members.cache.get(vote.user);
member.send("Thanks for voting for luffybot")
if (!member) return
if (vote.type == "test") {
console.log("Test successful!")
} else {
if (vote.type == "upvote") {
bot.channels.cache.get(configf.logs.voters).send(`Thanks for ${vote.user} just upvoted for ${configf.bot.botname} `).then(() =>{
member.roles.add(role).catch(error => {
console.log(`this user not in support server`);
});
})
}
}
});```
hmm,so?
Passport?
yes
Wdym by that
Please Don't Say Just Hello In Chat 2010-07-19 12:32:12 you: Hi 2010-07-19 12:32:15 co-worker: Hello. ## CO-WORKER WAITS WHILE YOU PHRA...
I mean, you could do the authentication yourself
^
how would i do that?
You can create your own middleware, which is basically just a function which is ran after each request
Check it manually
let KitPass = guild.roles.cache.find(role => role.name === 'KitPass') Why this doesn't work?
Role doesn't exist?
or not cached
^
No, the role exists, but it is not found as it is not set correctly on the channel. channel.updateOverwrite(KitPass, { CONNECT: true, SPEAK: true, MOVE_MEMBERS: true });
KitPass should work as well, if it's not null or undefined
Now i fix it, I just had to put a then
Ok
If after creating a role, I want to set all permissions to OFF, how can I do that?
If you create a role it should give the automatic perms
@cinder patio All works
anyone a php programmer?
just ask your question
API dead?
What's better to cache, redis or memcached
Looking to cache hundreds of thousands of rows
redis is generally more powerful and has more features
memcached is probably easier to use
Just build youre own lul
at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:64:26)
(node:6705) 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(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 2)
(node:6705) [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.
Help
Vps error nvm
Hey can anyone tell me how to run a bot on glitch?
create an account, create a project
Lmao
yea I already did that
if using javascript, install the required npm libraries and move your files there
if using python idk, i know it supports python but idk whats the procedure for it
yea good idea
Dank Memer is switching to mongodb :0
from what?
from what?
@quartz kindle rethinkdb iirc
and I already know that people were reporting you for annoying behavior
ah, never used rethink, it was hyped up for a while but i never bought the hype lul
makes sense i guess
https://dankmemer.lol/source I saw it here iirc
if using python idk, i know it supports python but idk whats the procedure for it
@quartz kindle o so there is a python on glitch 👀
idk i often heard that yes
yeah sadly
sadly? lmao
Lol
sounds illegal
lmao
I am doing this for perfectly legitimate reasons
🚣♂️
you know whats fucking dumb as shit tho
why df does their ratelimit do it off per session
and not per Ip
get ratelimit? Just restart the program. Oh look its not ratelimited anymore
-_- Php is trash af
Ah sorry
👏
hey how to make a command, where yout type vote and u vote then check and it checks if u voted and gives user prize
@limber flume #topgg-api
Callum, aren't custom emojis mapped by their id?
yes they are
If the emote has an id, your emoji variable becomes emojiName:emojiId
not just the emoji id
👍
if packet.d.emoji.id exists return the id, otherwise return the name (which would be the unicode character for the emoji)
https://i.callumdev.pw/fgwk6.png just done this to fix it
uh that's quite unnecessary
literally you can do packet.d.emoji.id:packet.d.emoji.name but O.K
hey. On quick.db, I used to do this : js guilds.set(guild.id, {gName: guild.name, other: values})
But since I'm trying to switch to mongoDB, I can't find how to do that.
More concretely, I'm trying to name a value in function of a variable. Is that possible?
are you using mongoose?
No. Actually, I tried, but a lot of things went wrong.
Why? Does mongoose support this?
Mongoose just connects to mongodb and I believe they also allow you to make schemas
If you're inserting, you should use insertOne (or replaceOne with the upsert option if the data may already exist)
hi, me again js const discordStrategy = require('./strategies/discordstrategy') why am i getting an error? TypeError: OAuth2Strategy requires a verify callback ? the error is coming from ^
That isn't what i meant. Let me explain: I can use this to set the value "1" to 123 : js col.updateOne({id: "456"}, { $set: {123: "1"} }, {upsert: true}); But what I want is to assign the value 1 to the content of a variable. By exemple, if var1 = 123, I want to do smth like js col.updateOne({id: "456"}, { $set: {"${var1}": "1"} }, {upsert: true}); note: of course "${var1}" wont work since we need this: ``, but it would break the code block
then, to get 1, would use col.findOne({123: "1"})
from string to number?
parseInt() ?
@digital ibex it literally says, you're missing a callback
in the documentation, it doesn't say anything about a 3rd callback
passport.use(new DiscordStrategy({
clientID: process.env.CLIENT_ID,
clientSecret: process.env.CLIENT_SECRET,
callbackURL: process.env.CLIENT_REDIRECT,
scopes: ['identify', 'guilds']
}, (accessToken, refrshToken, profile, done) => {
console.log('e');
}));```
well that's kinda weird
add an extra one and see
it's a verify callback
so maybe you do some verification or something
Idk I've never used that
so I made a bot with kurasuta sharding manager but suddenly the bot failed to start with this being the only error i can found in the logs https://cdn.lumap.me/3ahb7bwl.png
oh wait i guess i know why it dont work
maybe that running two bots with this sharding manager at the same time results in one of them failing to start
hmm
yea
msg.author.bot would probably still work in py
yep
my brain is too smol to make an algorythm like that so im asking you guys. With js, I have an object like {dotpost: "plz dont dotpost"} and I need to do a list of everything in the object (example: here it will return "dotpost"). how cna i make that
how to react to an embed with custom emojis? i tried ```js
message.channel.send(p).then(embedMessage => {
embedMessage.react(bot.emojis.get("717372158329880650"))
but this doesn't work :/
use Object.keys(object) @tight plinth
oh
cheers @earnest phoenix
thx
for help
np
It's just a variable
it doesn't matter
doesnt matter what it's called
const discordStrategy = require('./strategies/discordstrategy')
``` why am i getting an error? `TypeError: OAuth2Strategy requires a verify callback` ? the error is coming from ^
the file discordstrategy is:
show the error stack
const DiscordStrategy = require('passport-discord').Strategy();
const passport = require('passport');
console.log('test1')
passport.use(new DiscordStrategy({
clientID: process.env.CLIENT_ID,
clientSecret: process.env.CLIENT_SECRET,
callbackURL: process.env.CLIENT_REDIRECT,
scopes: ['identify', 'guilds']
}, (accessToken, refrshToken, profile, done) => {
console.log('e');
}));
module.exports = passport``` nothing logs btw
kk
did you try done(null, profile) like the docs said?
then why did you remove it
did you save your code?
yeah
when u save it automatically restarts
(accessToken, refrshToken, profile, done) => {
done(null, profile)
}``` this is the different thing i done
@earnest phoenix ( sorry ping )
I got (node:22293) UnhandledPromiseRejectionWarning: DiscordAPIError: Unknown Emoji
even if my bot is in the server from where i got the emoji
How do you get the emoji ID
right click an then copy id on emoji
how did*
i don't have nitro so i couldn't \:emoji:
Invalid Form Body :/
@nova basin delete messages requires permission grant
it'll obviously not work without that
Okay so in order to add my bot its needs to work with a 0 perms link and "Delete Messages" is in that, right?
no
it must say "I don't have enough permission for that (requires Delete Messages perm)" whenever it tries to use a command that requires it
n
you gotta give the user a reason why the command isn't working
uuh so a /help command would say, In order to use me grant me {perms}
ah okay makes sense
why does a help command require delete messages perm?
that's....quite unnecessary
and might refrain people from inviting your bot
because delete messages is a powerful permission
make it optional if you must
User: -prune
Bot: I DON'T HAVE DELETE_MESSAGES PERMISSION PLEASE GIVE ME PERMISSION DELETE_MESSAGES
he already understood that shiv lol
you're welcome
Cool I just wasn't following the conversation at all
Cool I just wasn't following the conversation at all
statikk shiv
yes, but remember that it's not good to require such perm unless it's strictly required for a certain command
the code
.setDescription(
["Invite SpiderBot"](
"https://discordapp.com/oauth2/authorize?client_id=703704761114951710&scope=bot&permissions=11278"
)
)
comes out with a error
C:\Users\Jon\Desktop\SpiderBot Project\index.js:417
["Invite SpiderBot"](
^
TypeError: ["Invite SpiderBot"] is not a function
at Client.<anonymous> (C:\Users\Jon\Desktop\SpiderBot Project\index.js:417:31)
at Client.emit (events.js:224:7)
add quotes
but Im not trying to use a function i just want text
just wrap ` around the content
what did you do
.setDescription('[Invite SpiderBot](https://discordapp.com/oauth2/authorize?client_id=703704761114951710&scope=bot&permissions=11278)')
does it all need to be on the same line because whenever I save it it goes into 4 lines
with what
be patient
message.guild.owner.id returns typerror "Cannot read property 'id' of null"
not cached
you have to fetch the owner first by using guild.members.fetch()
that fetches all members
Bruj it works in other servers
here, the owner isn't cached
as you can see there are over 100k members in this server and the owner never goes online
you can separate code on new lines. but you need to escape the newline with a \
So like
guild.owner ? guild.owner : await guild.members.fetch(guild.ownerID)
A h
aa!stats
Fuc
Wait
I hate code formatting :Dd
aa!stats
Missing permi-
HHHHHHHHHHHH
in my help command i get 2 lines of undefined,
the code is
.addField("<8ball `YOURQUESTION`", "*Answers questions..*")
.addField("<roll", "*Rolls a dice for a random number*")
.addField(
"<avatar",
"*the bot will tag you with a link to your avatar*"
)
.addField("<joke", "*Sends a random joke*")
.addField("<prefix", "*tells you what the server prefix is*")
.addField("<help", "*Display's this message*")
.addField("<dare", "*get a dare in truth or dare*")
.addField("<truth", "*get a truth in truth or dare*")
.addField("<ping", "*Pong!*")
.addField("<servername", "*displays the current server's name*")
.addField("<serverinfo", "*get the current servers information*")
.addField("<uptime", "*dislays the bots uptime*")
.addField("<mctip", "*get a minecraft tip!*")
.addField("<setNSFW", "*sets the current channel to NSFW*")
.addField("<botinfo", "get SpiderBots information")
.addField("<remNSFW", "*remove's NSFW from the current channel*")
.addField("<hphouse", "*What's your Hogwarts house?? find out..*")
.addField("<slap `@USER`", "Slaps the mentioned user!")
.addFields("<rps", "play rps with SpiderBot")
.addField("<invite", "*invite link for the bot*")
.addField("<support", "*support server URL*");
message.react("🙋♂️");
ohh thanks heh-
Help how i can stop this problem, cuz it make my bot stop. And i have to turn it on manualy
you were rate limited
are you making manual requests to discord?
it's the api
wut
yes
the corona.js file
but the problem is the Bot stop, when i hit rate limit
then check the status, if its 429, you got ratelimited
check the status code
you are trying to parse that which fails...
you or the library you are using is trying to parse the message saying that you have been ratelimited
try/catch the parse
ok . . .
or check the status code
hi guys
i need a bot for DiscordSRV
(minecraft)
but im not good with java soo if someone can make me one/help me with making one pm me pls
thats a hard request, go to fiverr or freelancer OR learn it and make your own
Im looking for a dev to code a bot for me 100 $ spending limit please dm I was not born yesterday so dont mess with me !
my price is $102 sorry
suck but h o l e
that's a skill i do not know yet
I can teach you
File "C:\Users\І г о р\AppData\Local\Programs\Python\Python38-32\lib\site-packages\aiohttp\connector.py", line 936, in _wrap_create_connection
return await self._loop.create_connection(*args, **kwargs) # type: ignore # noqa
File "C:\Users\І г о р\AppData\Local\Programs\Python\Python38-32\lib\asyncio\base_events.py", line 1050, in create_connection
transport, protocol = await self._create_connection_transport(
File "C:\Users\І г о р\AppData\Local\Programs\Python\Python38-32\lib\asyncio\base_events.py", line 1080, in _create_connection_transport
await waiter
File "C:\Users\І г о р\AppData\Local\Programs\Python\Python38-32\lib\asyncio\sslproto.py", line 529, in data_received
ssldata, appdata = self._sslpipe.feed_ssldata(data)
File "C:\Users\І г о р\AppData\Local\Programs\Python\Python38-32\lib\asyncio\sslproto.py", line 189, in feed_ssldata
self._sslobj.do_handshake()
File "C:\Users\І г о р\AppData\Local\Programs\Python\Python38-32\lib\ssl.py", line 944, in do_handshake
self._sslobj.do_handshake()
ssl.SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: certificate has expired (_ssl.c:1108)
```W.T.F ?!
Help pls
i cant get youtube-search package to work :<<<<<<
because less than 1.5% of the world can code
:0
Does someone now how to create a var with how many servers has your bot
.help
Twix what library.
On the client instance, get the size of the .guilds collection. If you're sharding you'll need to get each shard's total guild count and add them all up
it's >0.5%
if those coders who ask 24/7 help like how to print output (aka basic things) for example are counted, i think then its somewhat 1,0-1,5% of world can code.
tbh it's less than 0.1%
hi js const discordStrategy = require('./strategies/discordstrategy') why am i getting an error? TypeError: OAuth2Strategy requires a verify callback ?
discordstrategy.js is```js
const DiscordStrategy = require('passport-discord').Strategy();
const passport = require('passport');
passport.use(new DiscordStrategy({
clientID: process.env.CLIENT_ID,
clientSecret: process.env.CLIENT_SECRET,
callbackURL: process.env.CLIENT_REDIRECT,
scopes: ['identify', 'guilds']
}, (accessToken, refrshToken, profile, done) => {
console.log('e');
}));
module.exports = passport;
@digital ibex are you supposed to be calling .Strategy()? According to the GitHub repository, it isn't called in the example (https://github.com/nicholastay/passport-discord#configure-strategy)
also, that package hasnt been updated in 3 years, its possible that it doesnt work on newer passport versions
Try removing the parentheses
https://hastebin.com/izujujohox.js @lyric mountain
The vote track isnt working i did everything correctly.
from what I've understood, you're using both client and bot for event handling
which is booting-up your bot twice
const client partials is for reacrion roles and const bot is for command handler, just to make it easy
@lyric mountain
yeah, but still
And what do you mean where is the token
there's absolutely no reason to start two clients
that doesnt make it easier, that makes you run your bot twice at the same time, which means twice the cpu, ram and bandwidth usage
where can i find token
in your bot's edit page
go all the way to the bottom of the page
next to the widgets
@loud nebula please delete the token from the file
I'd refresh the token if I were u
you can't share the token publicly
what's your dj.s version?
I've got an issue with my bot : I use Lavalink to play music, but I recently got 429'd by Youtube. I asked in the library's support server, they told me that it's because Youtube doesn't like people downloading it's songs. They told me to setup an ipv6 rotation to bypass the limitation. I tried setting up an ipv6 tunnel, but for that my router needs to be pingable.
I know the issue isn't really related to the bot, so can you tell me where I can get help about not being able to ping my router ?
12.2.0
3?
both in client and bot
it doesnt matter
ah
if you defined it in lowercase, then use it in lowercase
what is the error again?
client.shards.id doesnt exist in discord.js v12
anyway you dont need to use postStats at all
dblapi.js does it automatically for you
Still says the same
why am i getting this? i have scope: ['identify']
using passport and passport-discord
yeah. i got it to work, but it takes quite a while to load, do u know what could be causing that?
did you remove the setInterval and postStats?
he meant this
but you never do client.login
you do bot.login
you should remove client and use only bot for everything
but i need to have things right under const client = new and i cant have 2 right under something
you should not have two
<discord.embeds.Embed object at 0x000001FC3276BA68>
[[...]] <------ This
you should use one for everything
But then, how can i put 2 things right under something
wdym 2 things right under
did you remove the setInterval?
show full error
Oops! Error: 429 Too Many Requests
its from this
dbl.on('error', e => {
console.log(Oops! ${e});
})
that error is caused by the setInterval that you had before
but i removed that
are you sure you removed it? did you save the file after removing it?
yes
show your current code
So uh my api ping isn't working someone help
api ping?
https://hastebin.com/duzoyoreri.js @quartz kindle
@lyric mountain yes
what api ping?
Free robux no way @loud nebula
Where do you see free robux (And yes i have a free robux server)
oh my
lol
this could get your bot banned yknow
huh
oh oops
Oh im sorry
Oh wait
It is my test bot
OHHHH WAIT
That is the error
any free thing is a scam
1 is it no scam 2 sorry 3. it is my test bot
it goes on
Lil
Dang I exposed srry @loud nebula
scam
but sorry
so its working now?
idk im going to check it now
make a request via curl/postman and check the headers
client.on('message', (msg)=>{msg.content}); will msg.content include the Commands Prefix?
i did magic
ok
everything in the message is the message content
its ur job to see if a prefix is there
i can't test until i have an approved bot
u can?
how can i setup a command prefix for testing?
dude you can add the bot before its approved
i have my bot in my discord channel
lmao
you can dev test the bot before it's approved
i'm talking about https://top.gg/bot
adding a prefix to a bot on the site doesnt automatically give it a working prefix
^
gotcha
@proven lantern are you making a bot and, if so, what library?
yep, discord.js
i just made this change
can't the prefix be overridden though? how does that work?
Yes, you would set it per guild if you needed that, store it in a seperate map or object for just prefixes for the guild
bot.on("channelCreate", async(channel) => {
if(channel.guild.id !== `611881570202025986`) return
``` - Is this wrong in v12 of discord.js
You can do that
do !if
hmm?
That won't work in JS
!if
@heavy marsh What is the issue?
^
[03/06/20 18:27:57.855] [ERROR] (node:13) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'id' of undefined
at Client.<anonymous> (/home/container/bot.js:211:18)
if(channel.guild.id !== `611881570202025986`) return
``` = Line 211
Director, you're checking an ID that is generated at the time of the event, you can't check it. Try
console.log(channel)```
and see what it returns
The event emits this to your channel https://discord.js.org/#/docs/main/stable/class/GuildChannel
looks like either DMChannel or GuildChannel can be passed into the listener's function. GuildChannel is the only one with the guild property
There you go
[03/06/20 18:36:32.733] [LOG] DMChannel {
type: 'dm',
deleted: false,
nice there you go
then add if(channel.type === 'dm') return //or handle here
if(channel.guild && channel.guild.id !== `611881570202025986`) return
I need HTML knowledge
i cant html good
I code botlist but when I say send the application does not come to the authorized panel
you made... a bot list?
no
idk, what is the issue?
if you're trying to make your own bot list
you have a huge way to go
that requires full stack knowledge
woW ok thanks
where ? @wide ruin
loop through the list, GET request to the url, read the body and save the read data into a file
ok thanks
by which bot we run our codes on discord only

like some guys do
if (msg.content === "botinfo")
if (command === "botinfo") {
let embed = new discord.RichEmbed()
.setitle("BOT INFOMATION")//set title of embed
.setColor("#ff2052")//color of embed
.setDescription("Hello friends this Bot is Made By Priz Made for Multi Purposes For Helping Gamers")//Description of embed
.addField("test","java")
.setThumbnail(${msg.author.avatarURL})
.setFooter(${msg.author.username},${msg.author.avatarURL})
msg.channel.send(embed)
}```
thats just an eval command
@mossy vine what is eval?
evaluate
How to do that
what library
Someone help me, my bot doesn't detect that I'm on a voice channel
discord.js
my code was v11, I'm not able to update to v12
@honest perch
my code was v11, I'm not able to update to v12
@cerulean hornet why not?
@surreal notch google it
i cant update to v12 because my environment is limited to node version 10
you wont be able to use v11 at some point
hopefully google supports node version 12 soon. they only have beta support for version 10 now
lol wut
cant you install node manually
idk apt install nodejs
curl -sL https://deb.nodesource.com/setup_13.x | sudo -E bash
i think that **should **work
@cerulean hornet why not?
@lyric mountain I don't understand much about v12
Put that aside, how do I do a setlanguage command? to change bot languages?
know any channel that has a tutorial video?
like, locale_en-US.properties would contain all the text in english, while locale_fr-FR.properties would contain all the text in french
and you'd need a database to store language preferences of each server
just search node.js localization on google
google translate has an api too https://cloud.google.com/translate/docs
google translate would do a very shitty and lazy work
lol
but yeah, you could use it
Using the database until easy just do not know how to do the command: c
The translate API is also heavily ratelimited
I already use v12
< 2 million characters per day
if going for a translating api, I'd recommend yandex
Google is deprecating nodejs 8 support in 2 days. i guess that means version 10 will be stable and version 12 will be beta soon
we meant d.js version, not node
but is there any npm that facilitates the setlanguage commands?
no
d.js12 requires version 12 and soon d.js11 will require version 12
not everything can be spoonfed to you
localization is a hard work, even harder if you leave it for later
d.js12 requires version 12 and soon d.js11 will require version 12
@proven lantern soon there will be no d.js 11 to require anything
it'll not be updated
4 months is the maximum deadline to update to d.js v12
hopefully google supports 12 before d.js 11 stops
read above
google doesn't need to support v12, you're confusing node.js 12 with d.js 12
d.js 12 doesn't work with node 10
so if google doesn't support node version 12 and discord only supports version 12 then it wont work with google
it will
@lyric mountain , do you know any place I can look for more about the language command?
as I said, just google https://phrase.com/blog/posts/node-js-i18n-guide/
➽ In this tutorial, we will show you how to setup your Node.js i18n project and how to organise your translations, so as to make your application reachable to a much wider audience ✅ We will highlight ways you can integrate I18n and adapt your Node.js app to different cultural...
google only supports node 10 at this time. but in 2 days they are going from beta support of node 10 to it being the stable version
it'll not tell you how to make the command itself, it will tell you how to make multi-lang support for your code
google only supports node 10 at this time. but in 2 days they are going from beta support of node 10 to it being the stable version
@proven lantern dude, node is v11 currently
v10 is already obsolete
odd numbers are not lts releases
actually, it's version 12 already
with 14 being beta
odd numbers are not lts releases
@proven lantern proof?
i'm talking about google's hosting
...
The Node.js 6 runtime has been deprecated. The Node.js 8 runtime will be deprecated on 2020-06-05. To ensure that your functions are on a supported version of Node.js, migrate them to Node.js 10. After 2020-08-05, function deployments that use Node.js 6 will be blocked. Cloud Functions that continue to use Node.js 6 after this time may be disabled.
they should have beta support for version 12 soon
why do you even bother with google hosting?
it's expensive, and free plan is very limited
i have never paid anything for their hosting
two processes share the same cpu time
yo thats crazy
it's like heroku dynos
it can scale out
but still, free plan is so limited that it'd be a miracle to have more than 30 servers without the bot becoming extremely slow
Every time my bot needs to send a message this error appears, even after a restart or after regen the token. How can I solve it
Every time my bot needs to send a message this error appears, even after a restart or after regen the token. How can I solve it
@tight plinth the body is too long
"".substring(0,2000)
slice
Anyone made dashboard + bot with Python? What did you use?
I'm thinking the cleanest way is to make 3 separate things: dpy bot, django website and API (flask/maybe django becaues great ORM) that previous 2 can connect that will just be dealing with database.
That seems like a bit overkill tho.
the word flask gives me shivers
I've made a dashboard in react native and the bot in java
I don't think with python would be too overkill
@cobalt umbra What ive done is Bot as one system
what i used to have was the api and site with django
because its very easy just to have another app for the API side of stuff with django using the rest_framework
it works pretty well
tho personally i've switched to Flask and Quart because i prefer building my own stuff for what i need todo

const str = 'BlaBla https://discord.gg/xxxxx blabla';
if(str.includes("https://discord.gg/")){
console.log(str.slice(19));
};
console.log(str);```
I am currently testing to be able to retrieve information from a possible link from another server to post on the server with: https://discord.com/api/v6/invites/
Problem I can't find a way to recover a specific part of a message with slice
use regex
I think I'll go with it then. Oof I got lot to code 
It's less than u think tbh
Crunchy's old system was like 500 lines with django
Spotify's system is like 200 lol
str.split("/").includes("discord.gg")
@lyric mountain my bot was on their free plan until 500+ servers lol
lol how
google's free instance of compute engine
which are all the functions a bot have (like ready/message/messageUpdate/ etc ) ?
its not bad at all, its better than glitch and heroku
the only issue is very limited bandwidth, which is the reason i moved out
What are you talking about here?
free hosting
Does he mean Google cloud?
yep
Oh nice
f1-micro instance has 0.2 cpus (1 cpu at 20% capacity lol) and 600mb ram
still better than glitch heroku
hello
hello
hi, why is req.user undefined with expressjs?
how to detect that a message .includes () a space
i have js app.get('/', (req, res) => { req.user; });
@wicked pivot if(String.includes(' '))
https://canary.discordapp.com/channels/264445053596991498/272764566411149314/717827846881673226 @cobalt umbra i know im like 5 years late but im making one with tornado
I'm actually still busting my head, it's open source and I want it to be perfect 
i don't think theres a way to make a dashboard in python, i don;t think so cuz my friend who only knows python is learning js to make one
i just do this then have endpoints which serve html templates
ofc there is a way to make dashboards
welcomer has a dashboard and thats made in python
no i mean, a web dashboard
yeh...
but idk py lol
of course you can make one with python, why wouldnt you
python supports web servers
UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'includes' of undefined
oh
That's a good idea, I have tons of ideas I'll have to review them tommorrow
ah it's a great idea
just make sure that u dont make it blocking
ye dw
It's probably not gonna be similar I'll just take the idea and make it from scratch
oh god what is th at
it's not very clean I admit it but I didn't find any other way
then it doesn't work anymore 
are you trying to get the invite code from a string that contains a link?
const indexOfHostname = pieces.indexOf("discord.gg")
console.log(pieces[indexOfHostname+1]);```
replace the empty string with your blalala string
or some regex
i feel very stupid but thanks
https://discord.com/api/v6/invites/dbl
what should you use to recover it is info? (node-fetch does not work)
Should I even bother with async Python ORM, literally all packages I found were in very early development/alpha.
I answered my question nvm
(node:17498) UnhandledPromiseRejectionWarning: Error: 404 Not Found
at /rbd/pnpm-volume/ee988e40-a781-4cf0-9372-ec9a7a538c68/node_modules/.registry.npmjs.org/snekfetch/4.0.4/node_modules/snekfetch/src/index.js:193:21
at processTicksAndRejections (internal/process/task_queues.js:88:5)
(node:17498) 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: 3)
(node:17498) [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.```
google translation I would like this message not to be displayed how to do?
code :
```js
const LinkDiscordP = ["discord.gg/", "https://discord.gg/"];
if(LinkDiscordP.some(link => message.content.toLowerCase().includes(link))){
const GetMessage = message.content.split("/")
const indexOfHostname = GetMessage.indexOf("discord.gg")
snekfetch.get("https://discord.com/api/v6/invites/" + GetMessage[indexOfHostname+1]).then(async(get) => {
get = get.body
if(!get){
return
}
console.log(get)
})
}```
yes I know but precisely that is the goal x), I purposely do this so as not to have a "stupid" error
if(!get){
return
}```must replace its with what so that when there is an error it executes the code in {}
snekfetch.get("https://discord.com/api/v6/invites/" + GetMessage[indexOfHostname+1]).then(async(get) => {
if(!get.ok)return console.log("Not Okay")
get = get.body
console.log(get)
})```still not :/
maybe it throws an error that needs to be caught in .catch()
its funny that library has an ok property when it throws an error when it's not ok
so it's always ok === true
snekfetch.get("https://discord.com/api/v6/invites/" + GetMessage[indexOfHostname+1]).then(async(get) => {
get = get.body
}).catch(err => console.log("Not Okay"))```hm
isnt that library deprecated
hey
@earnest phoenix discord.js v11 or v12
I highly recommend updating to v12 but
Im pretty sure it is
client.guilds.size
Change client to your client variable
Unless it is already client
and it will show how many servers its in??
Yes
okay let me try
But
U need to put it in something
Like console.log()
Or an embed
Message whatever
yes
ok ill try
do we need to get permission to be able to invite our bot into the testing channels here?
i dont see this guild in the list of options when i try to give oauth permissions
https://discord.com/api/oauth2/authorize?client_id=
@astral yoke i learned js well within 3 years by learning discord.js first
im talking to shadow
Should I even bother with async Python ORM, literally all packages I found were in very early development/alpha.
You could look at the databases Module which is a async implementation of sqlalchemy core
but most of the time no
its easy enough todo querys
ye
ye believe me I looked at all of them, and all of them are very risky imo (breaking changes/missing features/possible bugs etc)
i found the databases module worked really well tbh
i say even tho i only used it for the auto commit
lol
@honest perch thanks, i submitted it yesterday, but i'm guessing it'll take awhile to approve it with all the covid-19 stuff going on
I'll just use glorious asyncpg 
@honest perch you're talking about submitting to https://top.gg/ right? not some other process to get approved for testing in this guild?
I'll actually take asyncPg over psycopg2 most of the time and go async just cuz psycopg2's implementation is weird and janky
@proven lantern thats what im talking about, yes
Like execte_many being slower than doing multiple executes or the fact it uses standard string formatting just to replace it with $1
qq of 11pm
how do i make bot run code when kicekd from guild
that event only fires when you leave leave the guild, not disconnect
i mean thats literally what he asked for lol
hes asking when its kicked
that event fires on but not exlusivley: banned, leaving normally, kicked
oh coool
but leaving normally means right click guild and click leave server and not disconnecting. that tricked me before
Hes not asking for disconnecting tho lmao
hes asking for if its Kicked or banned or leaves lol
im just complaining
i want to make a bot that says hello every time i connect to the lobby so i feel good
Can bots get rate limited for reactions?
i think
Oof
Because my bot sort of depends on multiple reactions every 5 seconds or so
more like 30 seconds
Dayum
Is there a number like the 5 msgs every 5 seconds
because i dont want this thing getting sacked
I get ratelimited after adding a single reaction
pog
Is there a way to convert a Date value to time remaining?
I already have it in ms I have it as a Date object
time remaining to what
(millseconds in the future) - (milliseconds since 1 January 1970 UTC / Date.now())
then would there be a way to convert the milliseconds easily to a format like: 5 Days 1 Hour
or would I have to divide for each value
hold on let me see if ms can do that
hey so I have a thing to log deleted messages
and if i say a message before the bot turns on
then when the bot turns on and i delete the message, it wont work
only the messages after the bot is on
anyone know a solution
client.on("messageDelete", async(message) => {
let delEmbed = new Discord.MessageEmbed()
.setTitle("Message Deleted")
.setColor("RANDOM")
.addField("Message", message.content)
.addField("User", message.author.tag)
.setTimestamp();
let loggingChannel = message.guild.channels.cache.find(ch => ch.name === "general")
if(!loggingChannel) return;
loggingChannel.send(delEmbed)
});
The message just isn
t in cache
I dont know if you can do anything about that with the messageDelete event
v12 only
i am in v12
partials wont fix it
the message delete event from the discord api doesnt provide anything other than the message id, channel id and guild id if applicable
if the content of the message isnt cached beforehand, there is no way you can obtain it anymore
best bet is to keep the bot up
so is there nothing i can do about it?
the most you could do is try to fetch it, but i highly doubt that will work
i guess i'll just have to keep the bot up
bots dont cache messages indefinitely anyway
by default discord.js caches a maximum of 200 messages per channel
so even if it it keeps running, it wont be able to get a deleted message thats older than that
unless you change the option to cache more
ram destruction
you could also fetch a certain number of messages at login, so you dont start from 0
and yes, all of that will eat your ram
if you want to make a bot specialized in monitoring message deletions, you'd need to provide a custom storage system
Hey I need some real simple help with reactions in discord.js, can someone help?
yeah
for example save the message content in a database
but that could have privacy implications
@rotund yarrow
^
TypeError: Cannot read property 'channel' of undefined```
what is message
i have the superagent package which is the only package i need for it to pull from the API
and its not working
i can help u electro
i know about reactions
whatsup
@rotund yarrow dont ask if someone can help, just ask the question and wait for someone to help
oh
that makes sense but ill help ya if u want
yo Tim
could u help me figure out why its not pulling from the API for live advice lol
i posted the error up there
that error means message is undefined
no
no
a Message object is a complex discord.js structure
you receive one when you receive a message
you dont create one nor define it yourself
then how is it supposed to work
and how am i supposed to fix it
i dont really understand that
:/
is that a command?
if its a command it should have a message coming from somewhere
module.exports = {
name: 'advice',
description: 'gives a random life advice',
category: 'none',
run: async (client, kayn, REGIONS, config, message, args, con, guilds) => {
request
.get('http://api.adviceslip.com/advice')
.end((err, res) => {
if (!err && res.status === 200) {
try {
JSON.parse(res.text)
} catch (e) {
return message.reply('An API Error Occurred :(');
}
const advice = JSON.parse(res.text)
message.channel.send(advice.slip.advice)
} else {
console.error(`REST call failed: ${err}, status code: ${res.status}`)
}
});
},
};```
advice.js
am i dumb?
i feel like i messed up on something so obvious and i just dont understand it
maybe that export should be in a function
is it not in a function?

