#development
1 messages · Page 543 of 1
no idea
And its supposed to send messages to a specific channel?
yes
what's the return value
doesnt return anything
...?
i mean
Maybe try console.log(client.channels.get(CHAN).name) to see if it's really the channel you meant
doesnt throw up any errors or anything
.send.catch(console.error)```
yes @red spade, it is the correct chanenl
console.log(client.guilds.get(client.channels.get(CHAN).guild.id).channels.get(CHAN).send(ans.message))
maybe check if .then event launches or not
client.guilds.get(client.channels.get(CHAN).guild.id).channels.get(CHAN).send(ans.message)
why?
Fishy, that will return a pending promise
if you have the channel id
why do you get the guild
to get the channel by id again
Promise { <pending> }```
@keen drift
yes indeed @inner jewel you could even directly get the channel with client.channels.get()
Thats what we needed.
try client.channels.get(ID).send(MESSAGE).then(console.log, console.error)
Its still pending when it tries to send.
WAIT WHAT THE FUCK
yeah you can do that
i tried what @gilded blaze said, it logs the error, AND ALSO SENDS THE FUCKING MESSAGE
Whats the error
it's possible to send an http error
(node:17084) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'then' of undefined
and still send the message
...
oh
Lol
you copy pasted wrong code
it should be send().then()
👏
try what i sent
client.channels.get(ID).send(MESSAGE).then(console.log, console.error)
.send.then() will never work
send is a function
it doesn't have .then()
yes
yes send isn't a property
natan high iq
okay so what i did is console.log(my_bullshit).then(console.log) and it sent the message FOR THE FIRST TIME and also threw the typeError
what
console.log(my_bullshit).then(console.log)
doesn't work either
console.log doesn't return a promise
log() doesn't have then
uhm what?
okay i reverted to the previous working code and now it doesnt work again 
any output
none
code
output
doesnt send
when it threw a typeError it did send
i am facking confused
oh.
client.channels.get(ID).send(MESSAGE).then(console.log, console.error)
do exactly that, just replace ID and MESSAGE
and do not console log the whole thing
nothing
screenshot of what you have now 
i know what node module is that
for the question think
you should use terminal-kit
but enquirer is nice
its inquirer
interesting
who cares about spelling
yes fishy, its interesting and annoying

