#development
1 messages · Page 558 of 1
How can I make a bot that can rank people in roblox?
@keen fulcrum use a function
#MISSION_IMPOSSIBLE
For me
How?
find('x', 'y') to find(p => p.x === y)
ie
ohwait
wrong mention lul
@earnest phoenix ^
and @keen fulcrum look into some roblox api or something, thats not really a topic we cover here
That moment when you are truly lost as to why your bot wont work only to find you didnt save the changes yet....
How do i make my bot desc be shown correct on phones?
Rn its just garbage
Only on pc it works great
<table class="table is-striped" id="toremove-parent">
<thead>
<tr>
<th>Command</th>
<th>Response</th>
<th></th>
</tr>
</thead>
<tbody id="toremove">
<%for(let list of settings.customcommands){%>
<tr>
<td><%=list.name%></td>
<td><%=list.reply%></td>
<td><a onclick="delCC()" class="button is-info command-remove" data="<%=list.name%>">Remove</a></td>
</tr>
<%}%>
</tbody>
</table>
</div>```
How i get data from the clicked button?
@wicked summit I don't know JS that well but wouldn't you pass data when you call the delCC() function? Then you can do something with said data in the function.
Ok wait
function delCC(){
let opt = document.getElementById("toremove").data
let data = {
data: opt,
}
axios.post("/manage/<%=guild.id%>/customcommands/remove", data).then((res) => {
if(res.data !== "Success") return window.alert(res.data);
console.log(res)
});
}
@junior nacelle there ^
this.data? I dont think I know JS enough to help you
I would know how to troubleshoot this in a web application but not in a bot. Perhaps try using console.log for all of your variables to ensure they are getting what you are expecting
After let opt, console.log(opt)
Are you getting a return on the res console log?
https://paste.tscforum.com/xfckqikavc.cs What would the type be for something like this?
I am using Bulma's dropdown feature
@lusty dew The depends what you are going for; it is an input, what kind of input are you seeking?
Well
It is a dropdown
and I want it to input whatever the person chooses
So like for example they choose Cutie Doctor
it will input that choice
@lusty dew good point, I typically don't write dropdowns that way so never thought about it
Ok
Could cycling through all the guild members and checking if each one of them has a specific role considered API abuse or something of that nature?
y e s
How do I know if they are cached?
d.js?
yes
if you're not using fetch, they are cached
Nice, thanks 
Hi! What do you mean by responding to other bots?
it means that another bot can activate commands on your bot
which can cause loops, which is why we muted it
Ok, thanks i will fix it 👍
I think i fixed it 👍
what is the best site to host your bot
use a paid vps
?
glitch or heroku
what is free and 24/7
heroku
search those up ;/
Oh Ok
glitch is also free
Oh Ok thanks
It’s best to buy a VPS
ye
OVH is cheap
i dont have a credit card so ye
const commandList = client.comman.get('command')
const commands = client.comman.map(c => {
console.log(`${c[0][0].name} :: ${c[0][1].description}`);
});
```error: shows only 1 thing not repeating to show all of the commands
umm
Raspberry pi hosting ftw
I host my bot on my washing machine
Yas, Samsung smart washing machines
Throw a hard drive into the washing machine and turn it on
I could not join the voice channel: TypeError: serverQueue.connection.playStream is not a function
library: eris stable
Read the error
Hey Idk why when I add 3 songs in queue and when I skip first song it plays second but when I skip 2 it leaves the 3
Try it and see
undefined
i am added the bot on your hosting
DBL doesn’t host your bot
lol true that
DBL gives your bot publicity

