#development
1 messages · Page 712 of 1
If anyone has a better way to do discord marriages please let me know as anything is helpful.
just use an embedded database like sqlite
how would I do that and implement it into my code
Like I said. I never have messed with database stuff and SQL stuff
Any idea regarding making a bot auto-detect selfbots?
Altdefender?
Using the Discord API is there a way to change the expires_in of a access_token?
I’m trying to make my own auto-moderator bot, lol.
Check user response time with message length?
^ and/or check status changes, nickname changes, time between messages, etc
I am just gonna not do anything with SQL anymore as it is just way to out of my range and I don't have time for it.
nothing is working
Big oof
Like I want to pull my hair out
Just do it?
What's so hard?
Hey guys, I’m having an issue where my bot ends up DM’ing the wrong people even though my code explicitly does not allow for this to happen
discord marriages and setting up a SQL database for it and having it work without giving me an access denied error
Like, the command takes two users and immediately DM’s them yet somehow some random user who uses the same command around the same time may receive a DM meant for someone else
someone does a command like +marry @granite pagoda and then it "gets them married" or something like that
Only one mariage or multiple allowed

should just be one allowed per person
Idk seems easy, just have column man and column wife and store user ids
I could help but on mobile so rip
I have extensively, basically it works like
‘;fight @earnest phoenix’
And the bot will DM the person who wrote the command, and the person who was mentioned.
The code just immediately DM’s them using ‘user.createDM()’ and ends the command. How could it be sending messages to the wrong people if everything is taken care of in a single call?
show code
Ok, hold on a second
@near ether you are probably using global variables accidentally
Hello
I was wondering if I could make it so doing ;addtochannel <member> would give that member access to read the channel
how would I go about doing this?
permission overwrite
I searched (ChannelUpdate) and ChannelEdit in d js docs and I couldn't find i
`currentTurnPlayerDM = await challenger.createDM();
opponentDM = await opponent.createDM();
let responseEmbed = new DiscordJS.RichEmbed();
responseEmbed
.setAuthor(opponent.tag, opponent.avatarURL)
.setTitle(Choose your move!)
.setColor("#fff000")
currentTurnPlayerDM.send(responseEmbed)`
because you don't know how to use docs
ok...?
meant for @quartz kindle and @cobalt umbra (sorry for ping)
is there anyway to avoid checking a == 0 || b == 0 twice ?
store the boolean returned in a variable
ah i see
@near ether
are you defining those anywhere else? using var/const/let
if not, then those are global variables
and will be affected by multple users using it at the same time
hmm maybe if i drop the ``` printf("invalid input received");````
okay, thank you my dude!
let ensures they are locked to the current scope
would you mind explaining/sending a link to why not having one of those prefixes leads to the creation of a global variable?
@earnest phoenix do you think it's possible ?
when you declare a variable using var/let/const, it will be created in the current scope
if you omit that prefix, it will attempt to find and modify an existing variable with the same name
falling back to the global scope if no variable exists
how do i prevent scanf from overflowing
it's not preventing my app from running or anything
it's just really odd since i'm catching errors and it's not an unhandled one
ok if this were github id probably comment something like "i'm retarded" but the issue was my logger logging every single error 

@valid frigate your just printing error.stack and not error.message
alright so
i’ve been trying to make a balance command using discord.js
but can’t get one that works
does anyone know one that i could use?
lol chewey
i was using a custom error that didn't pass message 
dw it's all good now
I am trying to pull the users the bot is working for, but I am getting errors. How to do it?
I tried with client.users.size which is not correct.
wym not correct @dark oak
It’s inaccurate
client.users.size has a system called cache
"Without the client option fetchAllMembers you will not automatically cache all users in all guilds. Your cache will gradually fill up over time."
Ok. I’ll try like that now
method doesn't exist anymore. That quote is from the https://github.com/discordjs/discord.js/issues/2367
anyway looks like you have to wait for the cache to fill up
How do i make a good support server?
Channel for help, channel for suggestions, channel for logging updates, general channel. I don't see what more is needed
Solid
I was gonna do a faq
yea that too. I have that as a bot command but can come in handy to have too. Good idea I'll add it to my guild 
Is there a point to using a sharding manager as opposed to internal sharding?
module.exports = {
"help":{
"name":"rebus"
},
run: async (bot, message, args) => {
const qa = [
["https://www2.stetson.edu/~efriedma/puzzle/rebus/1.gif", "Tester"]
];
var rand = (Math.random() * answers.length);
var question = qa[rand][0];
var answer = qa[rand][1];
var embed = new discord.RichEmbed();
embed = embed.setTitle("Rebus Puzzle").setImage(question).setDescription(answer).setColor("#02fa4d").setFooter("Ice Cream - Made by BiggestPotato");
message.channel.send(embed);
}
};```
```ReferenceError: answers is not defined
at Object.run (C:\Users\BiggestPotato\Desktop\Corebot (5) - Copy\commands\rebus-wip.js:11:33)
at C:\Users\BiggestPotato\Desktop\Corebot (5) - Copy\index.js:388:33
at FSReqWrap.readFileAfterClose [as oncomplete] (fs.js:511:3)```How do I fix this?
have you considered defining it
You define answer after you use it
var rand = (Math.random() * answers.length);
var question = qa[rand][0];
var answer = qa[rand][1];
answer is not the same as answers too btw
is there a way to announce all the servers that the bot will go onder maintenance for 2-3 days starting the day etc?
well I can't do that to take out the helper command
so, ive seen a mention thats like <@nnnn> where nnnn is a user id
what's a mention like this for? <:aNgErY:514287724031639582>
saw it in my debug screen
ive also seen a mention that starts like: <!@nnnn>
is it a server specific avatar?
That's custom emotes
ah ok, thought so after looking at it some more
and <!@userid> is a nicknamed user
Can anyone help me? I'm having a problem with translate command, the error says 403 Forbidden. Here's my code
can u just upload to hastebin pls
k
good luck with help tho
@heavy void the variable text holds one string so if you were to run translate hello I want to translate this text en jp text = hello
kinda hard to explain but it's how you parse args
Yeah, I'll just do const text = args.slice(2).join(' ');
So do u have any idea why the error says 403 Forbidden?
I already put my api key there
Forbidden means it cannot authenticate, an invalid key would be 400 i believe
401 iirc
just checked, invalid key is 400
it is``` "code" : 400,
"errors" : [ {
"domain" : "usageLimits",
"message" : "Bad Request",
"reason" : "keyInvalid"
} ],
"message" : "Bad Request"

"Invalid key" is a part of "Bad Request"
for what are you trying to use it?
Translate ^
lemme check
I put my google api key but still says 403 Forbidden
Yes
DMs cause I need to sleep in 5 minutes
wag1
check if the command exists first
HOLA
hello
Y'all should make a Development category, and separate the languages into channels.
JS, Java, Python, Other.
unnecessary imo
Unnecessary for JS devs, sure.
yikes here we go with the language wars
channels would often be unused
what channel would you put something like 'hi can anyone help me with api design'
How is it a war? I'm just saying most use JS, I enjoy giving a hand with Java. The posts get swallowed up though.
then you can either directly contact someone who knows java or ask in java related servers
DBL is full of people who don't care what channel they're in
yeah, look at the people who advertise in #topgg-api
So there's my point Cyber, Why do Java devs have to ask in a different server but JS devs get plenty of assitance here.
because js is more widely used
there are no rules against asking java questions in this channel
Most people here use JS but you are always welcome to help anyone who codes in Java (even though there aren't many Java questions here overall)
in fact there are quite a few people who could help with it
I'm not asking for help. I'm saying I'd like to help in this server, as I do in others.
But the Java questions I see in here go unanswered and by the time I see them, they are too far up.
Generally speaking of course.
then you can ping the person who asked and provide an answer
While that might look convenient, the way of moderating those channels will be far worse than it already is
or you could just go in discord-api
Depends on how many exactly we're talking
is java really that widely used for discord bots as js and python
No, not as widely used, but it's a great solution. I'd like to have more people use it.
@mossy vine no
so having a channel for java help = more people using java or am i completely missing the point
Yep.
Anyone who comes here new, would see the dev chat and just assume JS is the only way to go.
That's mostly false but yeah.
that'd not be too many new channels, I agree. However, DBL community isn't really that smart overall when it comes to stuff like this.
Like I said before, #topgg-api is a good example. And DBL isn't really mainly for help with bot development, either.
So shouldnt we try to better the community and offer real help, not
?
JS is all spoonfed.
Also some people might still believe that Java is the same as JavaScript at some point, soooooo

yikes
So having two channels would help that notion I guess? lol.
Is there people who think that?
Definitely there will always be people like that
oof.
As quarter/half the bots listed on DBL are made with bot makers or are copies of public bots
Anyway, you say dbl community isn't that smart. Segregating channels would be a good way to help with that. As I said, I love using Java as a solution due to it being a full-featured OOP language.
Learning how to use a language that uses OOP is a great stepping stone for people.
no language wars here nah
no not at all. You literally just get asshurt every time someone talks about pros and cons
😢
Where am I insisting a language war?
As I said, I love using Java as a solution due to it being a full-featured OOP language.
Learning how to use a language that uses OOP is a great stepping stone for people.
Not really sure about the segregating channels tbh. Might work out. Only one way to find out, but then again, I'm just some fucking guy.
We're all just some guy haha
you say js is all spoonfeed and start praising java. idk im pretty salty rn
Im just some guy making a suggestion
You seem salty af
Generally JS resources are spoonfed. Is that out of line to say?
It's true.
no, i mostly agree
So why are you disagreeing?
I'd like to put my 5 cents in but I'm python 
its not all spoonfeed by a long shot
Go to #python-development @slender thistle !
oh wait.
No of course not Cyber.
No one said that.
sure
Eh, I personally wouldn't use that channel much as there isn't that many py devs in DBL who need help with it.
People could get salty seeing a help channel for one lang but not for the other, which could lead to fair fuckshow of itself, imo. 
And creating many help channels isn't something a bot list really needs
😳
ooka ooka
Sounds like a suggestion that might've worked out if DBL community wasn't salty about everything

yes but we are salty about absolutely everything
Apparently
Exactly 
How does that advance the knowledge of a community.
¯_(ツ)_/¯
Tfw you assume most js bots are spoonfed, but disregard every bot that isn't spoonfed because you are attempting to show that java is better than js, which is an opinion.
you definitely acted like it
js is the future? we are fucked
real developers write discord bots in C++. ducks
JS is the future, yes. Fullstack development is taking the world by storm.
today i learned, the big two, dyno and mee6, are written in javascript/node.js
You're suggesting to have multiple channels because certain languages aren't used as much meaning those kind of questions can end up getting burried, that logic means all unpopular languages would require a channel? That's a lot of channels, no?
im often surprised at the scalability of node
no. I said JS, Java, Python, and Other Languages.
If this server was aimed at being some kind of development help server it would make sense to do something like that
On here, meh.
it might make sense to consider different channels for different libraries and/or languages, until you realise the js and C# ones would be rammed, and the rest would be ghost towns. i'd be all alone in the perl and php ones.
actually, mee6 uses a variety of languages for different purposes
Why not aim to be as inclusive as a community as you can be?
Libraries would be too many Brain, Java alone has three major ones.
@mossy vine im using two languages, as i have a backend and frontend process
it lets me update the bot with no visual impression of downtime
Okay Ricochet, then lets close this channel
ok
There's a big difference between 1 channel and 10?
Why have it at all by that logic
😂
you don't even know what you are saying now lmao
1 channel = manageable... 10 channels = an admin/moderation nightmare
I've asked questions about java in this channel
they get tons of funky people
And have always gotten a reply
It just took a little longer than my JavaScript questions
i think ive only ever asked generic api questions
I've asked a few questions here
I always make sure to look up something before I ask it
my problem is ive chosen a broken and unmaintained api and decided to fix it, because its lightweight and simple
Sit down you masochist
so im less asking "how do i do X in api" as to "the code i have is sending X, should it send Y"?
@slender thistle shhh, i like pain
🤣
just make your own api 😎
node is great tbh
by the time im done, what i have will basically be my own library fork
code your thing efficiently and you can run 20k guilds in a single node process
I'm running 15k guilds per node process rn
Usually I use js because it isn't strict, kinda faster to code
@sinful lotus you can, but should you? isnt that why we have sharding?
4 process 61 shards 👀
\o/
make it 69 shards 😎
Less process = Less Ram Overhead
even node is great, spawning a new process costs more memory
specially with duplicates on your cache
you know the thing
so I run as less as possible
What dbl mean ?
Besides as you can see, I don't even stress my system.
discord bot list
i once wrote a C++ server program that worked a bit like node does... years before node was a thing. people said 'it will never scale', it did, very well, which is why i'd never knock node's performance
it's all about socket engines and non blocking multiplexing imho
Ok
you have a lot of ram on your server
yeah i'd offload it to a queue in an sql database and batch it out to something else
as long as your code is async, your event loop will usually be ready to handle the next process
Yes, doing cpu intensive applications on node.js is where node.js do not excell
but offloading it in another process or probably "programming language" and just use node to serve or parse it
its fine
my dev server has 16gb ram, and jira is taking half of it
i'm considering moving my bot to my live server now, it has 16gb too but more of its free, and a much faster connection
I got 3 dedicated
one with 40 cores and 32gb of ram
one with 16 cores and 24gb (that server)
one with 8 cores and 16gb of ram
the 40 cores is sponsored so I just pay the 2 below
sponsorships lucky you, i pay £70 a month for my own dedicated server at OVH
im thinking of getting shot of it and downgrading to a £30 a month at digitalocean
for dev i had a dell T310 in my utility cupboard at home
like for ex: when their power gets cut or etc
but internet wise
its a 1gbps verizon fios
so I use it as our main music node
Do companies not do colocation anymore?
the sponsor ship I have is not from a company
its an individual person
its his personal server
and he dedicated half of it to us
although we share 1 ip so I always ask him to open ports
thats why I have 2 other dedi servers
so if I need to open a service or port
it would be hassle free
Yeah I mean, used to, you could rent space from dedi providers with YOUR hardware.
So you basically just pay for reliable power/internet.
or if you want if you have capable internet at your house but with dynamic or cgnat ip, you can buy a cheap bandwith sufficient vps and use ssh tunnel
so you can host webservers from your home
Oh that's a pretty good solution to get around dynIPs
yes since I usually ssh tunnel from my router
so our whole home network would get routed
and goodbye cgnat ip from my provider
Not bad
colocation is a pain in the bum
because in reality, buying a static ip is more expensive than renting a cheap vps in my place
you have to purchase hardware, in the event of a raid degredation you have to drive to the dc with new disks
I live in the country and my internet is unreliable as all hell.
I have a 20' antenna in my backyard running to a 4g modem with a t-mobil simcard in it lol.
I couldn't host anything.
and youre responsible for installing it etc
I recently got fiber, 25/25 for 25 dollars
it makes more sense to rent a dedi
with a cgnat ip
ew. cgnat.
I'd kill for 25/25 lmao
we are lucky they expanded on our place
so now I use my laptop to ssh tunnel to my server
and host things on my laptop
But you're still limited to 25/25 lol.
it sits in a utility cupboard above the washing machine and freezer connected to 110mbit down, 15mbit up internet
better than having a cgnat ip
cgnat is arse
I don't have to deal with it being on a mobilke network AFAIK.
Everytime my modem restarts I have a new ip though >.>
Have to rewhitelist myself to my servers
PITA.
I believe mobile networks widely use cgnat, but when you restart your connection, it connects you to other cgnat system
so you get a new public ip
while on my fiber, even I restart it, Im stuck on the same internal ip and public ip
I havent seen fiber being sold with speeds that low around here.
Usually fiber starts at 100mbps in the states
while 25 mbps for 25 dollars is the best deal you can get in my place
the big telcos charge 30 dollars for 5 mbps in my place
🇵🇭
yikes.
in mongo is it possible just to say if something exists at all? cuz like atm i just have to fetch all and filter as such, the issue is its just an object with different values so i cant tell if it exists or not but i can filter by values which is annoying
so like rn i have to do js (await client.database.collection('map').find({}).toArray()).filter(x=>x.city)
I read that as sexists help me
time to turn you into a computer so you know the difference of S and $ better.
neuralink isnt that far away
Neuralink is most likely not going to be compatible with me.
we didnt try yet
what would be the best way to reward users for chatting but also discourage spamming?
make an exp system but the more posts a day the less exp they get

hmm
xp/msg but not more than 1 xp grant/min and not more than 30 xp grants/hr
One message removed from a suspended account.
thats pretty vague lmao
One message removed from a suspended account.
One message removed from a suspended account.
have you tried debugging your code
add log statements
see if it is reaching parts in your code as you think it should be
One message removed from a suspended account.
i dont know what that means
One message removed from a suspended account.
Basically when you do the command it doesn't respond, there is no error in terminal
@sage bobcat Have you done a .catch to it
if that is the way it works
One message removed from a suspended account.
One message removed from a suspended account.
send the repo ill take a look
One message removed from a suspended account.
so i would add log statements to your on message event
for example
if (!message.content.startsWith(prefix)) return;
prefix is not defined at this point
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
i would still add log statements
see if you are getting the right values for things
at least that is what i would do
await channel.send(file=discord.File('nekos/' + str(neko2) + '.png'))```
Am I doing something wrong 
@west spoke how large is the file you are trying to send
Lemme check
I mean
If I'm able to send without nitro