What is it supposed to send tho?
very confusing indeed, no resolve return nor error return
Like what is ans.message
i take console input and send it to a channel, yes
I helped someone with this on stack overflow lol
well then help me on discord lol
They used readline
im not using readline
im using inquirer
and thats not the point
the point is that .send() doesnt work
so is there anyone that knows what the fuck is happening 
any error?
as i said above, i got an error once and it worked that one time
since its an eval, i dont think you can
how do u react with an ID
message.react('401376452441931778') doesnt seem to work
What do you want? You are getting the object you need
JS is simply using the toString method to display it as a string
i dont need it to do that
I got it to work for me @mossy vine
@empty owl try message.react('aaa:401376452441931778')
@amber fractal holy shit what did you do?
custom emoji reactions have the form name:id
thanls
lool
Replace bot with client and the id and message obviously
I just use bot over client
i know
I figured
@inner jewel Unknown Emoji
when I do message.react('a
401376452441931778')
message.react('a:nam:401376452441931778')```
Yea that
thats not how you react to a message with custom emotes
.then(message => {message.react('a:nam:401376452441931778')})```
@amber fractal lmao its still not working
also
is animated
yes, it logs the channel perfectly but doesnt send
O
oH WAIT
wait
CAN YOU NOT SEND MESSAGES IN ready EVENT?
why tho
I dont see why you couldnt...
try running it in the ready event @amber fractal
Anyone know if it's possible to update the frequency of a preexisting interval created using setInterval in JS. Would it be better to just destroy the interval and create a new one with the new frequency? And if it is possible, could I do it from within the interval (Ping me)
trigger
You can't.
now this is weird as fuck
When do you take ans.message?
have you just tried ans
it wont work as message is a property of ans
okay so im doing channel.send('hi') and doesnt work
so it cant be a problem with the inquirer
Put this in your event after the send if(!ans.message){ console.log("test") } i want to see if it exists after trying to send
If it sends test then it doesnt exist... Obviously
Alright so it does exist then
Idk what the problem would be
even if i tell it to say 'hi' it still wont send
and it atleasts is similar to this?
instead of CHAN try instead just the id, it shouldnt make a difference, but you never know
What version are you running?
?
It is... I think
wew fun code
regardless if aninated or not
and
message content:
<a:name:id> animated
<:name:id> regular
reactions:
name:id
Oooh
if i send a message and i want to edit it whatever was in the message first time will be in the edited message + what i add
i dont want it to be this way
how do i do that
eris
only happens with embeds
send message -> edit it and add an embed -> both content and embed stay?
yes
try sending content: null
nope
Any1 know how to make something like quiz to be active while people are sending messages to channel
And when they stop it will wait like x questions and if no one sends message stop quiz
discord.js
Has anyone made a contest bot so you can host a contest on your server? @ me or message me.
Hey anyone who uses discordjs here
I'm trying to do an AJAX request in my reaction handler, then accordingly editing the message
But the scope is getting fucked up
Whereas my non-async reaction handling that edits the message is doing fine
With the async added in it's saying "edited" but the content of the message isn't changing
i dont thing the name "ajax" applies here lol, but show your code
sure
and yeah it's not ajax, mindslip
self.react.gif = function(reaction, user, config) {
var reactions = ["⏹","⬅","➡"]
var i = reactions.indexOf(reaction.emoji.name)
if (i == -1) return
var old = reaction.message.embeds[0]
var current = Number(old.footer.text)
var newEdit = new Discord.RichEmbed()
newEdit.setTitle(old.title)
var query = old.title.replace("GIF: ", "")
if (i == 0) {
newEdit.setTitle(query) //prevents further reacting
reaction.message.clearReactions()
reaction.message.edit({newEdit}).catch(console.error);
return
}
if (i == 1) {
current -= 1
}
else if (i == 2) {
current += 1
}
if (current <= 0) return
console.log(current)
request.get(
{
url: "https://api.tenor.com/v1/search?q="+query+"&key="+process.env.TENOR_KEY+"&pos="+(current-1)+"&limit=1"
},
function (err, res, body) {
if (err) {
console.error(err)
return
}
var content = JSON.parse(body)
var gifs = content.results
newEdit.setImage(gifs[0].media[0].gif.url)
newEdit.setFooter(current)
reaction.message.edit({newEdit}).catch(console.error);
})
}
sorry for the messy blob
i havent cleaned it up yet
I tried doing
reaction.message.channel.send({newEdit})
and it's throwing an empty message exception
So I want to give a rainbow role to donators in my guild, and I just have a question. How slow does rainbow role have to be to not violate the ToS? is one colour change per second good?
it can have a delay of infinite seconds
one color per second is horrible
to not break the tos

@high anchor you need to turn it into an async function and use await whenever you do an async call
you have several async calls in that function that are all being executed at once without waiting for any of them to complete
Ok i'll try that
I thought most of the embed setters were sync cause it worked fine with my other embed editors
make n large then
well many bots have 1 minute timers
@quartz kindle Turns out the issue isn't with async
If there is no description set, discordjs regards it as identical and doesn't go through with the edit
The reason my other embed editing worked was because they had descriptions
Whereas this one didn't
Maybe i should post this on the repo
question for eris people: do people generally use client or bot for the client
for the variable name
@obsidian ember it's a sensitive topic, but something like every 3 minutes would be safe
@bright spear ik your muted but client is widely used, eris examples use bot but really, who in their right mind doesn't use client
why does the variable name even matter lmao
https://anidiots.guide/first-bot/using-embeds-in-messages
This tutorial has the RichEmbed object bracketed
And it seemed to work, until now. So I would have never noticed
Thanks again
send({x}) is the same as send({x: x})
so if the variable was named embed
it would work
okay
but for embed builders you can drop the { }
gotcha
god im stupid
i coincidentally named it to embed in the same commit where i added the description
wait is there a way to log like any and all DiscordAPIError, like how client.on('error' works but it works with the things like "unkown message" and "missing permissions" etc. but i dont have to go through and add .catch(err=>console.log(err.message)) everywhere
how can i login as user, discordjs
client.login("email", "password") doesnt work
User accounts are against tos
i know
We still cant help you break tos
@earnest phoenix this might help
Search the world's information, including webpages, images, videos and more. Google has many special features to help you find exactly what you're looking for.
lol, reason i came here is cuz google isnt helping
i cant find user token nor login with email
You came to the wrong place then.
seems like
djs dropped that support in future versions
Finally did?
it was dropped months ago
just not on stable
also I doubt anyone here will help you with user bot
If they did theyd be going against the tos too just sayin
yeah idk about that part
i want my bot to send a message in new servers it joins, what’s the best way to choose which channel to send it to?
oops and i’m using discord.js
You could get all channels and loop through it until it gains access to send to one. Not to all though. Its hard to do that sense they removed defaultChannel
@velvet cove FYI people usually hate it when bots do that
@sick cloud i need help on the help menus
Like when I react the ➡ it doesnt change the embed
@visual zenith you require a collector if using discord.js and wait for the desired emoji
if any other language i have no idea
@visual zenith what error(s) are popping up?
mention me when you can then
.. 🤔
Anyone know free hosing services? .-.
Heroku/Glitch
free and good host does not go well together
@faint junco your pc?
its this mad technique called don't turn it off.
Although AWS and AZURE have 12 month trials
Didn’t AWS lower there trial to like 6 months?
Thanks
what ubuntu version?
16.04
sudo apt install curl
which version to you want
the latest or the stable?
10 or 8
Stable
hmm
ok
curl -sL https://deb.nodesource.com/setup_10.x | sudo bash -
node 10 should work
if it breaks then install nodejs v9
I'm using v10 rn
sudo apt install npm will install npm right?
npm is automatically installed
Oh
you can check the versions with node -v and npm -v
Just a new problem now
Yes?
It requires correctly
strange
Is there anything built into the API for checking the account ages of connections
like the user account age, or?
Yeah eg. the age of a connected twitter account
Ok thanks
np
./index.js should just go back to the same file right?
Because its going to root
This vps stuff is so confusing
I would put ur bots files in a folder
I think so
They are
./index.js goes back 2 files
wait it should go back one
What the
The require works goes to node_modules
no
it can require local files smh
It logged discord.js
require is usefull because it can load node_modules, and local files
what discord.js version do you have?
ew, use master
Why
hmm
Error: ENOENT: no such file or directory, stat '/root/index.js'
at Object.statSync (fs.js:851:3)
try ../
same thing
can you send the projects cwd?
?
o no heroku
Any way I can log ./index.js with console.log to see if maybe its a problem with something else?
This is what I have
This isthe error ;-;
idk why it's going to root
And when I add a /mobilefriendly it works, but loops everything while going through the files. And errors a bunch of times
how are you running the file?
yea
node mobilefriendly/index.js
thats why
I never use terminals
also
if you exit the terminal window your bot could go offline
depending on what terminal window you use
my recommendation is to use pm2
oof
Thanks tho, just got everything working
Someone can help me ?
@earnest phoenix never ask to ask, always just ask your question and wait
Okay, my bad sorry
Before:
-I use 'discord.js'
-I use file .JSON and read them
Here is my problem:
I want that my code verified if there is server's id in file witj:
if (message.content.startsWith(prefix_server[message.guild.id].prefix + ...)
before modified my code, all work perfectly but now, 2 problems are here:
API discord:
{ DiscordAPIError: Missing Permissions
at item.request.gen.end (C:\Users\pc\Desktop\Bot\node_modules\discord.js\src\client\rest\RequestHandlers\Sequential.js:79:15)
at then (C:\Users\pc\Desktop\Bot\node_modules\snekfetch\src\index.js:215:21)
at process._tickCallback (internal/process/next_tick.js:68:7)
name: 'DiscordAPIError',
message: 'Missing Permissions',
path:
'/api/v7/guilds/521362591969312768/members/503970145279016971/roles/526732974478327809',
code: 50013,
method: 'PUT' }
JS:
if (message.content.startsWith(prefix_server[message.guild.id].prefix + `infobot`))
^
TypeError: Cannot read property 'id' of null
at Timeout._onTimeout (C:\Users\pc\Desktop\Bot\index.js:175:64)
at ontimeout (timers.js:436:11)
at tryOnTimeout (timers.js:300:5)
at listOnTimeout (timers.js:263:5)
at Timer.processTimers (timers.js:223:10)
Someone know why i have they errors ?
don't use json
@earnest phoenix
- Says right there
Missing Permissions - Your guild object is null
My bot are all permissions :/
In .JSON file, the guild id are present
i can help you
@earnest phoenix
let prefix = prefix_server[message.guild.id].prefix
do that
Okay, i try this
if(message.content.startsWith(prefix + `infobot`))
don't work, same errors :/
what is the error?
Your json file is empty ?
No
let prefix = prefix_server[message.guild.id].prefix
^
TypeError: Cannot read property 'id' of null
at Client.bot.on.message (C:\Users\pc\Desktop\Bot\index.js:171:46)
at Client.emit (events.js:182:13)
at MessageCreateHandler.handle (C:\Users\pc\Desktop\Bot\node_modules\discord.js\src\client\websocket\packets\handlers\MessageCreate.js:9:34)
at WebSocketPacketManager.handle (C:\Users\pc\Desktop\Bot\node_modules\discord.js\src\client\websocket\packets\WebSocketPacketManager.js:103:65)
at WebSocketConnection.onPacket (C:\Users\pc\Desktop\Bot\node_modules\discord.js\src\client\websocket\WebSocketConnection.js:333:35)
at WebSocketConnection.onMessage (C:\Users\pc\Desktop\Bot\node_modules\discord.js\src\client\websocket\WebSocketConnection.js:296:17)
at WebSocket.onMessage (C:\Users\pc\Desktop\Bot\node_modules\ws\lib\event-target.js:120:16)
at WebSocket.emit (events.js:182:13)
at Receiver._receiver.onmessage (C:\Users\pc\Desktop\Bot\node_modules\ws\lib\websocket.js:137:47)
at Receiver.dataMessage (C:\Users\pc\Desktop\Bot\node_modules\ws\lib\receiver.js:409:14)
This error
{"527825294409859083":{"prefix":"t!"},"333949691962195969":{"prefix":"t!"},"264445053596991498":{"prefix":"t!"},"521362591969312768":{"prefix":"t!"}}
My json file
hmm
i do custom prefix on my bot and.. i dont have this error
This errors submited when new member joined server
you put your code in a event ?
the code is in:
bot.on('message', message =>
{
//code here
})
also.... don't use a json db. it is not good, it can get corrupted
So what can use for custom prefix ?
mysql
its hard for beginner
stay on json
@earnest phoenix i do that on my old bot and its working
wait
if(!prefixx[message.guild.id]){
prefixx[message.guild.id] = {
prefixes: "*"
};
}
fs.writeFile('./prefixes.json', JSON.stringify(prefixx), (err) => {
if (err) console.log(err)
})
let prefix = prefixx[message.guild.id].prefixes```
I try this
Errors:
if(!prefixx[message.guild.id]){
^
TypeError: Cannot read property 'id' of null
at Client.bot.on.message (C:\Users\pc\Desktop\Bot\index.js:173:31)
at Client.emit (events.js:182:13)
at MessageCreateHandler.handle (C:\Users\pc\Desktop\Bot\node_modules\discord.js\src\client\websocket\packets\handlers\MessageCreate.js:9:34)
at WebSocketPacketManager.handle (C:\Users\pc\Desktop\Bot\node_modules\discord.js\src\client\websocket\packets\WebSocketPacketManager.js:103:65)
at WebSocketConnection.onPacket (C:\Users\pc\Desktop\Bot\node_modules\discord.js\src\client\websocket\WebSocketConnection.js:333:35)
at WebSocketConnection.onMessage (C:\Users\pc\Desktop\Bot\node_modules\discord.js\src\client\websocket\WebSocketConnection.js:296:17)
at WebSocket.onMessage (C:\Users\pc\Desktop\Bot\node_modules\ws\lib\event-target.js:120:16)
at WebSocket.emit (events.js:182:13)
at Receiver._receiver.onmessage (C:\Users\pc\Desktop\Bot\node_modules\ws\lib\websocket.js:137:47)
at Receiver.dataMessage (C:\Users\pc\Desktop\Bot\node_modules\ws\lib\receiver.js:409:14)
Wtf
Owh
Its normal
You make that
Client.bot.on.message
Line 173
@earnest phoenix

The error is Client.bot.on
No xd
Yes
So I guess the first line of the error is just there for your entertainment
at Client.bot.on.message (C:\Users\pc\Desktop\Bot\index.js:173:31)
the error is that
That's where the error is situated
But okay
It's means the error is inside his
client.bot.on("message" => {
blablabla
It's what his error says
So it's probably there
@earnest phoenix Do you have edited ?
i have :
const Discord = require('discord.js')
const bot = new Discord.Client()
bot.on('message', message =>
{
//code here
})
On line 173 ?
if (message.content.startsWith(prefix_server[message.guild.id].prefix + 'infobot'))
But i try to delete bot.on('guildMemberAdd', member => and without that, it work
Wow what a suprise
You probably shouldn't use guild ID's to index your array
And you also probably shouldn't make your prefixes array an array of objects with just 1 property
Doesn't make much sense
If you actually want your bot to be good and working properly
Don't even try this writefile stuff
Go do some research on databases
Oh okay, thanks
@earnest phoenix why you add guildMemberAdd?
I want that my bot add role when a member join if the config autorole is enabled ans do nothing is it is disabled but that make errors so i delete it
Oh okay
Thanks for help c:
No problem
UnhandledPromiseRejectionWarning: Error: 404 Not Found
console.log(user.username);
});```
I get error when I use .getUser
Well the error is clear as day: the user was not found.
Likely the user hasn't signed into https://discordbots.org/
When users votes are reset
🤔
I want to add Rewards on vote for that I need Vote Reset time so bot will clean database
every month on the first day
im not sure
🤔
Means I vote now
So my vote will delete after 12 Hour
Then only I am able to vote
not delete, just reset so you can vote again. and i dont remember but i think it was changed to 12 hours from 24
maybe using EST time tbh
idk
@bitter sundial how does the votes work? i think you should add that to the documentation
?
It will help us to improve vote rewards
I want to know when daily user vote get reset
Like which time
how does the daily votes work
12 hours from when you vote
12 hours after every user vote ?
yea
yes

well that is new info for me
Can anyone help me for discord oauth
tbh the 12 hour ms thing would eat a lot of mem
what language thou?
i never coded a dbot in py but i know py. on the other hand i know how to make auth with js
I want to make oAuth in php
sorry im not so good at php
In node can you ?
Can you say process of oAuth working
So I can make in php
@lament meteor
oauth is just a sequence of http requests, any language with internet access can do them
you just need a server thats listening to discord's redirect
yeah
So if I get any issue can you help me
i havent done oauth (because i dont need it), but i can try
what is ms ?
Milliseconds
you want to get the current time in milliseconds?
Ya
language?
Node
JAVASCRIPT, node isnt language plz ... stop
not, this is run-time environment
Node.js is simplified
Nodejs is runtime environment for javascript
Yeah
I dont know how to say that @split dune
But i dont speak english
from what i'm seeing from the docs you'd just want to use Date.now()
Can someone halp me? I can not get it to show how many servers my bot is running on 😦
@runic hull which language you use ?
python
I don't know about Python Sorry
import aiohttp
dbltoken = "token"
url = "https://discordbots.org/api/bots/" + bot.user.id + "/stats"
headers = {"Authorization" : dbltoken}
async def on_ready():
payload = {"server_count" : len(bot.servers)}
async with aiohttp.ClientSession() as aioclient:
await aioclient.post(url, data=payload, headers=headers)
async def on_server_join(server):
payload = {"server_count" : len(bot.servers)}
async with aiohttp.ClientSession() as aioclient:
await aioclient.post(url, data=payload, headers=headers)
async def on_server_remove(server):
payload = {"server_count" : len(bot.servers)}
async with aiohttp.ClientSession() as aioclient:
await aioclient.post(url, data=payload, headers=headers)
I see this @runic hull
Okay thx
I can not run pip install dblpy on my vServer.
import discord
import aiohttp
bot = discord.Client()
dbltoken = "TOKEN_ALREADY_IN_HERE"
url = "https://discordbots.org/api/bots/" + bot.user.id + "/stats"
headers = {"Authorization" : dbltoken}
async def on_ready():
payload = {"server_count" : len(bot.servers)}
async with aiohttp.ClientSession() as aioclient:
await aioclient.post(url, data=payload, headers=headers)
async def on_server_join(server):
payload = {"server_count" : len(bot.servers)}
async with aiohttp.ClientSession() as aioclient:
await aioclient.post(url, data=payload, headers=headers)
async def on_server_remove(server):
payload = {"server_count" : len(bot.servers)}
async with aiohttp.ClientSession() as aioclient:
await aioclient.post(url, data=payload, headers=headers)
bot.run(bottoken)
51|h2 | Traceback (most recent call last):
51|h2 | File "/root/h2.py", line 6, in <module>
51|h2 | url = "https://discordbots.org/api/bots/" + bot.user.id + "/stats"
51|h2 | AttributeError: 'NoneType' object has no attribute 'id'
51|h2 | Unclosed client session
51|h2 | client_session: <aiohttp.client.ClientSession object at 0x7f034fa174e0>
51|h2 | Traceback (most recent call last):
51|h2 | File "/root/h2.py", line 6, in <module>
51|h2 | url = "https://discordbots.org/api/bots/" + bot.user.id + "/stats"
51|h2 | AttributeError: 'NoneType' object has no attribute 'id'
51|h2 | Unclosed client session
51|h2 | client_session: <aiohttp.client.ClientSession object at 0x7f3adc1d9550>
[vServer]
😦
@sick cloud im on my computer now
@runic hull this doesnt work url = "https://discordbots.org/api/bots/" + bot.user.id + "/stats" because bot.user.id does not exist yet
you need to do it inside the ready event
I already fixed it.
👍
How do you get things like cpu and ram usage
best way would probably be to get them from your system
by executing a linux command using exec for example in node.js
I just keep having problems...
Im not sure why this exists now
It never used to happen
I'm trying to make a json file with prefixes for each guild so they can all have seperate prefixes, but I'm having trouble writing to the file
It reads it fine
This is the little bit of code having trouble
Whoops
if you want to use a . in your key, wrap it in quotes
oh I see
you should use bracket notation then
Can I write to files doing that?
Because thats what I was doing earlier
it never saved
It works now, but it's overwriting the json file completely
I think I know how to fix that tho
imo i would use a database for that, mongodb is a great option
I have no experience with databases.
I tried one
They confuse the hell out of me
what did you try?
nice
Got it all working
thanks for the help
I forgot to turn on my music throughout all of that :(
Do you know how can I determine if a user has a certain permission just using the permission int?
yes with bitwise masking
Do you need to use the int?
Boolean(totalBits & bit)
true
idk lib so
but bitwise masking more fun
output: false
@amber fractal I'm doing it in PHP using api calls
oh php
x)
Good luck, idek what that is
oh, seems to be pretty ez
hahaaa
done
I wanted to check if for each guild, the logged user had the "Manage server" perm (to know if they can invite a bot) and here's how I did it in PHP (for those who wanna know) :
<ul>
<?php
$guilds = getGuilds($_SESSION['token']);
foreach ($guilds as $guild) {
?>
<li><?= $guild['name'] . ' (' . ($guild['permissions'] & 32) . ')' ?></li>
<?php
}
?>
</ul>
you say php i hear web vuln
why tho
a better question would be why not
I though php was designed to be pretty secure

if you say your app runs on php most devs in general won't take take you as a proper dev
well, I'm just tryin' to make a system just like mee6, dyno or Melijn to login through discord and manage the bot via a dashboard
use anything but php for that
what else?
been there, done that, php is extremely unsecure and i leaked my bot's token in the early days
hoooow
by it just being in the server's code
anyways
i personally use asp.net core, you can also use node or python
bruuuh
react is gud
- you don't
- you don't
- you don't but in italic
@frozen tiger PHP is not that bad, but beware there are some really stupid implementation
xD
@frozen tiger pretty much any untyped system | dynamically typed | no type assertion is pretty bad when it comes to security
but if you know what you are doing, PHP is just as secure (PHP actually introduced type hinting which is phenomenal)
If a bot has, say, 3 shards, what does that mean? minx==noob
How do you do that
check the docs for your library
but you only need it if you have thousands of guilds
Makes sense
dm goes to shard 0
How can I check (using api calls only, yeah again) if my bot is in a given guild, looking the api doc for 45min now but can't figure out how to do this
what lib
just try to get the guild??
what very obscrure language are you using
@frozen tiger once the guildCreate ws events are sent you should store them in a guilds collection or something. just find it from there
@bright spear unnecessary api call
How can I auto edit a message every minute with data that is also being checked every minute and stored in a variable? I keep getting errors saying that I havent defined my guild even though it is directly next to my 'channels'.
you should be storing the guilds locally
I'm doing a php dashboard
oh your not making a direct ws connection
could've mentioned that
but ok
yeah use the api endpoint
cant you use one of the php libs?
well they might ban you for not using a lib if you accidentally spam the api
vetted libs protect against that
Here's my goal :
Sign in through discord : Done.
List guild where the logged user can invite the bot : Done.
Mark those where the bot is already in : This is what I wanna do.
hmm, you're right
if you're gonna use a lib look at https://github.com/CharlotteDunois/Yasmin
why don't you use some form of IPC
to check the guilds the bot is in?
GET /users/@me/guilds with the oauth token
then send the ids to the bot
and have the bot respond with the guilds it's in from that list
@inner jewel I planned to do that since advaith suggested to use a php library
as I said, I'm going to make an online dashboard 😄
my java is gently running for now
wdym
My backend exposes an API endpoint for my to query
wow
ex: api.reaction-role.com/v2/guild/:id
Ooooh so your kinda making your own api to query information directly through your bot?
i do basically that but via nats
this is way to hard for me, I'm a terrible java coder haha
not even able to make a decent piece of code lol
My bot keep making 2 instances. I just stopped it even and its still running 2
are you logging twice in your code somewhere ?
No
The part that I stopped it via terminal and its still running is the real problem
reboot ur computer
reboot ur vps or whatever hosts your bot
Just rebooted it, its still online
Already regenerated the token
It finally shut off, but its weird
upwards of a minute to shutoff is just odd tho
@inner jewel so uh help me out h e r e

how well do you know hazelcast 
How would I get an object at a certain index in a collection? For instance, using
client.on('guildCreate', async guildAdd => {
for (var i = 0; i < guildAdd.members.length; i++) {
var userId = guildAdd.members[i].id;
}
}
guildAdd.members[i].id is apparently? Not a function that works?
fishy, can you tell me very quickly how can you make an internal api to use your bot as a gateway ? any tutorial, doc ?
map.get(key)
so it's guildAdd.members.get(i)?
that's djs right?
yeah
Trying to loop through all users, and log all of their ID's in an object, push that object to an array, then send that array thing in to a JSON file
So you trying to get all users in a guild?
json.stringify(guild.members.values())
I'm rart
so in fact, you query information in your bot cache?
just like querying a redis cache ? XD
yeah
I saw in Melijn repo (I think) somehow a locale ip that may lead to JDA cache
but not sure at all
what exactly does guild.members.values() return?
so there is a way to access JDA cache via request @inner jewel ?
if you write code to expose it, yes
@buoyant void it returns an iterator
to check which guilds the user has permission in
@buoyant void guild.members.array() is also available
kotlin, yaark 
scala*
reoinveroin
@inner jewel so uh what's vertx
™
@inner jewel link m e
Natan™
Eclipse Vert.x is a tool-kit for building reactive applications on the JVM.
o this looks gey
it is

lol
i'm trying to see what good memory data grid options there are
there's some nice stuff but then there's the http client that makes everyone puke
currently I found apache ignite, hazelcast and gridgain
we literally had to do this in catnip https://zero-two.is-a-good-waifu.com/26c5f6.png
lol
sigh guess I'm gonna forget this dashboard projet for now
dude this is way too complex
or u could just make it in the same lang and lib you made your bot with
and what do people mean when they talk about jvm waming up 
If somehow, I succeed to make a working one It'll be awful
it profiles your code when it's interpreting
then it can optimize it

but the optimizer takes a while to kick in
so it can do optimizations after it has enough information
one of the Discord outage announcement was like
waiting for cache to warm up
is it safe to assume they use jvm 
@bright spear well, would be ez af but how do you make an online dashboard from java haha
not really
is there another lang that does this
cache warming up is probably loading stuff into cache
interesting
could be any lang
warming is so vague
i know they use java for the DB
which db 
cassandra is java
o
most of the things you'll find out about "java uses too much memory" are either outdated or comparing it to eg optimized native code
or outright wrong
eg if you compare jda and d.js
what about Minecraft 
because jda caches everything, members, users, etc
why does Minecraft uses so much shit
it literally is
mojang can't write good code
cc @cosmic plover World.java and redstone stuff
my gpu is rendered useless on minecraft
minecraft uses an ancient version of opengl
because they don't update lwjgl
the lib supports newer versions of opengl but they stay on old builds that don't
wot about bedrock
¯_(ツ)_/¯
what language is bedrock even
c++
wew
ew
win10 is bedrock
lol
bruh
time to play bedrock
names're too complicated
so bedrock = win10 edition and java edition = normal version
yes
2015 Razer Blade: Razer Blade
yes
2016 Razer Blade: Razer Blade
when razer tells everyone the code name of a product and then explains what it does and shows it at CES
i have a question about
ok
i did this
dbl.hasVoted(`${message.author.id}`).then(voted => {
if (voted) {
const voting = message.content.split(' ').slice(1);
const votes = voting.join(' ')
console.log(`Vote command is used | Server: ${message.guild.name} | Server ID: ${message.guild.id} | Channel: ${message.channel.name} | By: ${message.author.username}| Question: ${votes}`)
if (!message.member.hasPermission('KICK_MEMBERS')) return message.channel.send('Only Moderators are allowed to use this command. Enable permission KICK_MEMBER for your role to access the command.');
message.channel.send
{
if(!votes) return message.reply(`Invalid Usage: =>poll [Question]`)
message.delete()
let embed = new Discord.RichEmbed()
.setAuthor('Voting | Poll')
.setColor('0xFF5733')
.setDescription(`Question: ${votes}`)
.setFooter(`Created by ${message.author.username}`)
message.channel.send(embed)
.then(newmsg => {
newmsg.react(`✅`)
.then(() => {
newmsg.react(`❌`)
})
})
}
} else return message.channel.send({embed: {color: 65292, title: "Upvote", description: "Please upvote Vortex to access this command. [Click here](https://discordbots.org/bot/427484224074022945/vote)"}}).catch(console.error);
});
i dont think i did it correct
cuz it says that dbl.hasVoted isnt a function
what do you have dbl set as
const dbl = require('dblapi.js');
you need to create a new instance of it
thanks natan
good natan
Fishy, i'm completly lost.. Just can't figure out how can I make a gatewey api through java
this would be so easier to make my dashboard
how to do it is completely dependent on what you have
that's why there are no tutorials
you can get tutorials for pieces you'd use to make that
but for the whole thing there aren't any
because it's different for each bot
I know it depends on what I wanna do
but the core how can I, for example, return guilds count via http://127.0.0.1:8888/api/guilds_count or something like this
i'll just convert you to another lang
uri is an exemple
alrigh
Any way to allow anyone with any role that has "Administrator" enabled to use a command? For now, I've been using specific roles
Discord.js
just use the permission








