#development
1 messages Β· Page 709 of 1
One message removed from a suspended account.
idk that
oof
typescript is a superset of javascript
it's not an entirely other language lol
@tepid hedge did you install sqlite with npm? i only see you installing it with apt (which is completely unnecessary)
@sage bobcat tsc --resolveJsonModule program.ts
Webhook
One message removed from a suspended account.
It can also be added to your tsconfig.json
can you fetch a message written before your bot joined a server
yes
you can fetch any message that hasn't been deleted if you have read message history permission in the channel
Could someone send me the piece of code i need to check if a user voted for my bot (Javascript)
no
-_-
Really kind of you
We don't spoonfeed
^ its a rule lol
Channel for chatting about (bot) development. If you have questions, ask the questions and wait for someone who can answer to help you. Do not ask to ask. Provide all possible information so people know what's up. Just saying "I get an error" doesn't give us enough information on your problem. Do not @mention people randomly.
Okay dicks. bye
Thats not very nice :c
That makes two then
If just the info on the site was more info giving then i didnt need help
There are thousands of bots in JS who knows what to do
dbl docs have enough information
wdym
don't blame dbl on your incompetence to write code
Eventhough I agree that my code is shit
@earnest phoenix there are examples on the docs that show how to do that
Go to https://top.gg/api/docs and select your language
yes
don't think i'll ever get to used to that
gg TLDs are cool tbh
big oof if they ever drop the discordbots name
dbl is very inconsistent with it
they call themselves discord bots, discord bot list etc
but no one googles top.gg bots
decision to move to top.gg was probably to avoid confusion with other lists and to stop the inconsistency
the domain doesn't have to include bot(s) to appear on google search results
and also to expand beyond discord
plus dbl is a sellout so they have adsense placed all over the website, which means that it'll get ranked higher in searches related to discord bots
One message removed from a suspended account.
what approach would you guys to suggest for fetching an integer from a message mixed into a sentence
an example could be "342632 hey guys what up"
And you just want the integer I assume?
yeah
Some sort of regex
Regex all characters that arent numbers
i guess that would turn "342632 hey guys what up" into 342632
however i fear cases that would be something like
Pretty sure that removes all numbers
"23546 how are you guys doing 2day"
But donβt quote me on that because my knowledge of regex is very bad
yeah, replace probalby isnt the thing you wanna do
just split by whitespace and iterate until one parses to a number 
if you dont use the g flag, regex will only match the first occurence
so you can search for the first occurence of a number
regardless of its length
although its a bit tricky
It gets way more complicated if you want to support users adding commas or decimals
Yes you can get all words that are integers look it up
It's not healthy to know regex by hearth usually people look it up on google to refresh memory
what
"it's not healthy to know the alphabet because you can google it"

