#development
1 messages ยท Page 781 of 1

It's strange
interesting
is your bot sharded
Yes
Shardd does not launch
And also sometimes I think it's the API the bot removes and recovers from a lot of servers, 500 and sends back a message to the owner thanking him for adding my bot. I'm not going to risk having my account disabled, huh?
@mossy vine so ?
Threading is bae
basic principle:
add query to task list -> loop gets task -> get next free driver -> send task & add driver to current tasks -> Once Complete: send results to handler + add driver back to free drivers
every X amount of requests in the loop
somebody can help me ?
It's discord ?
500 codes mean somthing with the server side fucked up
the hardest thing is gonna be managing the creation and deltion of free drivers
I can't launch any bot wtf
you want as little ram usage as possible
What is this
but dont want them waiting for any amount of time
const Config = require("../../lib/mongodb.js");
module.exports = {
name: "settings",
category: "utils",
description: "Get a whole list of things you can change",
run: async (Discord, client, message, args, prefix, member, nopermsEmbed, validmemberEmbed) => {
let settingsEmbed = new Discord.RichEmbed()
.setTitle(":gear:**Settings**")
.addField("**Change Prefix**", `${prefix}settings prefix [prefix]`)
.setFooter(`[] = required, {} = optional | Requested by ${message.author.tag}`,`${message.author.avatarURL}`)
.setTimestamp();
if(!message.member.hasPermission("MANAGE_MESSAGES")) return message.channel.send(nopermsEmbed);
if(!args[1]) return message.channel.send(settingsEmbed);
if(args[1] === "prefix") {
let newPrefix = args[2];
const doc = await Config.findOne({ guildID: message.guild.id });
doc.prefix = newPrefix;
doc.save();
message.channel.send(`Changed prefix. New prefix is now **\`${newPrefix}\`**`);
};
}
};``` doesn't return anything even errors
?
its supposed to change prefix is i do {preifx}settings prefix [newPrefix]
so?
why args[1]?
^
learn to debug your code
@earnest phoenix read pins
what about them
We're here to help not criticise, lead them to guides to debug ยฏ\_(ใ)_/ยฏ
i didn't criticise
lol
wdym why args [1]
i hate it how people throw full blocks of code at other people hoping they'll fix it, it's not how it works, you're supposed to investigate the issue yourself in your code, find it, and only then if you don't know how to fix it come ask other people for help
Maybe they've tried
x doubt
If you're not gonna be helpful. Leave.
lmaoooo
i stated that they should learn to debug, you're getting butthurt because you're minimodding / and-or a wannabe mod
i hate it how people throw full blocks of code at other people hoping they'll fix it, it's not how it works, you're supposed to investigate the issue yourself in your code, find it, and only then if you don't know how to fix it come ask other people for help
You're assuming that they haven't already done this
maybe because they can't find it?
i've worked with people like this for over two years, it's just intuition when it comes to issues like these, and instead of fixing it for them you're supposed to push them to do it themselves, because otherwise, where's the point in learning if you don't do it yourself?
That's not what this channel is for though. Whilst we don't spoon feed we direct them to the right things and or point out the issue so they can research to fix it
@modern sable did I contradict myself?
the only thing i want to know does it not find the prefix that is inserted
I dont see where
not what this channel is for though
proceeds to rephrase the statement i said in my message
im tired
I didn't though. You're saying that they shouldnt use this channel to find the issue at all
I'm saying people come here because they can't find the issue in the first place
They need help seeing the issue they're having in a clearer light and want support in knowing how to fix it
i said to first try yourself, if you can't, you then come to ask for help to other people
but debugging your code is not something you... can't not know
if people were to be interested in the topic, they'd ask more about it
anyways
Uh? It comes with experience though. You're telling people to just go and learn it without directing them to sources
im really sleep deprived
if people were to be interested in the topic, they'd ask more about it
just saying "learn to debug your code" makes you seem like you dont want to help at all
Sure, we don't know if they looked at it or how long they looked at it. But it could also be something about JS that they genuinely don't know
Sending them guides and being helpful by directing them to links to where they can learn is helpful
Whether they asked for it or not
i'm aware it is helpful however chances are they're not going to read them / skim over them if they're not interested in the first place
i got it
im so dumb wtf
is wrong with me
@earnest phoenix you won't know that if you're just unhelpful straight off the bat tho
i dont want to come as narcissistic but i'm really experienced in this field and i genuinely understand how people flow in these types of situations
and trust me
being stricter is for their good
Everyone is different. Helping people learn rather than thinking just because you're so experienced in something you have the right to just saying "just learn x" it just doesn't help
maybe take this to dms?
Again. That isn't what this channel is for
which just loops... back to my original statement that if they were interested in the first place they'd ask about it
this whole argument stems from a minimodder lol
im too tired
I'm sure that is not a Conversation about Development
this is getting messy as shit
its bad enough keeping track of threads
let alone, task, drivers and threads
python threading is messy wew
Threading with Python is fun
its where i wish it had the ability to return stuff like async run in executor does
but sadly not
xD
it just means that there now has to be two seperate systems for starting tasks and getting the results back
I'm so glad I stopped using python lmfao
It's okay for web stuff
But for a discord bot
It's messy as heck
not rlly
its only like that if you dont use the command handler built in or have a decent one youve made
music is pretty ez
Threading is messy asf tho
considering wavelink has everything including the LL server sided stuff built in
I mean
and handles everything
async def task_checker(self):
while True:
if len(self.pending_tasks) > 0:
list_to_remove = []
while len(self.free_drivers) > 0:
temp_task = next(self.task_cycle)
list_to_remove.append(temp_task)
await self.start_task(task=temp_task)
for task_to_remove in list_to_remove:
self.pending_tasks.remove(task_to_remove)
self.reload_tasks()
await asyncio.sleep(0.2)
else:
await asyncio.sleep(1)```
hopefully
this shoulddddd work in terms of starting tasks
now how df i manage driver count is beyond me
i used lavalink for a while until i started having performance issues and huge resource consumptions
i just switched back to ffmpeg but the issue was i was spawning a new instance of the program every single time
so i just wrote a wrapper around ffmpeg libs and it's running quite smoothly now
Lavalink isnt a big problem for me anymore
And I quite often have around 20 players on my node because I'm supporting @robust trellis
And it only uses around 5-10% cpu
oh
really nice
i used to go up to 60-80% and i disliked that i had to have jre installed alongside other things on my machine
12 players atm
its got alot better tbh
we're not going to spoonfeed you
but basically just store deleted message with the channel and user
you have to store x amount of messages for each guild that are deleted
@modest maple or do as dream said
how do you get a bot on discord community??
Hello
why did you send a bot invite link here?
who?
@drifting tiger
lol
damn it
apparently it did not like that loop
oo
if (Roles.length <= 1) Roles = 'No roles';
if (emojiList.length >= 10) emojiList = 'Too many emojis to list';
if (emojiList.length <= 1) emojiList = 'No emojis';``` Can anyone see anything wrong in that for it to say `Too many emojis to list` & `Too many roles to list`?
even when it is smaller
guild.roles.length maybe?
Is it possible to fetch a channel on discord js stable?
Doesn't exist, on master i see it is client.channels.fetch but i do not see it anywhere for stable
YEET
you shouldn't need to fetch channels cause they're always going to be in cache
That's true, unless you decide to start saving memory
whats the bot commands?
However, if the channel you need is the one the message came from, you can use the channel data from the raw event and add it to the channel cache manually
The message raw event only sends the channel id
Let me chekc the source
where do you load that?
util/commandHandler.js
hey, i found a dataset of this format
"want":"wanteth",
"wants":"wanteth",
"was":"wast",
i want to use js to translate a sentence and replace words on the left hand to the corresponding word, on the right hand.
not sure how to approach it though
What i would do is put the words in an array (if already in json, key it) then create an empty JSON object and have a for loop translate the words and add them to the JSON emptyJson[toTranslate] = translatedWord and then return the data or do whatever with it
You can use google translate, there's plenty of wrappers if you're unsure of doing it yourself
you definitely want to use a service like google translate, context doesn't translate when you statically replace words
google translate support old English?
Oh for that there's probably a library that converts 21st century english into old english
could i do something like
str = "want"
str = Translate[str]
str = "wanteth"
d
coins system dosent work
ok
Starting a new task
[01/02/20 | 16:32:58] Returning <itertools.cycle object at 0x000002656F3AA458> to free drivers, task complete
[01/02/20 | 16:32:59] Returning <itertools.cycle object at 0x000002656F3AA458> to free drivers, task complete
[01/02/20 | 16:32:59] Returning <itertools.cycle object at 0x000002656F3AA458> to free drivers, task complete
[01/02/20 | 16:33:00] Returning <itertools.cycle object at 0x000002656F3AA458> to free drivers, task complete
[01/02/20 | 16:33:00] Returning <itertools.cycle object at 0x000002656F3AA458> to free drivers, task complete
[01/02/20 | 16:33:01] Returning <itertools.cycle object at 0x000002656F3AA458> to free drivers, task complete
[01/02/20 | 16:33:01] Removing a driver - reason: Not needed.
[01/02/20 | 16:33:01] Returning <itertools.cycle object at 0x000002656F3AA458> to free drivers, task complete
[01/02/20 | 16:33:02] Returning <itertools.cycle object at 0x000002656F3AA458> to free drivers, task complete
[01/02/20 | 16:33:02] Returning <itertools.cycle object at 0x000002656F3AA458> to free drivers, task complete
[01/02/20 | 16:33:03] Returning <itertools.cycle object at 0x000002656F3AA458> to free drivers, task complete
[01/02/20 | 16:33:03] Returning <itertools.cycle object at 0x000002656F3AA458> to free drivers, task complete
[01/02/20 | 16:33:04] Removing a driver - reason: Not needed.
[01/02/20 | 16:33:04] Returning <itertools.cycle object at 0x000002656F3AA458> to free drivers, task complete
[01/02/20 | 16:33:04] Returning <itertools.cycle object at 0x000002656F3AA458> to free drivers, task complete
[01/02/20 | 16:33:05] Returning <itertools.cycle object at 0x000002656F3AA458> to free drivers, task complete
[01/02/20 | 16:33:05] Returning <itertools.cycle object at 0x000002656F3AA458> to free drivers, task complete
[01/02/20 | 16:33:06] Returning <itertools.cycle object at 0x000002656F3AA458> to free drivers, task complete
[01/02/20 | 16:33:06] Removing a driver - reason: Not needed.
so somthing went a lil wrong
xD
turns out
i wasnt actually removing the task from the list
after it had been delt with
so it just kept looping it
[01/02/20 | 16:37:46] Returning Selenium_0 to free drivers, task complete ```
better
I need help with Eris:
I'm creating bot.db PG Pool with:
bot.db = new pg.Pool({connectionString: config["db_url"]});
But when I want to use this in command:
const con = msg.channel.guild.shard.client.db.connect();
let result = con.query("SELECT * FROM pokes WHERE id = (SELECT pokes[$1] FROM users WHERE u_id = $2)", [args, msg.author.id]);
console.log(result);
con.release();
I get TypeError: con.query is not a function. What is wrong?
connect is most likely async so you'll have to await it/use .then
Ok
In D.JS, Where are User and Member objects referenced, other than client.users and guild.members
I sweeped both of them and memory hasn't depleted, which leads me to believe there's more references than that
@split hazel that'll be presences. Which version of d.js are you on?
master, i have disabled presence updates though
and when i get collection size for both, i get expected numbers
(the event)
are you creating a fuck ton of event listeners
only message, raw, ready and thats about it
well from my side
and message does nothing but update the last message timestamp property for the user as of now
you can see node memory usage in real time by using chrome's dev tool inspector
if you run node with --inspect
i can see the real time memory usage anyway
when i tried that last time all i understood from it is a bunch of jibberish no one could understand
How to make HTTPS JSON request and storage result to variable?
in what language
@muted junco
wow owner probot
is it possible to get a invite link to a server your bot is in through the discord api?
Yes, but most people would like that, or I wouldn't
why not?
Some people see it as a privacy breach
Some random person getting access to every server just because their bot is in it
why is it in the api then? btw is this the method you're referring to? https://discord.js.org/#/docs/main/stable/class/GuildChannel?scrollTo=createInvite
or maybe there should be a way to opt out of certain api functionalities, dunno
it's there because it's a standard part of the api
that's where api abuse comes in play
you're allowed to use the endpoint but in a certain context only
lol
We are not going to spoonfeed you
no one is going to spoonfeed you
unless your offering money
its right in the rules to not be spoonfed
@earnest phoenix i already helped you
Rule 7a. Don't spoon-feed or attack beginners
Asking for code = Asking to be Spoon-fed
Asking for code isn't being spoon fed, asking how it works is
bruh what
wat
asking how code works isn't spoon-feed
asking for code so you don't have to do it yourself is spoon-feed
Codes no use if you don't understand it
you'd be surprised
dont stop people trying
people take the code even though they don't know what it is doing
that basically defines all of DBL
I don't agree with the no spoon feeding rule tbh, I think that should be up to each person who wants to offer their time for free. But I'm not here to debate or argue the rules.
no spoonfeeding
Some days I'm quite happy to spoon feed a newbie till they learn. Other days I can't be assed
But that's not for here
@earnest phoenix We arent giving you the code.
@earnest phoenix please read rule 7a and stop using caps
Those who wan't to be spoon-fed don't always want to know how it works
ok?
if your teacher will teach you don't talk about it here
then be angry somewhere else
๐ฅ
Joined server
Asked for code
People say no spoon-feed
Person gets confused and angry