8.48mb @eternal mesa
This image
that image you just sent is <1mb
Same image
perhaps however you're uploading is compressing it somehow
but your bot is trying to upload it raw, and it's too large
shrink it below 8mb on disk
doesn't matter what it is as long as it's <8mb

i dont really know in this specific situation what is happening
but the limit is 8mb
You can up the limit for nitro boosted servers
the cdn I may be missing some context, which cdn? Discords?
Well if you catch exceptions, on a 413, you can error out with a message like "File too large" or you can do checks beforehand.
Or if these photos are accessible through a website, like if you have your own cdn, you can post the link, it just wont embed.
@west spoke Isn't that >8 MB
but the limit is 8mb
well yes, but no
the limit is 100mb
it's just locked
by boosting perks
why do you need it do be 3000x4000 lol
at that point you can use waifu2x
Who said 3000x4000
help
ask2ask
-----> Creating runtime environment
NPM_CONFIG_LOGLEVEL=error
NODE_ENV=production
NODE_MODULES_CACHE=true
NODE_VERBOSE=false
-----> Installing binaries
engines.node (package.json): 10.x
engines.npm (package.json): unspecified (use default)
Resolving node version 10.x...
Downloading and installing node 10.16.3...
Using default npm version: 6.9.0
-----> Restoring cache
- node_modules
-----> Installing dependencies
Installing node modules (package.json + package-lock)
audited 140 packages in 1.345s
found 0 vulnerabilities
-----> Build
Running build
> discord-bot@1.1.2 build /tmp/build_23ba1adc7ef26e60fb447e95ca413f5b
> my-framework build --output public
sh: 1: my-framework: not found
npm ERR! file sh
npm ERR! code ELIFECYCLE
npm ERR! errno ENOENT
npm ERR! syscall spawn
npm ERR! discord-bot@1.1.2 build: `my-framework build --output public`
npm ERR! spawn ENOENT
npm ERR!
npm ERR! Failed at the discord-bot@1.1.2 build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /tmp/npmcache.wOib6/_logs/2019-10-14T15_40_44_398Z-debug.log
-----> Build failed
We're sorry this build is failing! You can troubleshoot common issues here:
https://devcenter.heroku.com/articles/troubleshooting-node-deploys
If you're stuck, please submit a ticket so we can help:
https://help.heroku.com/
Love,
Heroku
! Push rejected, failed to compile Node.js app.
! Push failed```
I'm trying to deploy but its not working
sh: 1: my-framework: not found
is it better to write docs as you dev or at the end
Discord.js trying to see if words rhyme if not delete - https://www.npmjs.com/package/rhyme-plus#rdorhymeword1-word2
**My code **
//Check Rhymes
const rhyme = require('rhyme-plus');
client.on('ready', () => {
const channel = client.channels.get("631451610408681472");
if (!channel) return;
channel.fetchMessages({ limit: 1 })
.then(messages => {
const msg = messages.first();
if (!msg) return;
if (!msg.content) return;
lastMsg = msg.content.toLowerCase();
});
});
let lastMsg;
client.on('message', message => {
if (message.channel.id !== "631451610408681472") return;
if (message.author.bot) return;
if (lastMsg && !rhyme.doRhyme(lastMsg, message.content)) return message.delete();
lastMsg = message.content;
});```
**ERROR**
```js
TypeError: rhyme.doRhyme is not a function
I dont get why ...
@heavy marsh just looking at the lib, you need to use the 'rhyme handle' to execute on
Take a look at how the examples work
var rhyme = require('rhyme-plus');
rhyme(function (r) {
console.log(JSON.stringify(r.findRhymes(['bed', 'read', 'feed'])));
});
like this
cant you use arrow funcs for that
Is JS a good language to use if I plan on making a bot that utilised a data base for auto-moderation?
Go by what language you are comfortable in
Opps nvm
I’m going with python, but a while ago someone stated that JS is not a great language for auto-moderation due to its single threaded nature.
https://stackoverflow.com/questions/58385988/heroku-is-not-displaying-correctly
This is the info I am submiting to recive help.
Is there a discord api method to check if a user is dm-able?
like I want to check if my bot has perms to dm a user
without actually dming them
Not sure, I just use try catch
yeah but i don't actually wanna dm them

I asked Gods they said there is no way
so large bots can reach the 10k temp ban through not being able to dm users
how would i get npm packages that "require" glibc to work in a docker container running on a node-alpine based image?
i see
module.exports.run = async (bot, message, args) => {
message.delete();
message.channel.send(":ok_hand: :weary: :ok_hand:")
}
hopefully obvious question
how do each of you store your api key for your bot's use?
process.env
do you hard code it into the bot source code, do you have a config file? environment variable? db config?
config.json
env
.json config is easy to be exposed
A methodology for building modern, scalable, maintainable software-as-a-service apps.
read this
unless that is .eslintrc
Apps sometimes store config as constants in the code. This is a violation of twelve-factor, which requires strict separation of config from code. Config varies substantially across deploys, code does not.
currently i have a .ini which is in "../config.ini" in relation to the bot's directory. i was contemplating an environment variable, but then i still need to store that key in a .env in plaintext so its no better either way right? my config is outside of the application directory.
config.json is a file basically full of constants
ah if you have access to something similar to process.env like in node
store it there or use like a .env file
used that
mm
especially if you're going to be using more env variables
with node you can set it like NODE_ENV=production node app.js or something from the cli but that obviously gets tedious after a while
i think i have eight api keys now
one for discord, and seven different bot lists including this one
php laravel has .env files for config
theres only one problem, everyone seems to stash them in webroot.
Hello! Im coding a Bot with java and want to implement a Tag System. For the b#tag renane [old Name] [new Name] i have to rename a file. But he always send the message Tag existiert nicht wich means in english the tag doesnt exist but the file exists in the correct Folder. Any ideas why it doesnt work?
basically: don't be these guys: https://www.google.com/search?client=firefox-b-d&q=DB_USERNAME+filetype%3Aenv
🙂
@violet moss I'd recommend using a database
On top of that
Seems like a vulnerability in there
What if I use "../" in my argument
Will your code check for this or
Can I just freely go through all your files 👀
As for the actual issue I think it might be that you're checking for a file that's entirely lowercase while some of the files in the directory you've shown start with an uppercase character
Is it normal to use Gulp for building C code?
isnt that like using a makefile for js
Well, afaik it's normal to use Make for js, so i assume Gulp+C is normal too?
Anyways, i'm going to try it first
if it works why not lol
The only problem is there's no gulp-clang, yet...
is there like a graceful way to wait on mongodb to connect for unit test https://conquestsim.io/upload/protective-stamp-8392.png
if i put test in a timeout etc just for well, test, jest wont recognize them
nvm jest has a beforeAll() i can just do mongo connect in
epic
https://conquestsim.io/upload/plant-cover-1677.png first test out of 34 finished
time to cause self pain
how can i tell if someones an admin with guild_subscriptions set to false?
fetch the guild using the api to obtain its roles
and fetch the member if not cached, to obtain its roles too
you get a guild object, which contains an array of roles
@earnest phoenix you know conneting is a promise right?
You can wait for connecting by just awaiting, you'll need to change how you connect in the forst place a little bit tho
I do this
let mongoDataBase = await MongoClient.connect('mongodb://localhost:27017', { useNewUrlParser: true }).catch(console.error)
client.db = await mongoDataBase.db('name')```
how much ram do u need to handle like say 30k users? 
hey, I have made an app and I can let the bot send messages in the channel I want. I also managed to let the bot send DM to users, but I would like to know whether it is possible to see which messages the bot sent (I don't have the id anymore of the message) and view potential replies from users
well yes, but no
so yes on the sent messages and no on the replies?
yes, but no on both of those
you would have to loop getting messages in batches until you find your bot's messages (which could potentionally take hours on end to finish, and you're going to hit ratelimits), there are many other variables here, like, what if someone deleted your bot's message, how are you certain which message you need to get?
store the message somewhere in code and you can track replies from there
@earnest phoenix depends on the library you use, and what optimizations you do to it
discordjs :)
it can potentially use a few hundred MB, or it could use 50MB
@steel patrol you can fetch messages from a channel, if you have the channel id
as long as the messages are not older than 2 weeks
oh
yeah, but I need to access the DM I sent
if that's not possible that's okay, we're still just testing the app
im not sure, i actually havent tested this
do dms have a new channel id everytime you create them?
try creating the dm channel again, and fetching messages from it
well, correct me if wrong, but wouldn't it be easier to get the message id on creation and then use that to access it later ?
well, yes, but you said you didnt have the message ids anymore
the dm channel id remains the same
no, but for future design that would be better
mm ok
I'll try that then to retrieve the past id and start designing with future message id's
thx
so then yeah, if you create a new dm channel, you should get the same id, which you can then use to fetch messages
yay, ignore lists are implemented 🙂
This guild has 71k (many bots tho) members alone, so if you're using a gig of ram just for one server you need to think of some optimizations
Python caches everything in every server and this server takes like 100mb ram
i actually misread him and though he said 30k guilds lul
in my bot i added a feature where people with the correct permissions on a server can enable 'chatty' mode on a per channel basis. basically the bot becomes talkative, responding to anything it recognises without need for a prefix or mention. if this was on by default it would be an absolute no-no. is there anything that specifically says i cant/shouldnt do this even as an opt-in setting that the admin turns on? even in this state, it still is hard coded to ignore all bots.
I would recommend locking it to a channel
imo, nothing should come enabled by default
unless its required for whatever it is that the bot was designed to do
and even then, if possible, requiring it to be enabled by the guild admins would be better
Hi, when does a bot need the "Embed links" permission? I didn't checked it and my bot was successfully sending "hidden" text links in RichEmbed
i think the embed links permission doesnt stop it from sending, it just wont show the link preview from any of its links
i might be wrong tho
tim is correct
ok thanks 🙂
ah yes it do be like that