so when i console.log a Map object i get stuff in the output like [Array] and [Object] how can i display the entire thing?
Join it?
doesnt work
any other way i can display the entire thing without those stupid compressions or whatever they are
Is that js?
yes
I assume the array elements are not strings?
Then loop over the array and determine what properties you want to output, and add them to a variable or something
I don't think that's how js works
I need to generate a numbers for a report I’d and idk how since I’m a noob at coding I am trying to do message.channel.send(Math.floor((Math.random() * 100) + 1)) but it won’t work
Doesn't d.js require a string for send
you can’t console.log an array in node iirc
console.log(require("util").inspect(x, {depth: maxDepth}))
just set a large[citation needed] value for depth
or connect it to chrome's dev tools, and log it there
@inner jewel x is my Map object right?
yes
Can someone help me with a vote command I just got my bot approved
Oh nvm found it
https://paste.tscforum.com/awjclbvyeu.xml What would I put in the type for something like this?
why isn't the bot removing the "muted" role? Can some1 help me?```css
if(warns[wUser.id].warns == 2){
let muterole = message.guild.roles.find(name, "muted");
if(!muterole) return message.reply("You should create that role dude.");
let mutetime = "10s";
await(wUser.addRole(muterole.id));
message.channel.send(`<@${wUser.id}> has been temporarily muted`);
setTimeout(function(){
wUser.removeRole(muterole.id)
message.reply(`<@${wUser.id}> has been unmuted.`)
}, ms(mutetime))
}``` ping me
Nhe
hi
who can help me
:
I would like to make a command in an array but how? Ex:? Search Ab / And the bot sends me everything that starts with Ab in my array
loop all the time is not optimize :/
you can't not loop 
you have to iterate over the array to find if an instance matching x exists
why isn't the bot removing the "muted" role? Can some1 help me?```css
if(warns[wUser.id].warns == 2){
let muterole = message.guild.roles.find(name, "muted");
if(!muterole) return message.reply("You should create that role dude.");
let mutetime = "10s";
await(wUser.addRole(muterole.id));
message.channel.send(`<@${wUser.id}> has been temporarily muted`);
setTimeout(function(){
wUser.removeRole(muterole.id)
message.reply(`<@${wUser.id}> has been unmuted.`)
}, ms(mutetime))
}``` ping me
It doesn’t remove the “muted” role
yeet
Okay I will do that tomorrow I need to sleep 🛏
Gn
I wouldn't put mutetime as a int
I would do
let mutetime = args[1]
So it takes whatever time you say
for example
!mute @ user 12s
it would take 12s and mute them for that amount of time
@earnest phoenix What lang do you know?
Lang?
Java, JavaScript, Php, html
Yes
May I dm you?
I forgot that
hi,
so sometimes i get a missingPermissions error, i think when trying to send a message to a textchannel. i guess the serverowner is trying to use the commands in channels the bot can not post to? is there a workaround, or an established way of handling such a situation? should i let the user know whats going on somehow? or can i request permissions enough to post anywhere on a server?
just... don't execute the command if you miss permissions to do whatever the command does?
the command is .send()
a user enters a command and gets no response because the bot has no permission to post in this textchannel
ok, but read what i said because you completely disregarded it
i dont get it
i don't care about the error message. i care about the user not getting a response
the question is what should i execute instead
@lusty dew it’s a warning command
So bots cant vote or whatever but is it fine to reward voters in the form of magical internet points?
Why the unneeded '
Wdym magic internet points
You can (and are encouraged to) give users rewards for voting
Just update the channel names like every minute
thats kinda api abuse
if your server is not very large, you can do it using the member add event
it will probably hit the api much less than updating every x
does anyone know how to do this https://gyazo.com/2a8e61c56e4ed98d4840f80ed8066fa5
someone clicks an emoji and it gives u a role
@earnest phoenix Yagpdb should do it?
Does anyone know why my music bot keeps skipping songs randomly during a song? I asked this yesterday but it didn't answer my question
my bot is able to log messages, send files (as attachments) and send text messages to the channel. What permission does it require? Can I just leave it at ‘0’ cause it is no different from everyone else on the channel?
@inner jewel So, in other words - I could leave it at 0? Or were you replying to me?
Can someone help me with my issue above?
?
nobody will help you if you provide little to no context about what you are using
Yep
@earnest phoenix Like?
like code sample, some tests you made like testing if the issue is with a specific song or songs
It's not i already tested
add some logging to your code so you can see when it happens and in which context
But when i host it on my computer the skipping doesn't happen 🤔
When I host it on my host it skips randomly during the song
Could it be my host?
it could be network issues, ram/cpu shortage, outdated or broken dependencies/packages
whats your host?
SyroNodes Every time i say this people always say its a wired host lol when they check it out
it doesnt look like a well known host, so its very possible that it might be an issue on their end
I check with them apparently it's not
are you 100% sure its not your code?
Is it easy to set up?
google is not that easy, idk about amazon, havent used it
Also do you need any Credit Card info?
yes, to create an account
Google Cloud Platform lets you build, deploy, and scale applications, websites, and services on the same infrastructure as Google.
look for a "compute engine" instance
F1-Micro - 600mb ram
thats their free tier
its free forever, but limited to 1gb traffic / mo
Would i click that to learn about it?
@quartz kindle Also one of the support team people said it was youtube is this true?
also possible, depending on the location of your home machine and your host, it could be a local youtube server having issues
regardless, whatever is causing the skip should be perfectly catchable and loggable and even auto-retry-able
Ah
Does anyone want to collaboration on a project? I need someone with knowledge of Vue.js, html, CSS and many other things
Is there any way to test to see if a user would accept DMs from the bot without actually dming them?
Discord.js
I was thinking using createDM() but I'm not sure if it would work or not, but I'll try it 
Nah didnt work, didn't expect it to lmao
could just dm then delete and see if it went through 
Im not evil tho
JS question: I have a command handler implemented and I am struggling with breaking scope.
Command X - sends an Embed message
Command Y - Edits embed message
How can I get Command Y to retrieve the message I need changed?
How can I pass variables from Command X to Command Y when the handler is in the index.js?
Well, could store the message in a database, or if its unimportant a json file
then retrive it from said places
etrieve*
retrieve* 
@amber fractal thank you, I'll try that
Hey.
Mk thanks
I want to try learning Python xD
Even though I don't know JS that well which is what I have been studying for the past year now
@amber fractal looks like I will have to go with a DB; discord.js has some serious issues when it comes to recalling messages. Stored the ID on a json, tried to use the fetchMessage([id]) command which is supposed to run on a channel command which apparently cant run on its own. If I do message.channel.fetchMessage - the promise is pending and even with a delay I am getting 404 not found.
Somehow the http npm is not working for me a few days ago, so my webhook is not working tho
What can I use to replace it?
I need the newest version of node.js?
I'm getting this error and I don't exactly know where it's coming from. Can someone lead me to the right place? (node:16841) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'constructor' of null
(discord.js)
Heres more context ```(node:16841) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'constructor' of null
at Map.[check] (/root/ChigBot/node_modules/enmap/src/index.js:884:44)
at Map.get (/root/ChigBot/node_modules/enmap/src/index.js:224:19)
at Client.client.on (/root/ChigBot/index.js:54:129)
at emitOne (events.js:116:13)
at Client.emit (events.js:211:7)
at MessageCreateHandler.handle (/root/ChigBot/node_modules/discord.js/src/client/websocket/packets/handlers/MessageCreate.js:9:34)
at WebSocketPacketManager.handle (/root/ChigBot/node_modules/discord.js/src/client/websocket/packets/WebSocketPacketManager.js:103:65)
at WebSocketConnection.onPacket (/root/ChigBot/node_modules/discord.js/src/client/websocket/WebSocketConnection.js:333:35)
at WebSocketConnection.onMessage (/root/ChigBot/node_modules/discord.js/src/client/websocket/WebSocketConnection.js:296:17)
at WebSocket.onMessage (/root/ChigBot/node_modules/ws/lib/event-target.js:120:16)
This happens everytime i ch help etc
do any commmand
nvm fixed it
C:\Users\Aj\Desktop\Python Practice>Python app.py
'Python' is not recognized as an internal or external command,
operable program or batch file.
Can someone explain why I am getting this?
It is...
It is in my environment
Along with these two
@restive silo What would I need to add then?
that should be enough, are you sure that the python.exe is located there?
I don't see any python files
on my computer
Just the Python IDE and such
C:\Python27
doesn't exist
then python is probaly not installed and your IDE has his own python in it or smth
Idk
I am trying to reinstall it
even though I hit
ADD TO PATH
and then clicked Install
How do I make an !AFK command where you do !afk and it changes your nickname to {AFK} and then your name. And then !un-AFK resets your nickname
Hmm
Help
How to invit bot in my server?
H
client.on('guildCreate', guild => {
const join = client.channels.get("517749949413457938"); //CHANGE TO YOUR CHANNEL-ID TO GET NOTIFICATIONS
const invite = guild.channels.find(c => c.type === "text").createInvite({
maxAge: 0,
maxUses: 0,
reason: "Security ToS of bot"
});
let rbnEmbed = new Discord.RichEmbed()
.setTitle(`Started Serving In **${guild.name}**`)
.setColor(`GREEN`)
.setDescription(`${invite.url}`)
join.send(rbnEmbed);
});```
return's undefined
Use webhooks for logs 👏
Anyone here set up webhooks for the dbl api on Heroku and willing to help me out? trying to get vote notifications. new to webhooks.
Anyone here, good at making bots?
I uh, im trying to make a bot much like "the dank memer"
But with actual good memes
@earnest phoenix iam not good but for dank memer u dont need much skills
@fiery nebula rip, now i feel even more like a nub
Well i basicly want to make a dank memer, but with different memes
i just dont know where to begin
do you have created the bot?
ok just try a normal command when you set it up
Though I send welcome text channel invitation link to others, but still whenever someone joins the first page that appers to him is that channel where at the top it is written that welcome to the server
I mean how to set a channel as welcome channel in a server.
@frigid zephyr code?
this is my welcome message
with member.guild.channels.find() you can serach a channel and set it as a channel if its existing
what
yes
your bot doesnt have any code by default 
watch a tutorial and come back xd
yes dad
gj son
hi
@fiery nebula so the tutorial wanted me to install node.js and other things, and wanted me to work with command prompt, does that sound right?
yes
a bot is a software that needs to run somewhere, ie your computer or a server
the bot application in the discord website is just to create a "bot account"
Discord dont host them?
no
yes, or get a vps
you're following a bad and outdated tutorial
also, first of all, do you have any experience with programming?
I do but not with the setting up part
which languages do you have experience with?
Javascript and java
alright, both of them have discord libraries to work with, you can use either of them
which one would you prefer?
Java script
then you're on the right path, to use javascript you need to use node.js
now, the best javascript libraries for discord are discord.js and eris
discord.io (the one you tried to install) is outdated and not very good
so go ahead and take a look at the discord.js website
discord.io is outdated
@earnest phoenix
discord.js best
so take a look at their website, and their documentation
they have a getting started guide and much more
Alright, cheers
Thats just how i roll
dont get me wrong, im a javascript developer too
but compared to java and c++ for example, javascript is like a super dumbed down language
like comparing mac to linux
I know i know
apple is overrated
Im not exactly a coder either
Is there any bot that Reset all the Nick Names
wrong channel, also, you should use the search function in the website
how can i terminate a collector
pretty sure it has an .end() function
ok
Anyone here familiar with Heroku tho?
Not many better free alts tho
google / amazon
lifetime free?
google is free forever, but after 12 months they charge for traffic above 1gb/mo, which depending on the size of your bot ends up being 1-2 usd/mo
cause with a card registered I can run 24/7 basically no problems
just cant figure out working webhooks into this :/
not to mention I'm a noob on the subject to begin with xD
lol its uh supposed to
if im not mistaken they redirect it to port 3000
but not running a web worker breaks that I think
https://i.imgur.com/yOkcUYK.png tldr dont use a free host for bot hosting
ok thanks
but I've done my research and am content with the limitations and features of my host 😛 just asking for help ~
What exactly does node.js do, is it really needed
node.js is a javascript runtime environment
it runs javascript code without a browser
either that or anything else that can run javascript
so running a web-worker attempted to run my bot so thats cool
you could actually run a discord bot in a browser if you wanted to
too advanced for 2019
Well i do have an extra pc available for such a purpose
my bot used on run on node-webkit / nw.js
its pretty awesome actually, because its super easy to test and debug
my bot has a profile picture that changes every hour (it features a song that one of the users is listening to), but the discord bots site is having issues picking it up and can't display the profile pic
is there any way that i could fix it on my side, would implementing the api help (didn't look into the api much yet)?
i dont think so, because of caching
the api is good to have if you wanna post your server count but I think the pfp would be handled elsewhere anyway
hm yeah i see, its just for votes and stats
Surely theres a community where i can steal peoples code right?
github
thats a bad idea
Stealing code is fun
but how will you ever improve?
O i mean *borrowing
good luck getting it to work
i mean, you can take a look at other people's code if you want to understand how they are doing it, but dont just copy/paste
you could also just use it for inspiration instead of copying everything, that way you'll even learn stuff
copy/pasted code probably wont even work, and you wont understand why
@faint topaz You could have the web worker in a different app
if your having a rough time there was a git I used when I moved from C# to js, its a started bot with the events set up and a few basic commands. you just have to put your token in the config.
And for voting rewards use a db which is connected to both apps
oh that could work
(It's probably trash)
yeah I have all that shebang set up just not hooks xD

I use the jaws addon xd
it actually isnt
heroku postgres is a good managed database solution
more familiar with just basic sql
similar to google cloudstore/firebase
no idea, havent actually used it
o
but postgre is one of the best rdbms's out there
probably better than mysql
just harder to use and setup, which heroku basically does for you, and exposes it to you via an api
as far as i understood
Since the logging stuff on my bot is the most spammy event (for messages send) I guess it would be better to create a webhook url per server which activates logging and send to the webhook (because of rate limits)?
Main question would be are webhook messages more tolerant for rate limits than normal messages send through the bot?
what kind of logging do you do that spams so much?
It doesn't really spam but it's the most spammy out of all the functions
It's just all these mod events user join left banned kicked role change and more.
So I thought I'll have a look before it's getting rate limited (I don't really know what's the rate limit for send message across all servers per second/minute)
I just thought about if there is a better way for it
im not sure actually
check what big bots like dyno and tatsumaki are doing, if they're not using webhooks for logging, you should be fine
Ohh alright ye already checked bigger bots and they don't seem to do sth. special.
Alright thank you 2 I'll keep it this way then 
How I can fix this error
This is muted role
I want create muted role when my bot added someones server
i have a problem with node-opus any help ?
you're missing a : after permissions
get a better theme
it's unreadable with that one
indeed
What's the cheapest way to host a discord bot. Currently I'm using DigitalOcean with free creds from Github.
GCP free plan, AWS free plan
DO isn't cheap lol
Yea but I'm using free credits from the Github Student Pack
All I want to do is ssh into a Linux machine
DO is ok
guys i want to shard my bot and am not sure on what i have to worry about. in this guide it says "If you're using any sort of database or connection, multiple shards may cause issues with multiple processes connecting to a single end point". What do they mean? simply race conditions or some nasty db errors?
In 10 months my free credits from Github will be spent so I'll switch then
looks like coffeescript
Ew
but it isnt 


the special characters are just really dark
yea true
Looks like shitty js theme

I had to view the image
dont use dark characters on a dark background 
I literally had to zoom in
🏀
zoom and enhance
he forgot a :
@viral spade basically sharding is not compatible with databases that create file locks, such as leveldb, which only allow one process to use it at a time
so with my noobish mysql, hows my perspective?
you'll be fine
du i have to set different users or something?
just make sure your database is designed so that it can function with arbitrary requests that do not depend on data from other shards

for example, if you have functions that require getting data from other servers, you need to review that
how do you do
because they will be executed in a shard context
basically any kind of cross-guild code
no my bot loops through all users in the servers and insert stats into the db. teh stats can be queried with commands, but only from own server. should be fine right?
yeah should be fine
aight thanks very much
so do i see it correct that sharding basically is just 3 lines of code, adding that "shardmanger"?
yeah, just in another file
that file will be like the "starter"
and will run your actual bot file multiple times as shards
ok thanks
@quartz kindle sharding is compatible with file locks
if you use internal sharding
what's incompatible is multiple processes
both major js libs have internal sharding afaik
i have a cronjob once per minute that takes the client/bot object as input. i set/start the cronjob after the bot has loggedin. i'd like to shard and wondered can i make it so every shard gets a different cronjobinterval with 10sec offset?
Guys, could someone help me with discord.py [rewrite] ?
I'm trying to create a mute function, that create a role if it doesn't exists in the server and wait for a time to took of the role of the muted user.
But the user still can write in the server, how can i fix it ?
https://hastebin.com/papabawisa.py
you might need a global queue or something
once each shard connects, add it's task to the queue
and every 10s, you check if there's anything in the queue
if there is, remove it and start the task
yeah, he was talking about the shard manager
but you're right, i wasnt specific enough
hi
i have my express server hosting a static serve to a directory but for some reason only one file too, is creating problems and whenever i go to that file it makes me download it so i think that's the problem
whenever i try to POST to it
its 2.5k guilds that u should start sharding right?
yes
well
you need to start before
if you hit 2.5k and its not sharded your bot will break
you can still run 1 shard with 2500
at 2501 it'll break
if you don't get disconnected you could have eg 10k guilds on one shard
you only get errors when connecting with > 2500 guilds on that shard
fi
This is why I run 4 shards on 73 servers
ok thats borderline api abuse
well, you're using 4 connections instead of 1, but thats not much of an abuse anyway

super unnecessary more than anything
I'm future proofing
lmao
you're wasting whatever resources your bot takes up x4
I already did lmao
not to mention how silly that sounds, you make it sound like you're going to get 8000 servers overnight
I did that at 60 for like a few mints then stopped
cough
btw how was the ram/cpu difference?
between 1 shard and 30+
dsl
Ive been meaning to check that
using more shards shouldn't affect the memory usage
I've got to go out soon I'll update you when I get back
maybe for users
doesnt it spawn more node processes?
but if you have unified cache for all shards
depends how you shard it
running more shards won't increase memory usage
at most the needed memory for the socket
legit I just added shards=shardscount
does node.js reuse memory among multiple processes?
no
I'm in dpy
but i'm not talking about spawning a process per shard
i'm talking about one process running multiple ws connections
ye
yeah internal sharding
if you have a split cache, adding shards does increase memory usage
im asking about normal sharding
I just do 4 shards per process, then like 10 pods
What are pods?
d.js is pretty much the only snowflake
kuberenetes pods
ok
d.js has internal sharding
i need help
how do i install discord.py on heroku
lol
i get this Collecting discord.py==1.0.0a (from -r /tmp/build_b377451db7b41ea54720be482eccdd8f/requirements.txt (line 1)) Could not find a version that satisfies the requirement discord.py==1.0.0a (from -r
i tried discord.py==1.0.0a
heroku is a .js only I believe
i dont think so
nvm
i used a link
all good
kk
@earnest phoenix yeah you should buy something reliable
-
Bots are not what the platform is designed for. Heroku is designed to provide web servers (like Django, Flask, etc). This is why they give you a domain name and open a port on their local emulator.
-
Heroku's environment is heavily containerized, making it significantly underpowered for a standard use case.
-
Heroku's environment is volatile. In order to handle the insane amount of users trying to use it for their own applications, Heroku will dispose your environment every time your application dies unless you pay.
-
Heroku has minimal system dependency control. If any of your Python requirements need C bindings (such as PyNaCl binding to libsodium, or lxml binding to libxml), they are unlikely to function properly, if at all, in a native environment. As such, you often need to resort to adding third-party buildpacks to facilitate otherwise normal CPython extension functionality. (This is the reason why voice doesn't work natively on heroku.)
-
Heroku only offers a limited amount of time on their free programme for your applications. If you exceed this limit, which you probably will, they'll shut down your application until your free credit resets.
but iirc u can run python on heroku
Well
pulled from the discord.py server itself
I have heroku premium
Sooo
14gb ram dedicated, whatever
good for you
Yea
there is a development version
rewrite
ah i see thats async
i still dont see why people would buy something that is actaully meant to be a webserver then a vps
buying heroku premium is a bigger ripoff than the kenza cosmetics scam
Question.
you can find a vps 2 times cheaper and 2 times stronger at DO/Scaleway/GC/AWS
IF someone votes for my bot, and uses a votelocked command
@earnest phoenix oh and good luck with voice on your bot hq|one
and I'm not using webhooks
votelocking is bad dont be an asshole to your users
If i restart will they still be able to use the votelocked command?
do you check the api route?
@earnest phoenix I only use it on commands that use a lot of resources
if so then restarting will have no effect on it obviously
swifti how are you checking it
well then restarting will obviously have no effect
also the question goes in #topgg-api
what does that do?
Bansync?
Yes
So
Not here tho
somewhere that isnt here 
kk
Anyone got some pre-made stuff for a starboard that will work on 1 server only? I don't feel like making it myself
Thanks tho
lol

it wouldnt hurt for you to make it yourself
Yeah but it's like, it already exists, so save a fellow programmer you know
a true programmer would not copy something
Im pretty sure its in the rules that say we cant just give code
dont be a Bethesda
@earnest phoenix does lang matter
.js
Thanks br0
I mean some people say stuff that has to do with https://en.wikipedia.org/wiki/Reinventing_the_wheel
alright
internet is out
gotcha
I'll use my google home mini to set a reminder lol
You could make one in an hour or less tho 
eh
got other things
like
My dads going into life saving surgery tomorrow
it's gonnna be a 5 hour operation
So imma spend some time with him tonight guys
👋 Peace guys
@amber fractal please don't put links in code formatting, its extremely annoying and serves no purpose other than making people hate you
https://discord.js.org/#/docs/main/stable/class/Client?scrollTo=e-messageReactionAdd
just send the flipping link
Honestly couldnt care less if people like me or not
steven what is your problem
thats just evil
ur literally going out of your way to make things harder for people
Btw just got done with it after about 30 mins 
Its not identical
But thats just to show its easy to do
and would be a lot faster to do it on your own
@keen drift well if its something you want people to open in their browser, it just makes them copy-paste instead of clicking it
and theres no reason to do it
I didn't want people to click it, I did it more for the quote "Why reinvent the wheel" because I think saying a true programmer would not copy something isnt true
But what I dont like is asking for code that you just want
that hasnt been made
or optimized.
wtf? In the invite code I have it set to 8 or Administrator and have administrator check while inviting my bot, but when my bot joins it says it has these permissions:
CREATE_INSTANT_INVITE,ADD_REACTIONS,VIEW_CHANNEL,READ_MESSAGES,SEND_MESSAGES,SEND_TTS_MESSAGES,EMBED_LINKS,ATTACH_FILES,READ_MESSAGE_HISTORY,MENTION_EVERYONE,EXTERNAL_EMOJIS,USE_EXTERNAL_EMOJIS,CONNECT,SPEAK,USE_VAD,CHANGE_NICKNAME
anyone know what is up?
put what in the right place?
plus I used the bot to generate the invite
Hmm I wonder why my invite code doesn't work....
How could I get the bots username in Discord.py rewrite?
@hardy junco the bot also has all perms @everyone has
oh i see it doesnt say admin
if u check the bot's role does it have admin?
const Discord = require(`discord.js`);
module.exports.run = async (bot, message, args) => {
let message1 = args.join(" ");
const hook = new Discord.WebhookClient('537122172859056130', '_mzbO_XENDVIn_csUQUBucxD_BB6ah14-v0tykp6rSt2mLUQCvVwANWGRy5x8N_gitSV');
hook.send(`${message1}`);
}
module.exports.help = {
name: "terris"
}
It keeps showing the command before the message can anybody help me?
I keep getting this error for some reason
From that code
Takes ages for the error tho
I didn't tho
OOF @earnest phoenix did
Nvm
@earnest phoenix make a new webhook
leaking your id and secret means people can send to your hook
yes but remake your webhook
i can stick that in an eval and literally spam your channel

You should use m.connection.collection(<Collection>).findOne
Also u never defined it
OneDrive/Desktop
Github/C/Windows/
anyone able to answer a discord.js question?
probably
I am struggling to figure out how to parse a promise; it doesn't seem to behave like a normal object.
I sent a message and stored it in a const, now I am trying to delete said message using the message.delete(); but if I try that it will error that delete is not a function (my guess is because it is a promise not a message) but promise.message or promise.Message is also not working. Yet oddly I can promise.content.
@earnest phoenix thoughts?
const m = await message.channel.send("test");
m.delete();
worked fine for me
const Command = require('../../structures/Command');
const { MessageEmbed: Embed } = require('discord.js');
module.exports = class Help extends Command {
constructor() {
super({
name: 'help',
description: 'View a list of available commands, or view information for a specified command.',
aliases: ['h', '?'],
module: 'General',
developerOnly: false,
guildOnly: false,
});
}
async command(client, ctx) {
const locale = await client.getLocaleFromCache(ctx.guild.id);
console.log(locale);
let usersCommands = null;
ctx.client.d.developers.find(id => id == ctx.author.id) ? usersCommands = ctx.client.commands : usersCommands = ctx.client.commands.filter(cmd => !cmd.developerOnly);
if (!ctx.args.length) {
const embed = new Embed()
.setAuthor(locale.welcome.replace('{{commands}}', usersCommands.size))
.setDescription(locale.description)
.addField(locale.commandsTitle, usersCommands.map(c => `\`${c.name}\``).join(' \u200B '))
.setFooter('YouTube', client.user.displayAvatarURL({ format: 'png' }))
return ctx.send({ embed });
} else {
}
}
}
would anyone recommend a switch-case setup here or is if-else fine
performance wise
@earnest phoenix i see my issue, I was assigning it to the const while it was still a promise, I needed to add the await. Thank you
np 
@lusty dew User version of your bot user - bot.user
And all User/Member objects have attribute name
Hey, so im making a bot that picks out random memes, im making it in discord.py.
I can make it pick out images from an URL but not locally, can someone help me?
if someone can, please do send a dm
u do the x = [] thing and pick one of em at random
huh?
@earnest phoenix take a look at this random module, this is what you might want to use https://docs.python.org/3/library/random.html
can maybe someone explain me how i get the last message of a channel
i tryied it like this but its not working
I think it's lastMessageID if you're using discord.js
<Channel>.fetchMessage(<Channel>.lastMessageID) returns a promise message
or should
how do you mean Natan
I think he is refrencing the stuff found here https://discordapp.com/developers/docs/reference using the api endpoint instead
Integrate your service with Discord — whether it's a bot or a game or your whatever you wildest imagination can come up with.
I might be wrong tho cuz idk what he's talking about either 
i think he means because lastMessageID is cached and might be outdated, using something like fetchMessages() instead of fetchMessage() (in d.js) will get the latest messages from the api instead of relying on the cached lastmessageID
so you mean something like <Channel>.fetchMessages({limit:1})?
yeah
that should request it directly from the api without requiring a message id to be known
/home/ec2-user/discord
although in his case, if he wants to get the message he just sent, its much better to use something like .then(msg => {})
Where would I put the code to post server counts to dbl sites? My bot is sharded and only displays that specific shards' guild count instead of total guilds. Where would I put the code to make it work?
JavaScript with Cmd Handler
if you're not using internal sharding, you need to use broadcastEval i believe
i dont know if the sharding file has a ready event... i dont think so
Indeed it does
does it? then put it there
shard.on("spawn")
hmm
Yeah but what about rate limits?
you'd need to wait for all shards to spawn
oo
then use broadcastEval to get the guild count from all shards
wait
i think dbl also accepts individual shard count no?
so you can just have each shard send its count by using the shard id
i think that would be way easier
yeah it does .postStats(serverCount, [shardId], [shardCount])
why not?
NSFW Only bots are not allowed in this Server
the nsfw rule is only about having it in the description, shouldnt affect any api usage
oh they banned strictly nsfw bots too
Ye
Heyi get a DiscordAPIError: Missing Permissions when i try to send a message on only a few servers. i guess the bot has no permission to send messages in certain channels. how should i handle this? people are kicking the bot because he cant answer
or .catch(console.log)
i dont mean not getting the error. i mean what do i do about people kicking the bot because it doesnt respond
and wouldnt message.member check for permissions from the user who used the command, not the bot? lmao
Nothing you can do about that lmao. It's their choice
Darn
I was hoping you wouldn't see that Tim lmao
what you can do tho, if add your permissions to the bot invite link
that will automatically create a bot role when they add it
all the bots have the permission
Wouldn't if(message.guild.member(client.user).hasPermission("PERM")) work?
you should also check permissions on the channel
because even if the roles allow it, overrides may deny
i guess there are channels that need special roles or smth for writin. independet of the invite permission
yes
also, if your bot sends embeds, for example the help command in an embed, it needs the embed links permissions
but i wanna tell people whats going on
so you should add the embed links perm to your invite url
so they dont kick the bot but try in another channel
Hey Tim
manager.on('launch', shard => {
//shard.on("spawn", () => { console.log(`[Shard ${shard.id}] Shard has been spawned.`)})
shard.on("death", process => { console.log(`[Shard ${shard.id}] Shard has went offline.`)})
shard.on("disconnect", () => { console.log(`[Shard ${shard.id}] Shard has disconnected.`)})
shard.on("reconnecting", () => { console.log(`[Shard ${shard.id}] Shard is attempting to reconnect.`)})
if(shard.count > 3) console.log("Not yet")
else console.log("NOW!")
})
Bottom 2 lines
That would work right?
I tested it but all it says is NOW
I'm spawning 5 Shards
it's working in 350 of 353 guilds so its not about invite permissions
but does your invite url have permissions in it?
then its their fault, and should be treated as such
sure, i just would like to inform them about it
some people are just dumb, you cant fix their problems
You should see if the bot can DM the user that it doesn't have permission to speak there maybe
i mean, you can try sending them dms
^
but thats frowned upon
🤢
nobody likes getting dms from bots
i think the best practice is just rely on the users figuring it out
i mean
when people try to install something, they need to figure out how to use it too
nobody installs google chrome and then complains it isnt working
2019 people are just dum lul
yaaah sure but the creater has reason to make it easy for them
the only thing i do is listing the required permissions in my docs/description
the user interface and experience is part of the bot 😉
When Tim is the almighty god of #development
ikr
Literally everyone asks for him lol,
should work lol
im not even close to being a god, but i do enjoy explaining/teaching/helping, so i end up being here a lot xD
@earnest phoenix does an individual shard have a count property?
I dont think it does
so just use shard.id
i mean, you want to console.log something different if the current shard id is bigger than 3
Currently spawning 5 Shards and this still wont work:
manager.on('launch', shard => {
//shard.on("spawn", () => { console.log(`[Shard ${shard.id}] Shard has been spawned.`)})
shard.on("death", process => { console.log(`[Shard ${shard.id}] Shard has went offline.`)})
shard.on("disconnect", () => { console.log(`[Shard ${shard.id}] Shard has disconnected.`)})
shard.on("reconnecting", () => { console.log(`[Shard ${shard.id}] Shard is attempting to reconnect.`)})
if(shard.count === this.totalShards) console.log("NOW")
else console.log("Not Yet!")
})
this.totalShard is 5
shard id starts at 0
ah so you want to wait for the last shard?
Might as well do it that way lol Or would it not work as good?
@amber fractal Yeah i know, I also tried doing if(shard.count+1 === this.totalShard)
still nothing
the thing is
well try and log shard.count and this.totalShard seperately they may be undefined
you're launching all shards at the same time]
meaning shard 5 can finish launching before shard 4
so you cant use that method to find out when all shard finish launching
manager.spawn(this.totalShards, 1000)
Not really, there's a 1 second delay between shards getting spawned
ah alright
what if a shard fails to launch?
does the delay wait for it to retry?
what exactly is he trying to do?
Well if a shard fails to launch then i'm dun fucked 😂
This is what I use, and it does show the total amount of shards, which is 1 
i think what you should do
I could make a seperate command to post it to the servers
Do it every so often manually
Thats what mine is
is waiting for the ready event on each shard, and increment a variable with it, and check if the variable equals total shard count
but you can still broadcast eval in an auto poster
Screw it.
that way you can see when all shard are connected, regardless of connection order
You'd still need to broadcast eval 
then just in your bots main file
do it automatically
Wait no

disregard everything I said
.....
shard.on("ready", () => { connected++ })
shard.on("disconnect", () => { connected-- })```
Could I make a command that sets it on a timer and then posts it every so often such as like, every minute or so or would that be a lil spammy?
lul
Thats what I have
i have it every hour
Its just on a setTimeout() in a function that calls itself 