Imo if you know regex by hearth you're not really sane
what is your logic even
following that, knowing anything by heart makes you not sane
thats. not exactly the same
Do you even know what kind of a mess regex is and what kind of a monster regex you can make??
if you work with regex a lot, you're bound to memorize how it works
i still don't get your point
just use one of those 1k char regexes people make for urls
how do I fix this to appear online?
wait for your bot to be accepted
the other one was accepted
and it shows offline
was it
because i see no bot dev role there
where
what does my status have to do with my bot
the other one was accepted
if your bot was accepted, you would have a bot dev role
the other one was added when MHW came out. In february 01 2018
I uploaded it online
I rejoined this discord today again'
i was on this discord
π€
MHW
monster hunter world
?
yes
When will my robot be accepted 
Click the link to get more information on the question:
2) How long is approval?
@earnest phoenix you are in the development channel, a place for speaking about development
oh no sorry
@eternal mesa warn me for trying to pay someone to make me a bot
I need those links
lol?
you could just ask
?
instead of being warned
You seem to have asked for a very specific bot/feature. You likely won't find it on the site if you haven't searched already. You can try and put a request on Fiverr or Freelancer.
Thanks
@quartz kindle I just get this
and i still get the same error
you didn't imply a certain file to run
iterate through the msg variable filtering out the ones you don't want (msg is a collection)
oops
@sudden geyser but how would i just iterate till the first non bot msg ?
wouldn't want to waste resources iterating every single msg
You can use the find method if you only need one item.
hmm
so i want the first non bot msg
if that makes sense
so msg.last() gives me the 2nd last msg
if i use the find method
wouldn't it just return the current msg ?
are you aware how find works @earnest phoenix ?
i think so ?
in this context, if i make the filter ( must be a non bot msg) it returns the first non bot msg ?
but that would just return the first message
but i want the last non bot msg excluding the very last one
so you want the last bot message that isnt the very last one?
filter out all the bot messages then get the middle index
well you'll need an array of the keys
(if you dont know where to start, d.js collections extend Maps)
better yet, you can just get an array of the entries that are left
no need for the key part I was talking about
another thing
when i write "var+1"
how do i make js treat it as an int
instead of as a string
parseInt()
that works if i store it in another var
i have something like
if(n = var+1)
if my var = 0, var+1 return "01"
parseInt(var) + 1 https://oliy.is-just-a.dev/4vjsod_1653.png
js and var types ay xd
@tepid hedge whe you did npm install sqlite3
it tries to get the prebuilt binary and it doesnt find it, then it fallsback to building it. did you let it build or did you cancel it? building can take a minute or two and its normal to see walls of text
hmm doesn't seem to work
parseint won't turn a "string" into a int ?
for number = 10
it returns 101
@amber fractal
Why not just await messages if that's what you're trying to do
I was under the impression you just wanted to fetch messages regardless
the code i have right now isn't optimal either
there are some cases where if the 2nd last msg is from a bot that can mess the code up
I'm really not sure exactly what you want, but you can check this out if you want to get a message from a user that is a number https://discord.js.org/#/docs/main/stable/class/TextChannel?scrollTo=awaitMessages but I have to go
No @urban oriole lul
https://oliy.is-just-a.dev/z4fbpb_1654.png this worked for me, but I do have to go
hmm
cya
@earnest phoenix additions and subtractions are sequential
Therefore: "a" + "b" + 1 + 1 = "ab" + 1 + 1 = "ab1" + 1 = "ab11"
If you want to resolve the 1+1 first, just put it in parenthesis
"a" + "b" + (1 + 1)
Parenthesis are always resolved first, just like in math, so the above resolves to "a" + "b" + 2
I use a discord bot maker thingy
but i have a question
how do i make ban commands use Discord Bot Maker on steam
i been only using a chat
thing
i want to soon make a prefix
and stuff
that can be used
I don't think bot maker thingy is going to do you any good
uh
its this
i just might but a / in all off it to act like a command
when really
its just this
yikes
isn't DBM paid...
it's literally free to code but i guess that's your choice
yikes
hey
its good
better then botghost thingy
im new to this stuff
so yeah
only started 3 days ago
lol it definitely is better than botghost
pls do
and no need to newline everything
Just write a long text
Make a /dab command picking one of many dabbing text phrases
One message removed from a suspended account.
One message removed from a suspended account.
that bot maker thing looks like so much more work
you still have to think about the code side of it because the "actions" are just lines of code, so it really saves you nothing and just makes you click a lot more
can bots use hyperlinks
also clicking when programming is my pet peeve. its so tedious
long time since ive ventured into dio server π
also clicking when programming is my pet peeve. its so tedious
vim was literally made for you then
@broken elm i guess you wouldnt like ue4 blueprints then...
π
@mossy vine vim is life. at least you didnt say emacs.
I mean you can navigate any good IDEs with the keyboard. It's just clicking is faster 
not with vim
ugh, git gc.auto with a 10 gig repo can go die in a fire.
π¦
its going to be christmas by the time this things done
Help
Thanks for giving us so much information to help you
i help those who help themselves! π
We can only help those who are willing to get help really
is it possible to connect to discord multiple times at once with the same bot token? im just mulling over easy ways to shard or cluster my bot.
i know i'd then need to mutex the sessions, so that every instance doesnt respond at once, that much is obvious
but thats trivial if i can just connect multiple instances at once and then have a first-come-first-served mutexed queue for processing commands
There's a easy way for discord.js IIRC
im not using discord.js, but i might go rtfs on that one
i was never really a fan of node
i'm pretty sure that there are easy ways for other langs/libraries aswell
the library im using is old and unsupported. im thinking of changing it
which language do you use?
luckily that wouldnt take me long, the bit of my code thats dependent upon the library is only 150 lines, the rest is abstracted
php, with team-reflex/discordphp from composer
but thats just a simple interface module that interfaces with a protocol-independent backend written in perl, i won't have to touch that bit luckily π
if it discordphp doesnt support any form of sharding/clustering out of the box, that would be a final nail in its coffin for me imho, ive already found that presence updates are plain broken
using discordphp is probably going to be difficult
especially if it's no longer being updated
there was mention of a replacement that is maintained
what im finding with discord is that the majority of libraries in any language imitate the structure of the underlying api
so the function names, objects, member variables etc are the same or extremely similar between them, makes migration easy
thats not been the case with other api's and libraries ive worked with over the years
you want to shard, or to separate functions by processes?
discord allows up to 1000 logins per day from the same token, at 1 login per 5 seconds
if you cant find a library that does what you want, it shouldnt be hard to modify the login script, all you need to do is specify sharding information in the identify packet that is sent to discord
i was just thinking of doing what i would with a webapp, a mysql database cluster, redis for transient data, and multiple frontend processes connected to discord via bot credentials
with some sort of marshalling to make sure only one instance handles any given request
worth mentioning that i only have three locations where i could put instances
not dozens, but three and three hundred are basically the same if done properly
if the request is coming from discord, then it will only be sent to the specific process managing that shard
so there shouldnt be much need for marshaling
isnt that specific process a single point of failure?
or does one particular instance take up that responsibility, and another take over if it goes down?
no, each process is responsible for a given shard, containing a given amount of guilds. if the shard fails, those guilds fail, but other shards and guilds remain operational
ah ha.
so i cant have multiple instances responsible for the same guilds? that way a failure is transparent
you can
not really
you can tell discord exactly which shard to you want to login to
so you can have multiple processes logging it to the same shard
if your goal is redundancy
then yes, you will receive duplicated requests
this is actually one of my methods for developing discord bots
i have a copy of my token running on an nwjs instance on my home pc
but then if you start sharding
its the same as running disks in raid 0+1
you have 4 processes managing 2 shards
right now my only instance is on my home server, a dell T310 in the utility room... its stable enough for now but i have a dedicated server in poland and a vps in london i really should be considering expanding onto
a single machine can handle over 100k guilds in my opinion
but you can also split across machines
the problem then is sharing data such as total guild information
yeah, i dont have a problem with performance, its just redundancy... the weak link in my chain is the domestic internet, fast enough but no real SLA
if it goes down, no bot
yeah, then a vps is an easy fix for that
any vps network is realiable ehough that more failures will come from discord itself than from your network lol
true lol
my vps is kind of underused
i got my dedicated server for anything that really needs grunt, the vps i pay $5 for and all thats on it is an ircd
ive been thinking of getting rid of the dedi though, hosting bills for it are a bit rediculous
like Β£70 a month
my bot's on ...one guild. my own π i only just decided to make it public yesterday
ahah cool
its based off an irc bot thats been running for near 20 years
with a database of over 1 million facts, inspired by infobot
websocket
the biggest performance impact is the websocket with guild subscriptions enabled (default)
and even then, 1600 guilds with it enabled only use 5-7% of a 3$ vps's cpu
with it disabled its 1% cpu lol
to be honest im the sort of person where if i had performance issues i'd rewrite it in C++
not sure if theres a C++ discord api client though
there should be
that would probably be overkill
but im running on node.js and it already gives me a very good performance
if javascript can do it, C++ is definitely overkill
imagine in c++ lul
depending on your needs, disabling guild subscriptions is a godsend
the only side effect is that you wont receive guild member join/leave packets
i really hope discord fixes it tho
what is guild subscription?
im pretty sure its an unintended effect
i dont know too much about the api right now, only what i see as the interface to it from whatever library i use
guild subscriptions is an option the api gives you when connecting to the websocket
its mainly responsible for sending TYPING and PRESENCE updates
but unfortunately it also affects other packets at the moment
Presence and typing events get dispatched from guilds that your bot is a member of. For many bots, these events are not useful and can be frequent and expensive to process at scale.
ah
if you disable during login, you wont receive those packets at all
and those packets account for like 90% of the websocket traffic
the bombardment is absurd
i saw those already, discordphp had a bug in the presence message that was causing warnings, i was seeing them like every minute
so theyre being emited to me, i havent done anything to unsub from them atm
yes they probably are
after i disabled it, my bot's network usage dropped like 90%
hmm, ive found the code for identification, let me read the docs and see if i can shoehorn unsubscribing from the guild events in there
well that isnt simple at all.
is it right that if i turn it on, i dont get any info on nicknames of guild members?
Hmm
line 27is what i added in... if i uncomment it, i dont get any nicknames on people talking in the chat
Their nicknames should be sent with guildcreate packets, i guess disabling it also strips them from there
But messages still contain member information
hmm
A workaround it to get the nickname from a message pacjet
Thats what i did on mi e
Ie: nicknames are only updated when they send new messages
Idk how your library handles the packets themselfeves
One message removed from a suspended account.
hi
One message removed from a suspended account.
Google for installers, there are many
hmm. the author property in the message object is empty
i wonder how thats filled in
It also comes with message packets
Unless your library is dropping them in favor of cached data
why i can't play sony in my discord?
Does your library expose a raw event?
You need to get access to the unprocessed packets
I had to do that in discord.js too
One message removed from a suspended account.
im going to go see if it provides that, if not im going to hack it in
hah, done it. stashed the raw in a global
thats ugly, but meh, it works
Yeah it feels like rewriting part of the library
But the gains are worth it
In discord.js I disabled most event processing and made my own events and my own cache updating instead
yeah its working now
im pulling from the global thats populated at receipt of each json message
i also went into the identify message and added presence data, which it wasnt doing itself, woo and yay etc
anyone know any free vps services which dont require you to put a credit card in which host rethinkdb at all? lol
free vps services
i dont think such a thing exists
yeah which sucks because i dont own a credit card yet (im 17)
im 15 and i got a credit card at 14 
Uh
Maybe a debit card
But you need to be 18 to get a credit card
unless you have a joint account
lucky lol, i got helicopter/restrictive parents so yeah, anyways i tried an alternative which is exposing the rethinkdb port onto ngrok but it links it to a full domain which rethinkdbdash (a node module) (like 2828.ngrok.io) cant do, it has to have a port at the end i think from my testing so yeah (like 2828.ngrok.io:28015)
the reason why i want the db to be online is to do some closed beta testing with some peeps online
i just need something temporary for now
ideaΒ΄s how i could make an snipe command?
You'd have to save the last deleted message
I'd need more information on the lib and lang you're working in to do that
Discord.js 11.5.1
Check out the messageDeleteevent
Well, ik but how do i save the messages
In a variable
huh, example ?