One message removed from a suspended account.
(node:22284) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'send' of undefined
at C:\Users\pnoke\Documents\GitHub\FarmCord\cmds\general\help.js:49:24
at step (C:\Users\pnoke\Documents\GitHub\FarmCord\cmds\general\help.js:33:23)
at Object.next (C:\Users\pnoke\Documents\GitHub\FarmCord\cmds\general\help.js:14:53)
at C:\Users\pnoke\Documents\GitHub\FarmCord\cmds\general\help.js:8:71
at new Promise (<anonymous>)
at __awaiter (C:\Users\pnoke\Documents\GitHub\FarmCord\cmds\general\help.js:4:12)
at Object.module.exports.run (C:\Users\pnoke\Documents\GitHub\FarmCord\cmds\general\help.js:40:50)
at Client.<anonymous> (C:\Users\pnoke\Documents\GitHub\FarmCord\libs\events.js:15:38)
at Client.emit (events.js:210:5)
at MessageCreateHandler.handle (C:\Users\pnoke\node_modules\discord.js\src\client\websocket\packets\handlers\MessageCreate.js:9:34)
(node:22284) 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:22284) [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.
@sage bobcat
One message removed from a suspended account.
One message removed from a suspended account.
ye
One message removed from a suspended account.
is it a compiler error or a runtime error
Then you would need the error response
One message removed from a suspended account.
it's typescript
that's why i'm asking if it's a compiler error or a runtime error
because typescript is typed
One message removed from a suspended account.
One message removed from a suspended account.
https://paste.menudocs.org/paste/n23ng Can someone help, I am trying to make it see if the member who sent the message has the role and if he did it would do the verification else it would say Your not a DSG staff member
has() takes an id.
has(snowflake)
@oak moat 30 mins in menudocs and Source code....
No reply....
Tenpi, cry the role is a variable for the id
i'm aware, but it doesn't replace the id.
I once waited 2 days for a reply and didnt cross-post 
anyone know any way to get a ko-fi webhook working with a discord webhook?
Whatever you did, let's not fill this place up with pointless fingers pointing
reference, also i tried putting the webhook url into ko-fi
Can't you host your own webhook to later send the data to a Discord one
^
you need to have a middleware that translates the webhook structure from one to another
One message removed from a suspended account.
Lowercase the content
lol ^
You cant lowercase an array
One message removed from a suspended account.
I mean you can map it to lowercase 
??? you lowercase the entire message before slicing it
Before you turn it into an array lowercase the content
One message removed from a suspended account.
ok
One message removed from a suspended account.
One message removed from a suspended account.
yes
One message removed from a suspended account.
anywhere where you want case insensitivity
One message removed from a suspended account.
One message removed from a suspended account.
yes
One message removed from a suspended account.
if you use that variable in your command handler yes
One message removed from a suspended account.
what then what
One message removed from a suspended account.
One message removed from a suspended account.
you're confused because you copypasted somebody else's command handler and now you don't know what your code even looks like
or where to navigate, because you didn't write it
One message removed from a suspended account.
One message removed from a suspended account.
it kind seems like that ngl
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
"your code" is a snippet that's repeated on google search results for like 10 pages
One message removed from a suspended account.
that part could be said about a lot of code
One message removed from a suspended account.
my command handler i stole from google
didnt make a single modification either 😎
i used to steal a lot of code
One message removed from a suspended account.
@little iron used to just be filled with stolen code and its heavy af, thats why i had to kill it and move on, anyways its a useless bot now lol
it functions the same if I were to write it so why change it
yeah my first bot was filled with stolen code
and was just garbage
One message removed from a suspended account.
i know what im doing
clearly not because you don't even know how to take basic instructions i gave you and apply it to your command handler
One message removed from a suspended account.
because you stole the code (which is why you don't know where) 🙃
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
hmmmmmmmmmmmm
so if i take a marvel movie and put my voiceover on it, it's now mine?
maybe you should learn some basic nodejs usage first
One message removed from a suspended account.
This is basic js, slice() returns an array
what are you trying to make case insensitive?
I copied a command handler but I knew exactly how to make use of the functions
args
One message removed from a suspended account.
afaik
One message removed from a suspended account.
i went through your src and found the command handler within a minute, how the hell do you not know where it is
it's just evidence that you stole the code without analyzing what it does
One message removed from a suspended account.
One message removed from a suspended account.
the prefix part of it and you removed checks for bots
that's the only change you made
One message removed from a suspended account.
lol ok
One message removed from a suspended account.
One message removed from a suspended account.
look, i'm tired and i don't have the nerve to do this, just go to your command handler and look at your code further than just the if checks
try installing it
npm install request
npm init
uh
what
this feels like a
boi
cd to the directory
run npm init
my brain cells are damaged
where is your project located
but it says it was installed
where is your project located
where is your bot project located
ok
find that exact directory
the folder
cd to it
npm init
then do things
when you did npm init, the initializer started running, now it wants you to provide information
such as name of the package, license, etc
you have to type those out
cd and then the directory
npm init
One message removed from a suspended account.
yes
One message removed from a suspended account.
thats a little harsh
doesnt discord bot maker have a discord server?
probably
>>> 0 and 0
0
``` well up to this day I'm not sure how I haven't noticed this
So anyone explain jasn. Jason file in all these neural codes. And there derivatives. Sophie finally got me out. Human AI or a thought bot. I’m new to this side
w hat
ah
who is Sophie
https://www.hansonrobotics.com/sophia/
humanlike robot
thonk
thonk indeed
when the user sends a message, where do i find the value that says if theyre a server administrator?
ive tried iterating roles, but for the initial server owner, the administrator permission appears to be given absolutely, separate to the roles and i cant see it there
if it matters, im using guild_subscriptions=false which seems to hide a bunch of stuff
Does it hide their guild permissions too?
not sure, where would they be? i can show you the whole 'd' part of the packet for a message, if it helps?
Not entirely sure that could help me but why not :p
if its part of the user list sent with guild_create, i dont have it
i dont get that user list
https://conquestsim.io/upload/huge-jeans-3683.png WE IN THE GREEN BABYYYYYY
Maybe let users set up the admin role?
im using a role to denote access right now
but i want administrators to override that role and just get access, as they seem to override near everything else
otherwise the server owner goes to use the bot and it tells them they dont have the permission they need (manage channels)
technically, they do
looks like it should be in author.server_permissions
i dont have that part of the object 😦
@earnest phoenix 2020ms
Then why dont you check how long it take to connect in a different test
Then it'll be accurate
@earnest phoenix isnt that for a discord bot?
I think he said its also a web based game
idk
^
what rico said
but yea its the discord bot portion
i generally build out a library that can work independantly of djs events etc
so that i can reuse it on multiple platforms
damn thats sick
that also allows for easy test to be written
i was asking because ive never really seen unit testing for bots but have wondered about it a few times now
yea so if you have a complex system its nice
but for simpler stuff might not be worth the time
fair
heres a pic
i made in ms paint
to explain it better
thats hd
lib should work independantly of anything pretty much
I recently create my moderation commands (kick, ban, ....) But I don't know if the permissions for using this commands are already set or I have to do it ? 
If you don't have enough permissions x you can't kick
To ensure the command invoker's permissions is up to you
yes but I mean today a member can kick someone by using the rigth command ?
if you made your command locked to a member having certain permissions then users with those permissions can run the command
I need a little help with markdown code block formatting, I am using Discord.js and for some reason I get the list working but somehow I am getting the code block in italics and I can't figure our how to remove the italics https://imgur.com/a/GEcMLj8 (I am using discord.js)
lol
the previous server name includes a *, simply escape it
erotic code
I tried replacing the * with nothing but it seems to do nothing am I doing it wrong?
guild.name.replace(/'*'/,'')
And I tried adding the * to my test server and it just showed the * and not format it
/\*/ as regex?
I feel dumb
I didn't think that would stop the code the server has a name with a ' in it
are you using regex to replace every *
That wasn't the problem which would explain why that never worked
I changed the regex to /\'/ and it worked :/
but thanks for the help
@dusky marsh How did I do this ?
can someone tell me how to make a bot send a message when i post a youtube video?
discord.js
message event -> check if content starts with desired youtube url (e.g https://youtube.com/ or https://youtu.be/) and if the author id matches your id, if both checks pass, send the message
i think he means have the bot detect an upload in youtube (or not)
Language?
@mild escarp You can have the bot use your youtube channel's rss feed at https://www.youtube.com/feeds/videos.xml?channel_id= {your channel id here}.
is there anyway to visit any of the servers your bot is in ?
oh jeesus. after 2 hours debugging, i found out why crappy discordphp can't handle this server. when it adds 75000 users, it does an O(n*n) loop, two foreach's inside each other, one to add members to an array and another to search through the presence list (75000x75000) looking for the presence to associate with each member... ffs.
taking out the presence stuff allows it to register, even while using guild subscriptions
discord.js I want it to not display the current playing song in the queue and when the queue has 10+ songs make it to pages - Any Idea how to?
let embed = new discord.RichEmbed()
.setColor(`#FFD41C`)
.setTimestamp()
.setFooter(`Rhino - Multi Purpose Bot`)
.setThumbnail(`https://i.ytimg.com/vi/${queue.musics[0].id}/default.jpg?width=80&height=60`)
.setTitle(`Music Queue`)
.setDescription(`${queue.musics.map(music =>
`\`•\` **[${music.title}](${music.url})**`).join('\n')}`);
message.channel.send(`:arrow_forward: **Currently Playing:** ${queue.musics[0].title}`, embed);
@earnest phoenix There is a custom client that lets you login with your bot token, but that was like years ago, I would also think thats against TOS. You could have your bot give you open invite links to servers as well, but thats kinda scummy.
also this thing is passing huge (20mb) json objects around as copies, not refs
:/
🙂
@heavy marsh filter the array (or slice) the playing song and map the rest
pages are complicated so you'd have to experiment yourself. Some simple checks can get you what you want
ok thanks
@heavy marsh ```let page = 1;
let embed = new discord.RichEmbed()
.setColor(#FFD41C)
.setTimestamp()
.setFooter(Rhino - Multi Purpose Bot)
.setThumbnail(https://i.ytimg.com/vi/${queue.musics[0].id}/default.jpg?width=80&height=60)
.setTitle(Music Queue)
.setDescription(${queue.musics.map((music, i) => (i >= (page-1)*10 && i < page*10)?`•` ${music.title}:'') .filter(m=>{return m !== ''}).join('\n')});
message.channel.send(:arrow_forward: **Currently Playing:** ${queue.musics[0].title}, embed);```
ooh wow thanks
how would I get a variable that gets defined in a function, to save to a constant or something to call for later in a different portion of the script?
discord.js
const jsonObject = JSON.parse(body);
var UPDATED NUMBER = jsonObject.UPDATED_COUNT;
the UpdatedNumber var gets defined like this in a function, but is inaccessable and "undefined" outside of that specific function
Question for all you nerds. What's the best way to handle refreshing OAuth access tokens. I'm thinking a cronjob or something that refreshes for every user using my app. Is there a better way or something I should be doing? Please ping me with responses. Thanks
@earnest phoenix you could initialize it outside of the function
didnt think of that tbh, am dumb, thanks ❤ @zealous veldt
Np :)
hmm
is this overkill?
/* Drop these before we even parse json, it's much more cpu efficient. We dont care for TYPING_START or PRESENCE_UPDATE */
if (substr($data, 0, 23) == '{"t":"PRESENCE_UPDATE",' || (substr($data, 0, 20) == '{"t":"TYPING_START",')) {
return;
} else {
$data = json_decode($data);
}
parsing presence updates and typing start messages was costing me a constant 2-3% cpu, and this is a dual cpu, quad core xeon
that does seem to have helped a fair bit
well if its noticeably faster then yeah its good lol
libs have an array of events you can pass to disable them
might not even be necessary
this one has such a system, but it parses the event before it decides if it needs to filter it
i think im making some progress at making this old unsupported lib actually useful... yeah i love a difficult challenge
Anyone here able to help a brother out with the most simplest thing ever?
that depends what simplest thing ever it is
I'm running on little to no sleep the last 2 days so like the smallest things are just going straight over my head
first and best advice youll hear is, after ive given an answer whether its useful or not, go get some sleep.
😄
i can relate
🙂
however its a vicious cycle, the more tired you are the harder it is to concentrate and the more mistakes you make, you just end up introducing bugs 🙂
https://hastebin.com/cukeqapemu.js is my command but I have an issue were the 3 error messages get sent at once instead of one at a time. Most likely a issue with not having return in there somewhere but I just cant seem to get it to work
you mean you get multiple language versions of each line being sent?
No the languages is fine, this is the problem it sends all these at the same time
When they are supposed to be like, if it doesnt have perms it will only send the first and if only the embed color is not defined it will only send the second
Its just the smallest thing I can feel it but for the life of me I cant figure it out and im gonna just stay up all night till I get somewhere
is line 12 supposed to be like this?
if(Guild.language === 'german') {
message.channel.send(emessage.ge_noembedlinks)
}```
or like this:
message.channel.send(emessage.ge_noembedlinks)
}```
First one
yeah it will, unless you put a return after each error, or something
I tried adding return but thats no use
try the second
after its executed the "if (!color)" block, it falls through into "if (!title)" and then "if (!message)"
perhaps
The language parts are not the problem they work perfectly its just the error messages
will all send at once
i dont normally indent like that
ive put the returns to the left, so you can easily see what i mean
you could even just put one return at the end of each major block
the if (!title) and if (!color) etc
but the way ive done it i think is clearer
btw your indent/brace code style make for some difficult reading, perhaps you should run it through a pretty print, or use the code indenting facilities of your editor?
it will make your code easier to follow as you write it
that just makes the code look nicer tho
personally i find it really hard to grok code where its got like 3 or 4 }'s on one line
i guess some people find that easy to read
I'm able to read the code easily idk I just like the way it is but yes brain those returns you added worked
this is an ideal case for switch statements, or simply an associative array of responses
i'd have done that, tbh
syntax may be a little off, its been a while since i did js
I can finally sleep now, damn 2 hours in the last 48 hours
is it even js, what language are you using, @deep wedge 🙂
i just have some stuff in other files
like
error codes in a other file it makes it easier instead of writing out the one error code each time
i can just have it all together
if i ever need to change it
thats a good idea, because you can pass those separate files to a translator
without giving them source code
in an ideal world all strings should be in an external lang file, but im a hypocrite because i never do it... or i start out with best intentions planning to, and then stop doing it part way because its a pain
most of my error messages and error codes are just like js ${error.nouserfound} or ${emessage.nouser}
that works ok in some instances
however, some languages have oddball syntax.... i mean spoken languages
like, posessive parts of a sentence having to be listed first, or feminine and masculine different wordings for words that are the same in english
etc
Yeah that happened in French so I just wrote out the error code and seen where the words went and just plopped it in there
a good i18n system accounts for all of that, but like i said im a hypocrite and really should use such a system myself. i think node has several
I gotta go asleep damnits really late, Ill see ya around mate thanks for putting my brain to ease after all those return errors and stuff. 
also strings and localisation is boring, lets be honest here. nobody likes dealing with it
ok night, sleep well!
Have a good day or night!
thanks you too, its late for me also, im contemplating bed 😛
wholesome <3
can someone give me a quick tutorial about webhooks?
🕸 ↪
so uh, I got the other stuff working, and everything seems fine however I keep getting back errors when someone DM's the bot and it replies
The reply comes through perfectly fine, and everything in discord seems to be working perfectly but in the console it returns with this
(node:26812) UnhandledPromiseRejectionWarning: DiscordAPIError: Cannot send messages to this user
at item.request.gen.end (F:\desktop\Dappers Bot\node_modules\discord.js\src\client\rest\RequestHandlers\Sequential.js:85:15)
at then (F:\desktop\Dappers Bot\node_modules\snekfetch\src\index.js:215:21)
at process._tickCallback (internal/process/next_tick.js:68:7)
(node:26812) 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: 2)
(node:26812) [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.
not really sure whats up, not used to these errors lmao