๐ฅ
so we make the back end first handler
to then decide
to change the thread system
to get futures returned
and well
it has fucked alot of stuff
One of my friends got banned, where do I look to see why?
banned where
Halo! I am looking for people to help me with my discord bot cookie bot! I need some help with some commands and was hoping someone here could help. DM me if you can UwU
how old are you?
why do you want to know?
;-;
that message halved the count of my brain cells
hush im wierd and im 13 -w-
because you seem young and also this isnt the place to ask people to work on your bot for you, if you need help send your issue here
@earnest phoenix just becaus u said "UwU" i wont DM you to help, but help you here. So state your question & if we know then we will answer
ok
When he blocks you for dming me and talking about your tag
I miss when people where interested in itt.. ;-;
I like attention- wrong channel
ok
what's up with the cringe attack
sur i am not cringe
yes ๐
Boois
hi
my hell has been lifted
for(i = 0; i < 10; i++)
{
setTimeout(function(){console.clear(), console.log("\|")}, 1000);
setTimeout(function(){console.clear(), console.log("\/")}, 2000);
setTimeout(function(){console.clear(), console.log("\-")}, 3000);
setTimeout(function(){console.clear(), console.log("\\")}, 4000);
}
i don't get why this is running once and not in a loop
hell has been lifted
that will run 10 times after 1s, 10 times after 2s, 10 times after 3s, 10 times after 4s
Do you possibly mean to wait for the setTimeout to occur, then repeat it the next time
you are looping 10 times, and on each loop you are creating 4 timeouts
after 10 loops, you have 40 timeouts
only then the timeouts start running
so you have 10 timeouts after 1s, 10 after 2s, etc
multiply the timeout by i + 1 to fix that
oh
What else can I do to save memory on d.js, i have a bot running on about 700 servers and by sweeping unnecessary users, members, emojis, presences, voice states, and channels memory went down from 172MB to 115MB (obviously this will have a higher impact on the main bot)
so the timeouts are "overwriting" each other
@split hazel ngl idk why you would want to remove any more, removing cache of certain stuff can fuck you more in the future in the little bit of ram you save
I know what i'm removing and what the consequences will be
ye
and i switched to master so i could take advantage of client.channels.fetch
i can send you my github if you want to take a look at how i do my anti-caching
yes please lmao
mine isn't exactly anti cache except some
jk
emojis and presences are locked to not be cached
i dont want it
member, channels, users are swept on an interval based if they are frequently used or not
ok fixed it, not sure if this is what you suggested
var j = 0;
for(i = 0; i < 10; i++)
{
setTimeout(function(){console.clear(), console.log("\|")}, j += i*100);
setTimeout(function(){console.clear(), console.log("\/")}, j += i*100);
setTimeout(function(){console.clear(), console.log("\-")}, j += i*100);
setTimeout(function(){console.clear(), console.log("\\")}, j += i*100);
}
i mean, you dont need j at all
nvm, forgot to scroll down
what would you do instead?
wouldn | / - \ run at the same time then?
if i is 0, then the first 4 timeouts will be 0. if i is 1, then the 4 timeouts will be 100
and so on
so you will have 4 timeouts on 0, 4 on 100, 4 on 200, 4 on 300
just adjust your values until you have what you want
like this?
for(i = 0; i < 10; i++)
{
setTimeout(function(){console.clear(), console.log("\|")}, i*100);
setTimeout(function(){console.clear(), console.log("\/")}, i*100);
setTimeout(function(){console.clear(), console.log("\-")}, i*100);
setTimeout(function(){console.clear(), console.log("\\")}, i*100);
}
its simple maths
maybe give each timeout a little offset so all 4 dont run at the same time
cause that doesn't work
0 + i*100
250 + i*100
and so on
think of the for loop as the starting line. the timeouts only run after all the 10 loops finish. how do you need to configure all the 40 timeouts to have them execute in the correct order?
my numbers are incorrect, but you understand what i mean ^^
i think i get the logic of the foor loop it just generates 40 timeouts
and it's up to me to make sure the timeout goes
100, 200 ,300 ,400 ,500, 600 ....
if you do i*100 then make sure that the values you add to it is below 100
?
<%- include('ek/header', {bot, user, path}) %
<div class="container">
<style> body { background-color:#4c4c4c; } strong { color:#00bc3b; } h3 { color:#fff; } p { color:#fff; } </style>
<div align="center"><br>
<div class="jumbotron" style="background-color:#222; border-radius:40px;">
<h3 style="color:#fff"><%- include('ek/header', {bot, user, path}) %>
<div class="container">
<style> body { background-color:#4c4c4c; } strong { color:#00bc3b; } h3 { color:#fff; } p { color:#fff; } </style>
<div align="center"><br>
<div class="jumbotron" style="background-color:#222; border-radius:40px;">
<h3 style="color:#fff">
what ?
read the error
thonk
what is random
@earnest phoenix server, client, injector, pussygrabber now i cant tell what it is that makes me wonder thats odd about that
@summer torrent
@royal herald .toFixed() makes it a string
^
ฤฐ use .toFixed?
yes
@earnest phoenix imagine using visual studio
how can i fix?
asa
dont use toFixed?
it says the input must be a number
toFixed() transforms a number into a string (text)
either use something else that doesnt transform it into a string, or transform it back into a number
db.add(xp_${id}_${gid}, random.toFixed()); how can use wihtout to fixed?
depends what you want to do
level system
but,on a ohter bot its works
do you even know what toFixed() does?
@_@
I guess Ash tries to round/floor the value?
lol
"android coder"
cringe
ok so listen, when you use Math.random() operations, you get a number with a lot of decimals, ie 0.876597659376
(0.55555).toFixed(2); //> 0.55
you use toFixed() to truncate those decimals into the amount you want, like ^
but toFixed() transforms the number into a string. so it becomes text, not a number anymore
and your error says that it MUST be a number
it doesnt accept text
so do you need to remove decimals? how many decimals do you want to remove? there are other ways of removing decimals, and there are also ways to turn a text back into a number
oh wait,i will go. bys
Lol
And at that moment he has gone, to never return
learning overload
this channel is gold
Tim is why you live in this channel
xD
Looking for saome that will make me a bot for free
Good luck, I don't think you will find it here
Would this work if I were to eval it? ```js
new new require('dblapi.js')(client.config.topGGToken, client).postStats(client.guilds.size, 0, 0);
it posts every 15 minutes iirc
i dont use the library since i can create my own autoposter 
30 minutes by default if you provide it with your client
double new wtf
does anyone know
was curious about that too, tim
It's twice as new...
:)
because ur loop succ /s
what are rich embed best practices?
i guess what i mean is like, how many rich embeds are too many etc
i mean a bot can post one embed per message
right i know that part, but i mean like, people can turn seeing them off right? i am curious as to why that's an option and what i can do with embeds to make them accessible and unobtrusive so that users wouldn't want to turn them off because of a bot
you can send both
i've seen people just post a link to their github page with all of the commands
for example:
if you cant see anything, turn on message embeds
embed here
is there a function to detect whether or not a user has them on or off?
nope
i mean you shouldn't really be concerned whether they can see it or if they can't
it was their decision to turn off embeds
although people are stupid and forget or dont know what it does and then come asking why your bot doesnt work for them
the bot i am working on is for a TTRPG and i am setting it up so that the bot returns shit almost like a jrpg dialog screen. so like it has an NPC's name and portrait, then the message, etc
const Discord = require("discord.js");
exports.run = async (client, message, args) => {
message.guild.fetchInvites().then(invs => {
let user = message.mentions.users.first() || message.author
let personalInvites = invs.filter(i => i.inviter.id === user.id);
let davetsayi = personalInvites.reduce((p, v) => v.uses + p, 0);
```
(node:21536) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'id' of undefined
help me pls
hmm
|| message.author;
i can't recommend a linter enough
@toxic jolt Is it because message.author gives a map of the members data? rather than a true or false
๐ debug ๐ your ๐ code ๐
Though I do agree it should give a true if the author exists
console.log i.inviter and see what it returns
also Message#author is the author of the message, not an Array of the guild members' data
^ that, or try something like if (message.author) {console.log(1)} else {console.log(2)}
and yeah I was referring to the author as 'members'
ah ok
let a = something || somethingelse is perfectly valid
his problem is probably some weird entanglement elsewhere
hmm
[01/02/20 | 22:01:03] Starting Task Manager...
[01/02/20 | 22:01:03] Starting Driver Manager...
{'user_id': 290923752475066368, 'channel_id': 640156114343952398, 'url': 'https://www.crunchyroll.com/search?from=videos&q=test', 'type': 0}
[01/02/20 | 22:02:47] Starting a new task
[01/02/20 | 22:02:47] Returning Selenium_0 to free drivers, task complete
{'user_id': 290923752475066368, 'channel_id': 640156114343952398, 'url': 'https://www.crunchyroll.com/search?from=videos&q=test', 'type': 0}
[01/02/20 | 22:02:51] Starting a new task
[01/02/20 | 22:02:52] Returning Selenium_1 to free drivers, task complete
back end
sorta working
bot can't use the emoji
Why
it could be it doesn't have external emojis perms or the bot doesn't have the emoji
its in the guild, and im testing in a dm
weird
is emoji animated?
<a:bopsosjw sdi:whatever>
<a:bopparrot:emojiID>
dont forget the a
Integrate your service with Discord โ whether it's a bot or a game or whatever your wildest imagination can come up with.
Ah thanks!
@iron scroll yes, google apis have quota limits
let user = message.mentions.users.first() || message.author || idk what to add here to make it show something like this
does that make sense?
so u can search by name
so uh
also if x has a value then y will not be executed
^ forgot to say that
let user = message.mentions.users.first() || message.author || x || y?
thats wrong right?

yh knew it ;(, what does x & y be defined as?
x and y is an example, like you use in math
His question is probably how to get a user with a partial input string
you know
kind of what he showed
you want it to search for a user when you enter a partial name?
You can use the find method
and you will have to apply the logic you've just been told
if you just add it at the back
it won't ever work
because message.author will at least be used
your or statements will be executed left to right
I would use filter and see if the user has that name, was mentioned, or something
i wouldn't use it on all users, rather on the guild members
thats a lot of logging... do you work for the CIA?
i cant understand what you say
lmao
too bad jokes almost never translate well xD
cia be looking for nsfw avatars
and other shit that is kinda useless but
cia does what it does i guess
How would I create notifications for a YouTube channel?
Guessing yt API and webhooks
pubsubhubbub ๐
So I need help creating a delete all channels command, im kinda stuck, at most I can get the command to delete 2 channels, can someone explain it to me?
loop through all of the channels in the guild and delete them
I don't see any reason why you want to delete all channels
If someone or you don't handle the perms properly
well you could disable the channels via roles and clear the channels
That gives the ability for nuking servers if it goes wrong
instead of deleting the channels just delete all messages in the last X minutes
I wouldn't take the risk
Ok
.
dotposting
how can you use code markdown in an embed?
Same as in a regular message
I don't think you can use markdown in every area in an embed
but you will have to try it
ok
markdown afaik cant be used in embed titles and footers
Brothers can someone help me ?
I made the same as api docs says. But
Password?? Is it this??
@grand wolf thats a token you make for webhook requests
Not the token. The password
This one
const dbl = new DBL(yourDBLTokenHere, { webhookPort: 5000, webhookAuth: 'password' });
Do u mea to repeat the token 2 times ??
maybe ur missing a )
whar
This is the console log
Webhook running at http://0.0.0.0:5000/dblwebhook
But test button do nothing also voting dont log any thing
No
The same password of what?
Of what I have filled in authorization?
yes
@grand wolf the password in your bot is the authorization on the site
Not worked
My code is
const DBL = require("dblapi.js");
const dbl = new DBL(process.env.DBLTOKEN,{ webhookPort: 5000, webhookAuth: process.env.DBLTOPWD});```
The console logs this on webhook ready event
Webhook running at http://0.0.0.0:5000/dblwebhook
The URL is empty in bot's page and assigned the same password
@vital lark can u please help me
Oh
What im missing?
What is that for
To get who voted on my bot
Do u have docs open
Yup
Link pls
Which url should i put
ur vps ip
Okay
All u need is this const DBL = require('dblapi.js'); const dbl = new DBL(yourDBLTokenHere, { webhookPort: 5000, webhookAuth: 'password' }); dbl.webhook.on('ready', hook => { console.log(`Webhook running at http://${hook.hostname}:${hook.port}${hook.path}`); }); dbl.webhook.on('vote', vote => { console.log(`User with ID ${vote.user} just voted!`); });
That's a fat 
the URL you enter on your bot page should look like http://1.2.3.4:5000/dblwebhook
Where the IP is the IP of your VPS
Itโs in docs either way
Oh lol
Yea i copy pasted docs
OH
To my vps
๐
I assigned it but also the same.
Nothing changed
@fiery stream I used it but nothing happens
Did anyone even vote?
Yup and test button
Nothing appears
Only the console logs this Webhook running at http://0.0.0.0:5000/dblwebhook
async def mute3(ctx, member: discord.Member):
role = discord.utils.get(ctx.guild.roles, name='Muted')
await member.add_roles(role)
await ctx.send("role added")```I am trying to use this milkman It is not working but it is also not throwing back any errors
are you sure the role exists, how are you using the command (as in the message you sent)?
Anyone have any nice formats for discord announcements? I don't like using @ here to make it yellow although that is flashy, i'm looking for something more.
use >
exemple embed : js let embed = new Discord.RichEmbed() .setTitle("Teste") .addFied("AddFied 1", "AddFied 1") .addFied("AddFied 2", "AddFied 2") .addFied("AddFied 3", "AddFied 3") .addFied("AddFied 4", "AddFied 4")Where should I put it?
teste
test
ow okay
I'm going to try
yes i wrote it in the chat to explain x)
Hey, is there a way to wait for a embed image to load before sending the actual embed?
no
rip
do u think using local upload will go faster?
or delay the message itself?
@broken jay reelaborate your question
@broken jay use await instead of .then
await's purpose is to wait for a promise to fulfil while a .then will allow other code to continue running while waiting for it
(just something from goolge) The fundamental difference between await and vanilla promises is that await X suspends execution of the current function, while promise.then(X) continues execution of the current function after adding the X call to the callback chain.
help mee PLS ```js
/node_modules/opusscript/build/opusscript_native_wasm.js:8
var Module=typeof Module!=="undefined"?Module:{};var moduleOverrides={};var key;for(key in Module){if(Module.hasOwnProperty(key)){moduleOverrides[key]=Module[key]}}Module["arguments"]=[];Module["thisProgram"]="./this.program";Module["quit"]=function(status,toThrow){throw toThrow};Module["preRun"]=[];Module["postRun"]=[];var ENVIRONMENT_IS_WEB=false;var ENVIRONMENT_IS_WORKER=false;var ENVIRONMENT_IS_NODE=false;var ENVIRONMENT_HAS_NODE=false;var ENVIRONMENT_IS_SHELL=false;ENVIRONMENT_IS_WEB=typeof window==="object";ENVIRONMENT_IS_WORKER=typeof importScripts==="function";ENVIRONMENT_HAS_NODE=typeof process==="object"&&typeof process.versions==="object"&&typeof process.versions.node==="string";ENVIRONMENT_IS_NODE=ENVIRONMENT_HAS_NODE&&!ENVIRONMENT_IS_WEB&&!ENVIRONMENT_IS_WORKER;ENVIRONMENT_IS_SHELL=!ENVIRONMENT_IS_WEB&&!ENVIRONMENT_IS_NODE&&!ENVIRONMENT_IS_WORKER;var scriptDirectory="";function locateFile(path){if(Module["locateFile"]){re
Error: read ECONNRESET
at _errnoException (util.js:1022:11)
at TCP.onread (net.js:628:25)```
I want to use it in class constructor, but constructor isn't async. @amber fractal
Yeah I've run into that before, you can, in the constructor, call an async method inside the class and let that just act as the constructor (never tried this just came to mind, might not work) or you can put the rest of your constructor inside of the .then those are what I can think of now, you might be able to find more solutions online tho
exports.run = async (client, message, args, ops) => {
if (!message.member.voiceChannel) return message.channel.send('Please connect to a voice channel to use this command');
if (!args[0]) return message.channel.send('Please input a URL following ;play');
let validate = ytdl.validateURL(args[0]);
if (!validate) return message.channel.send('Please input a **valid** URL following ;play');
let info = await ytdl.getInfo(args[0]);
let data = ops.active.get(message.guild.id) || {};
if (!data.connection) data.connection = await message.member.voiceChannel.join();
data.queue.push({
songTitle: info.title,
requester: message.author.tag,
url: args[0],
announceChannel: message.channel.id
});
if (!data.dispatcher) play(client, ops, data);
else {
message.channel.send(Added ${info.title} to the queue);
}
ops.active.set(message.guild.id, data);
}
async function play(client, ops, data) {
client.channels.get(data.queue[0].announceChannel).send(Now playing ${data});
data.dispatcher = await data.connection.playStream(ytdl(data.queue[0].url, { filter: 'audioonly' }));
data.dispatcher.guildID = data.guildID;
data.dispatcher.once('end', function () {
end(client, ops, data);
});
}
function end(client, ops, dispatcher) {
let fetched = ops.active.get(dispatcher.guildID);
fetched.queue.shift();
if (fetched.queue.length > 0) {
ops.active.set(dispatcher.guildID, fetched);
playStream(client, ops, fetched);
} else {
ops.active.delete(dispatcher.guildID);
let vc = client.guilds.get(dispatcher.guildID).me.voiceChannel;
if (vc) vc.leave();
}
}```
(node:5292) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'push' of undefined.```
Help!
And I get no response, that's fucking amazing ๐
read your error: 'push' is not a thing on undefined
don't be rude, it's early/late where a lot of people are
The 'TypeError...' explains what your problem is, you're using push on an undefined. I'm assuming you're expecting it to be an array
Here's where 'push comes in:
songTitle: info.title,
requester: message.author.tag,
url: args[0],
announceChannel: message.channel.id
});
if (!data.dispatcher) play(client, ops, data);
else {
message.channel.send(Added ${info.title} to the queue);
}```
Is data.queue ever defined?
No
gotta have data.queue = []; somewhere
The tutorial I'm using doesn't define it
well the tutorial either 1. is broken or 2. has something you're missing
also if you're learning from a tutorial I HIGHLY suggest you go through and learn what each individual part of the code does
Ok
Now I'm getting a new error:
at play (C:\Users\XPS 9100\Desktop\sportstackerbot\commands\play.js:38:39)
at Object.exports.run (C:\Users\XPS 9100\Desktop\sportstackerbot\commands\play.js:26:27)
at processTicksAndRejections (internal/process/task_queues.js:93:5)
(node:1632) 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: 1)
(node:1632) [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.```
@earnest phoenix I would like to know why are using the WASI module
do you even know what the WASI module does??
wait no i read that wrong
why are using opusscript, opusscript is only and should be used in development environments not in production environments
@wintry sonnet show the play.js file
const code = args.join(" ");
let evaled = eval(code)
if(typeof evaled !== "string") evaled = inspect(evaled);
if(evaled.size >= 1024) evaled = `${evaled.substring(0, 50)}...`
last line does not work
Can somone pls make me a botm for free dm me if yes pls
no
imagine getting a bot for free
how can i push things into a empty object?
constructor(name, type, image, special, firstOwner, id){
this.name = name;
this.type = type;
this.image = image;
this.firstOwner = firstOwner;
this.move = special;
this.level = 1;
this.xp = 0;
this.id;
if(id){
this.id = id;
return;
}
let iiid;
mongo.connect(async err => {
if(err) throw err;
const db = mongo.db("main");
let ids = await db.collection("ids").findOne({_id: this.name});
if(ids === null){
await db.collection("ids").insertOne({_id: this.name, latest: 0});
}
ids = await db.collection("ids").findOne({_id: this.name});
let iid = ids.latest + 1;
console.log(ids.latest, iid)
this.id = iid;
db.collection("ids").updateOne({_id: this.name}, {$set: {latest: iid}});
});
}
``` Can somebody tell me why do this.id equals to null but when I did the console.log, it outputted 1,2
I use MongoDB and discord.js
because you arent setting id as anything
You're giving it as a variable in the constructor
you dont need to check if it exists as if it isnt given it will be null anyway
@earnest phoenix Hope that helps
use .padStart
@earnest phoenix https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/padStart
You can't have an async constructor
@earnest phoenix ^^
Your constructer should just return a base object
You can put the async stuff in a different method
@delicate zephyr im setting the ID later after the code
And then just immediately call that
where should i put it then?
i need await or else findOne will be Promise <Pending>
Example
class MyClass {
constructor(prop, ...) {
this.prop = prop;
...
}
async init() {
//do some async stuff with awaits and all that
}
}
//create an object and initialize it
let myObject = await new MyClass(prop).init();
8 %
9 %
10%
creating the object like that will only work in an async function because it's using await
thanks @late hill

oh, there is a padEnd()
@earnest phoenix .padEnd
@earnest phoenix this code is redundant https://img.ichigo.uk/hxpmsr3bwypp.png
I need it for something
@earnest phoenix it literally does the same thing as just doing this.id = id
but-
everything you run new ClassName() it makes a new instance anyway
so what do you mean
are you using classes as functions?
i save the class in MongoDB but it wont save the function
so i have to make a new class each time
functions dont save in MongoDB

I need to save them because the class functions as an item in my game bot
so just save the object
and keep calling the object
rather than re initialising the class
but when i save the object, it only keeps its props in the database
how am I supposed to use the functions then
is discord master faster
@grizzled raven yeah kinda
kinda?
how can i get data from the website worldometer.info without scraping the website?
optimisation of ur code will probs make a bigger diffrence
@uneven wyvern you cant :/
they havent got an API
which leaves you with scraping
ok that sucks
@uneven wyvern you can just use selenium to scrap stuff easily tbh
hello sama badi her
why r u sending this in every channel
+1
How do you send DMS to other users using Eris?
Get the user, then call .getDMChannel, which returns a promise to a private channel
Thanks.
const DBL = require('dblapi.js')
module.exports = async (Bot, guild) => {
const dbl = new DBL(Bot.config.topGGToken, Bot)
dbl.postStats(Bot.guilds.size, 0, 0);```
(node:9200) UnhandledPromiseRejectionWarning: Error: 400 Bad Request
at IncomingMessage.<anonymous> (C:\Users\jnsho\node_modules\dblapi.js\src\index.js:118:25)```
doesn't work for some reason
Ill check the token, but probably still doesn't work
just get rif of those 0s at the end
you have your client here which activates the library's autoposter
what i ask. if you change the profile picture on the bot is it also changed on the website?
eventually
@snow pine yes
Hi
I think the issue is because you're requested the entire data instead of the actual data of it, it should be something like
JSON.parse(body.body);
hmm
is contabo's ping ok?
^ It converted an object to its string form [object Object], so you're trying to parse that instead of the actual body.
@grizzled raven https://www.speedtest.net/result/9002376189.png
this is for my vps anyway
cheapest one
This is the result from one of Galaxygate's.
Nice
@unique nimbus thanks
was just asking as chip's ping is always high xd
that is the 5 euro version
bigger the server the higher the ping will be?
understandable
location matters the most for ping
is it ok to do this? xd
are you hiding the ads?
@snow pine do you have js in the page?
nope
not to hide ads tho
you can change everything except disable/hide things
just as an fyi
@snow pine why <h2> </h1>
????
๐ค
is there a way to deal with varying symbol width?
| โโโโโโ
- โโโโโโ
@earnest phoenix idk xd
| โโโโโโ
- โโโโโโ
waith
are all symbols same width when typed in a code block?
in code blocks a monospace font is used
in regular messages, no
is it possible to use monospace font in messages?
not without this or this
what is the markdown for the first one?
Yeah I'm having trouble downloading "FFMPEG" for my music command, node, discord.js, javascript blah-blah
can someone walk me through it pls
@wheat jolt
exports.run = async (client, message, args, ops) => {
if (!message.member.voiceChannel) return message.channel.send('Please connect to a voice channel to use this command');
if (!args[0]) return message.channel.send('Please input a URL following ;play');
let validate = ytdl.validateURL(args[0]);
if (!validate) return message.channel.send('Please input a **valid** URL following ;play');
let info = await ytdl.getInfo(args[0]);
let data = ops.active.get(message.guild.id) || {};
if (!data.connection) data.connection = await message.member.voiceChannel.join();
data.queue.push({
songTitle: info.title,
requester: message.author.tag,
url: args[0],
announceChannel: message.channel.id
});
if (!data.dispatcher) play(client, ops, data);
else {
message.channel.send(Added ${info.title} to the queue);
}
ops.active.set(message.guild.id, data);
}
async function play(client, ops, data) {
client.channels.get(data.queue[0].announceChannel).send(Now playing ${data});
data.dispatcher = await data.connection.playStream(ytdl(data.queue[0].url, { filter: 'audioonly' }));
data.dispatcher.guildID = data.guildID;
data.dispatcher.once('end', function () {
end(client, ops, data);
});
}
function end(client, ops, dispatcher) {
let fetched = ops.active.get(dispatcher.guildID);
fetched.queue.shift();
if (fetched.queue.length > 0) {
ops.active.set(dispatcher.guildID, fetched);
playStream(client, ops, fetched);
} else {
ops.active.delete(dispatcher.guildID);
let vc = client.guilds.get(dispatcher.guildID).me.voiceChannel;
if (vc) vc.leave();
}
}```
```(node:5292) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'push' of undefined.```
Help!
you have to define "push"
Oh
Me?
One second
wait no, ignore me
u sure about that
I changed this code before going to bed
Let me get the new code
And the error as well
can you run the terminal/whatever you are using and start your bot, then show me full error response
@wintry sonnet
I guess not
@wintry sonnet bruh I told you how to fix it this morning https://discordapp.com/channels/264445053596991498/272764566411149314/673413921243267082
Anyway, I guess I'll repeat
Can anyone walk me through installing FFMPEG, so I can make a music player command .-.
Windows 10, Node, etc
My discord_bot isn't registering that I have NPM already installed .-.
did you add it to path
make sure it is in your path yes
no its just in c:/skydrive/desktop/discord_bot
npm
npm is in that path.
in your path env var
go here
click the environment variables button
check if npm is in there
also nice dox
its in there
so when you run npm
no I mean like, NPM is refusing to install FFMPEG
@mossy vine Sorry for the late response, but I was able to fix the new error I was receiving with my new code. Thanks for trying :)
let ch = this.client.db.get(`modLog_${message.guild.id}`) let modLog = message.guild.channels.filter(c => c.id === ch) if(!modLog) { return message.channel.send("There is no Mod Log set for this Server\nsetmodlog <channelMention>") } member.ban({days: days, reason: reason}) modLog.send(embed)
the error says that modLog.send() is not function but why?
Modlog is probably not defined as a channel
change
///I just message.guild.channels.find
let modLog = message.guild.channels.filter(c => c.name === "modlog") //or whatever the moderation channel is supposed to be.
modLog.send({embed: embed})
oh fuck I used filter
Well Idk what programming language that is.
it's a function that you can use on maps, arrays
I have a question, so my automoderator is not actually responding to my ban word list
will show you in a second
or not cause atom.io stopped working so maybe an extra minute
My bot is not moderating the included word/line.
I can bypass by setting msg.content to all capital letters
well first of all u should make it msg.content.toLowerCase.includes('nig'), so that the case of all letters wont matter.
toLowerCase is a function
toLowerCase lowers the case of all letters.
ah yeah, add the brackets right there
.toLowerCase().includes
ok ty for that
Add console.log to your if statements and see which branch is being executed
ive also noticed something there
the part in which ur checking if they have manage_messages or administrator perms
ur checking that on the user, and not on the guild member
yeah I noticed that a while ago
see, theres a difference between users and guild members. user represents the overall account of said user.
I just commented those lines and will do those later
guild member represents that user's instance in each of the guilds
yeah, it should be msg.guild.member(msg.author).hasPermission(...)
that way ur grabbing the guild member of that user
yeah
I'll remove the administrator line cause I mean, they have "manage_messages" permission after all
good point
thank you for the assistance though
well
the only thing i can think of in that case
is to do Number(days) in the member.ban function
could be convenient, im not sure of it implicitly converts its type or not
Didn't solved it
which line tho
Also @uneven wyvern this is only my suggestion but
you should change line 46
modLog.send({embed: embed})
where do i get the id of an emoji?
you have to post the emoji and click its ID
that i need to write it with a box
or copy its image
what if it's a gif emoji and i dont have nitro ?
is it possible to get id without using the emoji ?
if you have manage emoji's permission on the server, you can always get the ID off the emoji list
otherwise you would have to use the emoji in the server
you dont get the ID like that you have to right click it
and hit copy id
@earnest phoenix
wow noone notices
how can i right click it if i can't use it?
@obtuse wind change the = in the if statements to ==
no you right click the emoji part not the name