const items = new Map();
for(const i of Object.keys(database)) {
items.set(database[i].name, database[i].details);
}
{
"name": "thisitem",
"details": {
"aliases": ["thatitem"],
I've been stuck on this for awhile, basically I need to do a check for the aliases section, I know I check if the map contains the name (items.has("thisitem")) but I need to check if the map has one of the aliases, without the name of the item, so for example doing items.has("thatitem") but it obviously doesn't work, what should I be doing to check for the alias, without knowing the name first hand
the json bit is just a snippet of the full thing
I've also tried doing things like database[i].aliases or .details.aliases, without working results
discordjs btw
Map has a .forEach that you can use, however that is not really ideal for your case
If you're using discord.js, you could use a collection instead, which give you more appropriate features such as .find()
Hey guys, I'm really desesperate, can someone help me?I got so depressed trying to do this...
We are building a discord server to Build Viral, Techy "3Dprinted" buildings& interiors
"How to create a verification of identity and role on the server, like Suite7A server for example?
I want to have a bot , after people assign the roles, to see if they have some proof that they are really the roles they subscribed for, as in architects, engineers, etc,on my server, with a custom message for each one, do you know how to do this?if not, they would just be assigned to an extra "student" role ,apart from the role that they choose. And the ones who are verified, would appear first on the online list." DM me please if you can help me
How would you automate such a verification process? Sounds like something that should be manually verified, for example have interested members submit an application and manually verify their knowledge and give them the role
Unless you devise some sort of test lol, but tests can be leaked/cheated
How can I host my bot 100% free without heroku or glitch?
(and self host)
self host
AWS I think has a free tier, but I know nothing about it, and if you can even host bots with it
If I can run node.js I can host a bot
@quartz kindle check suite 7a (sent you an invite link) yes it would be a manually verified but the bot would ask for specific details, I don't want to msg people always with a personalized msg for each role
Oh, I need a credit card
MOM!
lmao
probably want to read about it a bit more tho
might only be free for a year or smthn
normally it's free 24/7 life
Unless you click on a paid service lol
Afaik is free for 12 months
Google has a free forever tier, but they charge for network usage beyond 1gb/month
@rancid knoll then thats not hard to do
You want to make it at role assignment instead of at join right?
You can set up a system that listens to role adding, or even some othet arbitraty starting move like reacting to a specific message
And then send a dm containing instructions on how to proceed
always searching for free linux online vm
is this because firstWord is treated like an int ?
what you've just make
if firstWord is not a string, that's your problem
?
but anything can be a string ?
even if its "12345", right ?
π€
yes
so how do i make it treat firstWord as a string
i tried to wrap firstWord in a String()
but same error
firstWord = String(firstWord).replace
does the variable contain any string value?
like letters ?
no, not all the time
but that shouldn't make any difference ?
"23152" is still a string right ?
var firstWord = ''; firstWord = firstWord.replace(/\D/g, '');
yeah anything between quotation marks is a string
the code might be redundant for that case
but it shouldn't return an error right ?
I'm guessing it doesn't recognize it as a string
by assigning it a string value lol
No
ok, how do i make it treat it as a string value ?
oh
just index it
with [0] yes
also don't know why you put () around it
Don't think that changes anything
this is basically how i work on playlists
try:
match = re.match(SURL, query)
spotify = match.group(1)
except AttributeError:
sdata = None
else:
sdata = await self.get_spotify(spotify)
if sdata:
try:
data = sdata['items']
except:
em.set_author(name="No playlist found. If this is your playlist make sure it isn't private.", icon_url=self.bot.img)
em.description = ""
return await ctx.send(embed=em)
if not has_voted(ctx):
em.set_author(name="Spotify", icon_url=self.bot.img)
em.description = f"To use playlists you must [vote](https://discordbots.org/bot/{ctx.bot.user.id}/vote)."
return await ctx.send(embed=em)
await ctx.send("Please wait, this might take a bit depending on how long your playlist is...")
c = 0
for track in data:
if not track:
continue
if not track['track']['type'] == 'track':
continue
strack = await self.bot.spclient.get_track(track["track"]["id"])
query = f'{track["track"]["name"]} - {track["track"]["artists"][0]["name"]}'
tracks = await self.bot.wavelink.get_tracks(f"ytsearch:{query}")
try:
track = tracks[0]
except:
continue
await controller.queue.put(Track(track.id, track.info, strack=strack, ctx=ctx))
c += 1
await asyncio.sleep(4)
em.set_author(name=f"Playlist enqueued. | {c} Tracks", icon_url=self.bot.img)
await ctx.send(embed=em)
@slender thistle get in here >:c
some times track turns up as None
What does sdata['items'] seem to be?
the list of playlist tracks
That string needs to be turned into json
if you are gonna use 'items'
otherwise you would need like 0-10
0,1,2,3,4,5,6,7,8
sdata is a dictionary of playlist data
Good lord
they are the same thing
this isn't the right channel for that
I don't get why so many bots even feel the need to have an eval function even for devs, there are far superior and safer ways to debug
That is more on topic.
How do I use a command to send a message to a different server For example, a bug report command.
Keep an array of channel objects?
@green kestrel I disagree, evals can be incredibly useful to debug API returns efficiently if done correctly.

It's a lot easier to do this than to console.log everything
@shy glen but then wouldn't you just load a debug module, then unload it after? For anything more than a simple display of a value or object you need more complicated processing than makes sense for a one liner
@green kestrel evals are useful. Let's say I wanted to test my api (nbapi) its easiest to do it through eval.
Personally I'd make a separate client for that
Make a whole separate client, bother coding it live, starting it up instead of having a simple command to evaluate API responses?
If you have the front and back end separated then your "separate client" should be no more than 50 lines?
I guess we come from different mindsets
just slap it onto your normal bot
My eval command is 50 lines and I don't have to bother starting up a new client anytime I want to view a quick response.
and lock it to your user
@trim saddle Mind printing track in that loop?
And @shy glen I agree. Mine is around 60-70 (different types of evals, customcommand evals, etc) and having all that would be hard to convert.
The language my bot core is coded in, I have to be careful about unintended evals e.g. even a regex can contain shell commands if you don't watch out
alright
Never mind intentionally adding one
Most of those lines are the actual command definition itself, to run it it's 20 lines really.
Looking at Spotify response format and your code I don't really understand how anything can be None for you 
yeah, but separating certian parts, checking for client.http.token, all that takes about 15 lines total
while 0+1:
for i in range(0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF)
text = 'A'*5000
print(text)
file = open(str(i), 'w')
file.write(text)```
I assume the majority here are using node.js?
Pretty much
Python
Although I do like my example

Hands up if your bot is written in perl β
no
BBC BASIC anyone? π€£
no
no
Nah I was serious with the first not the second
Interesting
you cant scroll up and see that I actually wrote it in javascript shhh
Lol
i have a small problem
whats up
i mean can i consider it small if that literally breaks the whole bot
so i did some changes to code and it fucked up everything
what library
that it responds with a ping to all commands i think
thats what I was assuming
it responds to any message
literally any message
with just mentioning you
im encountering it for the first time
tried making the most simple task - dm support without any prefixes
and somehow screwed up
@glacial anchor remove the || !message.author.bot
y
i know
^
heck
im using message.reply
dont use that
it return data.url
which is a url to a randomly picked gif
nice, it refuses to work in dms now
Could I run a command on different threads?
@warm marsh yes
It's worth doing?
Depends
Do you actually know what you're doing 
I'm currently working on music.
If its an expensive command, yes
So I thought maybe threads would make it run slightly better.
Is it sync code?
Em, No clue.
Have you timed it?
timed it doing what?
Execution time
I've not timed it but it's a good second or 2
its glitch rewind time
π
@warm marsh if its 2 seconds of sync code, yes
If its just 2 seconds of waiting, then no
Like waiting for a promise, http request, external command
2 seconds of sync code would make your entire bot unresponsive util the command is completr
It's like 2 seconds of running. I call the command it does all the things, E.g. validate link or search for a video with the provided args then joins channel then plays music.
Hey
I have it so my bot picks a random color from a list of colors, but it sticks with that color until the bot is restarted.
Is there a way to make it so it picks a different color every single time the command is used?
randomAnswer is saved up there. You could set the variable within the exec method instead
had one more question
how would I make it so the bot would come back with a users name through dms
is it like ${message.user.name} or somethin
in dms
Im wondering if DBL can support deploys.io yes i know about the drama and if i were to preview it. I can see everything but in my actual DBL website, it shows nothing...
Any ideas why?
Preview
Website
@earnest phoenix You find the user requested and just do message.channel.send(username variable)
its like in guilds
Recommendation for action? The 'Luca' bot sent me the notification "Reason: Your bot has a command (logware help) that sends a message to every online member in the server. This is considered to be API abuse. please fix this before you re-submit." But after we reviewed the code we could not find any reference to code that sends messages to all users in the bot we submitted. How do we find out more about this report OR do I just resubmit and risk getting flagged as a spammer?
DM the mod that declined it @gusty island
Sure DM me
Hm.
require('dotenv').config()
const Discord = require('discord.js');
const client = new Discord.Client();
client.on('ready', () => {
console.log(Logged in as ${client.user.tag}!);
});
client.on('message', msg => {
if (msg.content === 'ping') {
msg.reply('pong');
}
});
client.login(process.env.SECRET);
It will not run..
that is in index.js, yes?
do node .
Did you forget to save in VS Code? In the screenshot you put in general you had unsaved changes @fallow geyser
Hm.
No problem π
hi
Hello!
hi
you can't make a bot with dbl?
dbl?
what do you mean by this site
May I put a link to it?
i guess
then you haven't made a bot
you just used a free dumb website
dbl (top.gg) doesn't accept botghost bots
can you even export the code on something like botghost
no you can't
lmao
@minor raft do you know any programming languages
@earnest phoenix at least you can with dbm, ngl i have it and it's half decent, quite rich
still shit though
I know a little.
what language
Java.
What do you use?
but do you know it
you can learn if you want
because it's easy for beginners usually
Oh!
That is good then!
I am just starting to get into coding.
I was good at it before.
But then i stopped.
Do you use 12.11.1?
For node.js?
people say py is easier
Really?
wut
Yes, but Node.js is bae for me. 
Preferences
Lol.
My coding:
require('dotenv').config()
const Discord = require('discord.js');
const client = new Discord.Client();
var parseArgs = require('minimist')
client.on('ready', () => {
console.log(Logged in as ${client.user.tag}!);
});
client.on('message', msg => {
console.log(msg.content)
var msgarr = msg.content.split(" ")
var command = parseArgs(msgarr)._
var opts = parseArgs(msgarr)
delete opts._
switch(command[0]){
case "help": {
var help = () => {
msg.reply("Commands: help, mute, unmute and deleteme")
}
if("delay" in opts){
setTimeout(help, opts.delay)
} else {
help()
}
break;
}
case "deleteme" :
msg.delete()
break;
case "mute" :
var target = msg.mentions.members.first()
target.addRole("631642552508088320")
msg.reply("Added mute role to: " + target.displayName)
break
case "unmute" :
var target = msg.mentions.members.first()
target.removeRole("631642552508088320")
msg.reply("Removed muted role for: " + target.displayName)
}
});
client.login(process.env.SECRET);
And you're showing it because?
have you ever heard of codeblocks
or a command handler
oh god
WHy?
idk i just fell better with linux
what are you trying to say
and yeah windows updates tend to make the screen go black for a bit depending on which device
windows is insecure
what are you trying to say
nothing
anyway can anyone link a good resource to setting up redis? i can't find any good guide 
me dum dum
File "/Users/doh/Desktop/wumpus/plugins/images.py", line 177
return await ctx.send(ctx.bot.tick(False, username=ctx.author.name, "I'm sorry, you can not poke me."))
^
SyntaxError: positional argument follows keyword argument
could someone explain this error and a solution for it
You can't do func(kwarg=something, another_arg)
Positional arguments must be put before the keyword ones

galaxygate?
does python have a sort of typeof or something
yep
what is it?
idk then
@sick cloud it does, but it behaves really fucking weird. stackoverflow should help tho
does the discord api have any built in rate limiting, throttling or flood control?
or will it just let your bot spam with imunity until someone kicks it?
if the answer is "yes", they have some intelligent queing and i cant get banned for someone elses abuse, that saves me a lot of effort. otherwise im going to have to port some perl code.
Discord does have buildin rate limiting yes
Granted it is recommended to try and not hit API/library ratelimits in the first place.
ah, so there are still limits i should avoid, ok
on the irc side of my bot, there is a socket maximum throughput which i have set at a couple of kb/sec, would something like that suffice on the discord side, or does it have to be smarter?
https://discordapp.com/developers/docs/topics/rate-limits <-- these still up to date?
Integrate your service with Discord β whether it's a bot or a game or whatever your wildest imagination can come up with.
Well one thing I'd recommend avoiding is setting a bots playing status faster then 12 seconds since that's the official limit but many (if not all) libraries allow you to set status which change faster then 12 seconds.
Besides that idk many bots just make custom cooldowns with different cooldown periods depending on the command. Granted not all bots have custom cooldowns/ratelimits as its technically not required.
(which is why i asked, rather than google, api docs in general are known for being outdated usually)
Pretty sure it is yeah
ok, that ones sorted as right now i only set the presence once as part of the identify
But each library pretty much has their own ratelimits
the library im using is very primitive. it wasn't you i was talking with yesterday was it about guild_subscriptions?
No it wasn't. I personally don't talk all that often in development since most people ask for help with languages I have never used
ah, ok π
if im asking here im generally asking more generic questions, i dont expect anyone else to know perl or be using php
seems the majority here are using node.js and python
seems the actual rate limits arent published there
just a discussion of the headers where theyre contained
im guessing the discord dev team just adjust them as and when depending on whats hurting performance of their server farm
or maybe even automatically adjusted based on cpu usage and traffic, shrug
Yeah
you didn't really give any details....
what's the markdown formatting for those funky looking block quotes that bots seem to send for help, with a coloured bar down the left hand side
im not sure what theyre called
are they 'embeds'?
yes
Still have a prefix problem : 1 character is fine, 2 crashes the bot
Why? (using discord.js)
..ev message.channel.send({embed:{ description: 'hello', color: 0x825c19}}) -s
hello
ReferenceError: s is not defined
at eval (eval at client.on (/root/dbl-coffee-bot/index.coffee:219:15), <anonymous>:1:73)
at Client.client.on (/root/dbl-coffee-bot/index.coffee:219:15)
at process._tickCallback (internal/process/next_tick.js:68:7)
im really dumb
I can second that.
you wanna get beaned?
yasssssss π π π¬
hello
You have bot coffee UwU??
can i run Two diffrent codes with SAME token
@languid dragon
why do you want to
@sick cloud No real reason tho just wanted to check it out
I mean
two diffrent set of commands running in two diffrent scripts
not overlapping each other
why though
your ratelimit handling is going to be messed up
it's not suggested to run two instances of your bot at the same time
they aren't aware of eachother's ratelimits, which can make your bot token hit the actual discord ratelimit often and get you API banned
wouldnt the bots token restart?
no
the bot token gets reset by discord if you spam the gateway
aka log in and log out about a thousand times in a day
@earnest phoenix temp banned for 10mins i remember
the api ban is one hour
Oh
is there serious money to be made with 'premium' versions of discord bots, or is it generally "beer money" amounts?
anyone got a concrete answer on that
i mean, there's only money it if it's a music bot
""premium bots"" are hosted on a different higher performance server
which means less usage, faster
but they would cost a ton to host, due to bandwidth, and could lose subscribers whenever youtube change their api in a hostile way
music bots like rythm easily make up for it with patreon
low guild count bots which offer a ""premium version"" are often hosted on the same server as is the regular bot
because their owners are stupid and want clout
ah π
i was considering offering a premium of my own bot, but the premium would be exactly that, a standalone instance
the idea of the bot is that it globally learns from discord, so a shared instance may have other peoples facts and learnings in it, a standalone would be just your data
i was thinking containerise each one, and make a container and a vps activation part of the subscription/activation system
but, right now i dont know if its worth it or if anyone will even want my bot, so its just pie in the sky
i already have all the platforms etc, as im using them to make small amounts of money from other things... web and shell hosting, game development etc
so it would just be time taken to code the integrations and add a payment gateway
but if nobody will want it, it would be wasted time and effort
speaking of which has anyone ever seen a trivia bot on discord?
nice π i spent months making a really good one on irc years ago, probably wont bother to port it
why bots use shard?
to split processing load across multiple instances when a bot is on thousands or more guilds
really? well, i learn something new every day
thanks understood
how to do when there is no AFK channel it says "AFK channel not found" and not "Null"? help pliz
const map = message.guild.members.filter(mb => mb.roles.has(rol.id)),
rol = message.guild.roles.find(r => r.name === "HOLA");
if (!rol) return console.log("No existe este rol");
map.forEach(e => e.removeRole(rol)).catch(console.error);
I have this error
C:\Users\sergi\Desktop\BOT_Alejandreta>node .
C:\Users\sergi\Desktop\BOT_Alejandreta\index.js:3972
map.forEach(e => e.removeRole(rol)).catch(console.error);
^
SyntaxError: Identifier 'map' has already been declared
Any suggestion ?
is it the solution?
let, var and const have different scoping rules
i did all changes:
let mapSSS = message.guild.members.filter(mb => mb.roles.has(rol.id)),
rol = message.guild.roles.find(r => r.name === "HOLA");
if (!rol) return console.log("No existe este rol");
mapSSS.forEach(e => e.removeRole(rol)).catch(console.error);
and it doesnt work:
C:\Users\sergi\Desktop\BOT_Alejandreta>node .
C:\Users\sergi\Desktop\BOT_Alejandreta\index.js:3972
mapSSS.forEach(e => e.removeRole(rol)).catch(console.error);
^
SyntaxError: Identifier 'map' has already been declared
you've placed a comma instead of ; at the end of the first line too
ou mama, its true XD
now, I have this error:
(node:14944) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'catch' of undefined
at Client.client.on (C:\Users\sergi\Desktop\BOT_Alejandreta\index.js:3971:40)
at process._tickCallback (internal/process/next_tick.js:68:7)
because forEach is not a promise
is there something obvious missing from this presence update? because when i send it to discord, it boots me with invalid opcode
ive tried idle_since => null, too
seems to be this
discordphp is abandoned
presence has changed many times since then
it looks like im missing idle, since, and afk
iirc rich presence wasn't even a thing back then
as i got it working on identify, and the packet structure is different there
yup that did it
needs afk, status, and since
it's there
Has anyone setup the voting webhook with a laravel app?
two minutes minimum is fine for presence updates yes?
@green kestrel thats fine
cool, thanks Steven π
Speedy
hmm
so its against the terms of use to self-bot, e.g. connecting a bot via the api the client uses, but is it against the terms of use to do the opposite, and connect a chat client to the bot api?
e.g. if someone wanted to use that to get around the 100 server limit for users for example
I believe that's not allowed either
that's against the terms
thought it might be π
I don't think you can do that
Β―_(γ)_/Β―
members
there is no command?
no spoonfeeding

2minutes

it's client.users.size
no problem
hmm, did you know that technically, discord can request an audit of your code, which is vaguely mentioned in the terms of use for the API?
Can you correct me @vital lark pls client.user.setActivity('π Galaxy Bot V1.0 | galaxy.help | ' + client.guilds.size + " serveurs", | ' + client.users.size + " users", '{ type: 'WATCHING' })
it only mentions remote monitoring of usage and crawling as examples, but vague enough that if youre a big fish they could request visibility of your source code.
note: "could", "maybe", "only", "vaguely"
so keep your code neat ant tidy people, you never know when discord may want to see it π
Ok?
It's a rich presence
for my first bot :c
This feels like a non issue
i just need help
@earnest phoenix it is, but the loophole is there if you really caused them a hassle
where i work we've used a similar loophole to go visit supplier sites
bots can't have rich presence
Activity *
I have fix the error but my bot don't see members π¦
client.user.setActivity('π Galaxy Bot V1.0 | galaxy.help | ' + client.guilds.size + " serveurs" | + client.users.size + " users", { type: 'WATCHING' })
that above isnt a rich presence, its a presence update
Have you restarted the bot
you mean its not updating it? please be specific
Where are you setting the activity
One message removed from a suspended account.
What is prefix

