#development
1 messages · Page 527 of 1
theres a way in python to avoid that
in c i just set loop, and add %A_Index%
let i = 0;
while(i++) {
if(i > 100) break;
// use i here
}```
but dont send a separate message for each number lol
you can also do js for(let i = 0; i < 100; i++) { //use i here }
Why is the DBL API for Java not working?
no idea, but if it doesnt work, just post it yourself
make an http post request
thats what i do (in js)
@quartz kindle works kinda, just had to set sleep function
use css in your html description
<style>
css here
</style>```
I want to make the bot image to a circle
Ok and how now?
everything
the same as its written in the picture
yes but it is not working
it works for me
where is the .columns .bot-img?
@ruby lichen that css is wrong
these are multiple classes on the same element, you cannot call them like that
if you do what you did, it will look for child elements, one inside the other, not only 1 element with all those classes
and all classes need a .
you just need one of those. the original one is .btn-orange. thats all you need
learn css
^
Someone wanna help me with iframes
you said earlier that they didnt work, like do they not load at all
@inner jewel so for my java problem where would i put @Override
you really should learn java basics before making a bot
@valid frigate yea they dont load
Why does it says 6 when I do the eval thing and says 22 servers on the DBL site?
Also, how do I view how many servers a shard handle? My bot got 3 shards.
I got nothing to do. I get bored
doesnt mean you should just go shard at 22 servers
I know I don’t need to shard if my bot don’t got 30+ servers
Ok thanks.
@earnest phoenix it's good that you're sharding early -- less hassle later
@pine herald you have to submit your bot on the website
@pine herald https://discordbots.org/bot/new
sharding at a few hundred servers is one thing...but 22? wow
Thats really early
Too early in my opinion
I got a quick question for all you discord bot coders out there. I coded my bot with JS. I was wondering how I could make the users vote to access certain commands. How can I make this possible?
idk js but i would just check if they voted or not
theres api documentation

@pastel mulch I dont know how to make them vote for certain commands but I think you have to be using a certain library to do that
Use the webhook for vote checks
You are less likely to throttle and you will receive information as it's available
WHERE IS MY SUPER SUIT?
@earnest phoenix put memes in #memes-and-media
THIS IS NOT A MEME
THIS IS ME BEING CONCERNED
BECAUSE I CAN'T FIND MY SUPER SUIT
!
<!DOCTYPE html>
<head>
<title>Where's my super suit?</title>
</head>
<body>
<h1>WHERE IS MY SUPER SUIT?!?!?!?!?!</h1>
</body>
</html>```
there you go
Anyone else ever gotten this with Discord.JS? https://weed.moe/HjqlQCZu.png
i dont thank i ever saw that before
Yeah
I’ve never seen that error
it happened to my project before, for unknown reason, maybe because of the restart, or mybe it was about connecting to discord
It seems like it would be server-side or somewhere in between.
that too
That happened when discord was having outages
I almost said it was a runtime error, because I apparently forgot how Javascript works lol
Bulamadim
minute*
How to install linux discord bot @gleaming glen
lemme help you in #memes-and-media, u dont need to use translate
so uhh my NPM install got stuck
idk what i fucked up in package.json but i cant install any modules anymore
@short hinge send ur pkg.json here i could try to fix it for u
sure
@bot.event
async def on_raw_reaction_add(payload):
if payload.emoji.name == 'golden_apple':
print('emoji is fine')
guild = bot.get_guild(payload.guild_id)
member = guild.get_member(payload.user_id)
if not member.bot:
print('we arrived here')
role = discord.utils.get(guild.roles, name=("bla bla"))
return await member.add_role(role)
``` why its not working?
Rewrite
Judging by their messages in here and d.py rewrite help channel :p
@earnest phoenix Does it not assign the role with name bla bla?
And does it even print anything?
Don’t use on_raw
y tho
@queen sentinel is this legal
264811613708746752
if you want to speak Polish do it in #memes-and-media
is okay
😊
So I guess that answer to my question is no
https://discord.js.org/#/docs/main/stable/class/Shard?scrollTo=e-death the shard will emit a death event when it gets killed or disconnect if it disconnects
Much appreciated ❤ @valid frigate
👌
you can't emit that event iirc
darn
the shard will tell you when it dies/disconnects
What if I was to process.exit(), you think that would tell me then?
most likely it would emit death and then exit yeah
Okay thanks
how do you make hentai command
well
asking for a friend
mhm
in specific situations thats a good idea
It works tho, at least for me
it would be better to like have a website
and grab the image data from said website
its not very hard to web scrape
If all else fails just fetch from a hentai subreddit, i heard reddits web api is easy to use
bliz my suggestion would just be to webscrape
if you dont know how to do that then i cant explain it
Technically thats what im suggesting too
I meant the reddit fetch thing
why not just scrape the actual website 
Iirc its like https://reddit.com/r/reddit/random.json or smth like that
im trying to make a thing that will add to a .json file in .js but when i use fs.appendFile but it always outputs like this ```[
]"asdasd"```
i mean like a list of blacklisted roles that the bot cannot give to normal users
because it literally appends the string to the end of the file
if you actually want to use .json and accept the risk of data corruption, a better idea would be to write the entire object (array in your case) in the file
so like something that could add to the array like copy old + new then write it
basically, yes
ok thanks
whats the best way i should store each individual user in my server's custom items? i have a db but im not sure how to implement it
If you put the array in the js file you can use .push to add to it @earnest phoenix
let myArray = ['a', 'b'];
myArray.push('c');
//myArray will be -> ['a', 'b', 'c']```
anyone knows why i get an error, ReferenceError: channel is not defined
wesley would defining it first in the js file then writing it to the json work
Yes sure
ok thanks
What is channel @earnest phoenix 
lol
i mean i know the channel
just forgot to specify it
god
yet i get same error, its supposed to send message to channel
that command is executed in
msg.channel?
yes
And that doesn't work? 👀
do you have client.on
of course.
What have you defined message as?
anyone know how i can list all servers with the member counts for each server on dpy
yes
If i was on my computer
I would spoonfeed you
I'll give you a hint
for ge in bot.guilds:
print("Server ID: {} Server Name: {} Member Count: {}".format(server.id,server.name,server.member_count) for server in client.servers)
would this work
print("Server ID: `{}` Server Name: `{}` Member Count: {}".format(server.id,server.name,server.member_count) for server in client.servers)
try it and see
try something like "\n".join([<that thing>])
instead of .format right?
no
I would say setting a loop before print
@client.command(pass_context=True)
async def servers1(ctx):
print("Server ID: `{}` Server Name: `{}` Member Count: {}\n".format(server.id,server.name,server.member_count) for server in client.servers)
print("\n".join(["...".format(...) for server in client.servers]))
since you're printing to stdout a for loop may be better
to send as a message a list comprehension would be easier
Just simplify your loop
lemme try both
it works
but any idea how i could make it send it in a text file?
cos if i have too many servers
it wont send the msg
Experiment with file r/w
Just file = open(...)
For item in list:
File write item
any docs on it?
Yeah
Don't even need imports
Simple code, search open method
file = open("log.txt")
for item in your_list:
file.write(item)
file.close()```
Learn python :p
so item = ("\n".join(["Server ID: `{}` Server Name: `{}` Member Count: {}\n".format(server.id,server.name,server.member_count) for server in client.servers]))```
XD
No
you can upload files in discord.py without reading from disk
so item = ["Server ID: {} Server Name: {} Member Count: {}\n".format(server.id,server.name,server.member_count) for server in client.servers]
yeah
[] is a list
how
stringIO? @inner jewel
thats what i wanted @inner jewel
string = "\n".join(["...".format(...) for server in client.servers])
bytes = io.BytesIO(bytearray(string, "utf8"))
await send(file=discord.File(bytes, "filename.txt"))```
I actually learnt something
that should work according to d.py/python docs + stackoverflow
I don't even tried this in my life 😂
Lol
lemme try
But if he wanna do this like a beginner, he could just do a local file but your method is a way simple
Ignoring exception in command servers1
Traceback (most recent call last):
File "C:\Users\hamza_000.HAMZA.000\AppData\Local\Programs\Python\Python36-32\lib\site-packages\discord\ext\commands\core.py", line 50, in wrapped
ret = yield from coro(*args, **kwargs)
File "C:\Users\hamza_000.HAMZA.000\Desktop\discord bot python\ChatManager\ChatManager 6.py", line 414, in servers1
bytes = io.BytesIO(bytearray(string, "utf8"))
NameError: name 'io' is not defined
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "C:\Users\hamza_000.HAMZA.000\AppData\Local\Programs\Python\Python36-32\lib\site-packages\discord\ext\commands\bot.py", line 846, in process_commands
yield from command.invoke(ctx)
File "C:\Users\hamza_000.HAMZA.000\AppData\Local\Programs\Python\Python36-32\lib\site-packages\discord\ext\commands\core.py", line 374, in invoke
yield from injected(*ctx.args, **ctx.kwargs)
File "C:\Users\hamza_000.HAMZA.000\AppData\Local\Programs\Python\Python36-32\lib\site-packages\discord\ext\commands\core.py", line 54, in wrapped
raise CommandInvokeError(e) from e
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: NameError: name 'io' is not defined
what imports?
import io
lemme try that
You will have to learn more python for this purpose
nah its fine
await send(file=discord.File(bytes, "serverslist.txt"))
i dont think that would work
@inner jewel
that's pseudocode
would client.say work?
not copy paste code
k
i got that
I will leave, have fun with your code ^^ bye
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: AttributeError: module 'discord' has no attribute 'File'```
uhh
learn python
just dont say that
yes
then idk
oh okay
the code i searched was for rewrite
thanks anyways
`TypeError: Cannot read property 'on' of undefined
`
someUndefinedVariable.on
did you add the { webhookPort: 5000, webhookAuth: 'password' } part
not sure why you calling .on for .webhook
but dbl.webhook is only defined if https://javascript.is-bad.com/2de2ea.png
@earnest phoenix use rewrite
async is outdated
and never update
what?
What is better? pm2 or tmux
pm2
ok
tmux is a terminal multiplexer tho
am i able to get html help here
yes
https://cdn.discordapp.com/attachments/468251255303569408/517106145299660810/unknown.png
as you can see here, it shows a redirect for homepage, and u can see homepage exists, but when i go to redirect it says
and the css is not doing anything, so its not reading from other files in the folder is what im thinking
https://catmaniabot.glitch.me/
look there for full error, if you want to see it
Cannot GET /homepage.html
is there a route called homepage.html
You need to add all pages as routes in express
is there a way with discord's richembed to edit an embed like
channel.fetchMessage('msgid').setDescription("new description")
kinda thing?
yes
h o w?
idk exactly how with discord's builder, because i use literal object instead, but im pretty sure message has an embed property that you can edit
ok sooooooo? message.embeds.setdescription?
message.edit(message.embeds[embedindex because its an array].setdescription)
something like that
oh i see
@quartz kindle
try new Discord.RichEmbed(result.embeds[0]);
sks
lul
wow i legit did not see that at all 
even if you edit the data you have it won't update the message
hes doing it in a message edit thing
basically message edit needs a whole new message to replace the old one with, so just build a new embed using the old embed data
why do i keep screwing up my bot
what does your bot do? what language?
it's a bot that adds a rating system into your server where you can rate memes, jokes, etc. with a reddit-like karma system, and it's coded in javascript
really all im doing is trying to port the database im using because my original hosting service wont work with sqlite
pins
vps
Ok I checked the pins thanks
I'll probably end up using aws because i've heard a bit about it
Hetzners voice connection has been blocked my discord
How do I prevent my bot from talking in channels it's not supposed to?
Can it be done with just a role?
Well i'll just do it with a role
Also i assume it won't ever see messages in channels it doesn't have access to?
yup
bots are just like normal users so they dont even know that the channel exists if it doesn't have read message perms
how to remove the .png part on the link?
of what link?
@earnest phoenix actually they can
The client hides it in most cases but you can see channels you don't have perms for
Need cheap hosting options for a music bot, anyone got any ideas?
Check pins
they can see channels but cant fetch messages / wont receive message events, right?
Yes
Anybody know any tutorials on the web about creating an API?
Is this allow
https://prnt.sc/lo1pav
for the error, imo the best option is checking for permissions
before trying to send
eg on message, if no perms to send, ignore
¯_(ツ)_/¯
oof
undefined:1
SyntaxError: Unexpected end of JSON input
at JSON.parse (<anonymous>)
at Object.<anonymous> (C:\Users\Administrator\Desktop\yvsYedek\server.js:633:19)
at Module._compile (internal/modules/cjs/loader.js:688:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:699:10)
at Module.load (internal/modules/cjs/loader.js:598:32)
at tryModuleLoad (internal/modules/cjs/loader.js:537:12)
at Function.Module._load (internal/modules/cjs/loader.js:529:3)
at Function.Module.runMain (internal/modules/cjs/loader.js:741:12)
at startup (internal/bootstrap/node.js:285:19)
at bootstrapNodeJSCore (internal/bootstrap/node.js:739:3)
Help me
SyntaxError: Unexpected end of JSON input
whats the json
How do I make my bot send emojis in embeds?
Which programming language @amber junco?
js
client.emojis.get('id of the emoji').toString()
@amber junco if its a default emoji, ctrl c the unicode version by doing \:poop:
oh ok
If not, i dont remember lol
I just sent
ok
client.emojis.get('id of the emoji').toString()
then what?
toString is a default js method
Can be overwritten.
^
TypeError: e.replace is not a function
at Client.client.on.e (C:\Users\Administrator\Desktop\yvsYedek\server.js:354:29)
at Client.emit (events.js:182:13)
at WebSocketConnection.onError (C:\Users\Administrator\Desktop\yvsYedek\node_modules\discord.js\src\client\websocket\WebSocketConnection.js:374:17)
at WebSocket.onError (C:\Users\Administrator\Desktop\yvsYedek\node_modules\ws\lib\event-target.js:128:16)
at WebSocket.emit (events.js:182:13)
at _receiver.cleanup (C:\Users\Administrator\Desktop\yvsYedek\node_modules\ws\lib\websocket.js:211:14)
at Receiver.cleanup (C:\Users\Administrator\Desktop\yvsYedek\node_modules\ws\lib\receiver.js:535:15)
at WebSocket.finalize (C:\Users\Administrator\Desktop\yvsYedek\node_modules\ws\lib\websocket.js:206:20)
at TLSSocket.emit (events.js:182:13)
at emitErrorNT (internal/streams/destroy.js:82:8)
New error :(
e is not a string
YAni?
Helppp
it says replace isn’t a function
I’m not gonna spoonfeed you code, but if it says it isn’t a function you have to find another way to replace it
How will i do so urgently please
e isn't a string.
what about "e"?
@slender thistle i assume he passed e as a variable, rather than as a string
e is supposed to be a variable in that case, no?
Several people above said that e is not a string in this case
wait there was convo about this before?
Scroll up a bit :p
Yaw yardım edin
other languages in #memes-and-media
I'm really happy with how my command page turned out https://essem.space/esmBot/commands.html
It's pretty much a gist embedded in a webpage, but without it saying it's a gist, and actually renders markdown properly
does it take some time to display guild count when you update it ?
Do you guys support setting the authorization for webhook via the API?
Is it okay to mention one of the website admins?
no
for valid reason yes
greenbigfrogToday at 6:07 PM
Do you guys support setting the authorization for webhook via the API?
@bitter sundial
(just noticed there's an #topgg-api channel... smh I must rly be bling)
no we don't
Any reason why not?
WHAT THE HELL IS WRONG WITH ME?
https://pastebin.com/25vxixpt
@surreal saffron File "/Users/gebruiker/Documents/Python/Flipp3rrrBot.py", line 25, in <module>
client.run(TOKEN)
Pastebin isn't working for me, what's the error?
TOKEN = 'I inserted the token here but I wont show it to you'
@slender thistle https://gist.github.com/owenselles/69a7da1c87e1b38f8aefa486df051300
i copied for u
I got it in a server and stuff
@hallow prairie And please do not point at random things if you don't know what to do
Well, you are running it but it can't connect to Discord servers for whatever reasons
aiohttp.client_exceptions.ClientConnectorCertificateError: Cannot connect to host discordapp.com:443 ssl:True [SSLCertVerificationError: (1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1051)')]
looks like your ssl certificates are broken
Is that Mac?
I don't have SSL, it said it was pre-installed with Python.
yes you have ssl
And yes it's a MacBook.
you can't use discord without ssl
Aight, one sec
I meant I don't have a certificate for SSL...
Getting [SSL: CERTIFICATE_VERIFY_FAILED] on Python 3.6 on OS X?
Navigate to your Applications/Python 3.6/ folder and double click the Install Certificates.command to fix this.
Happy coding!
Simply copied ofc
Instead of 3.6, see 3.7 because I hope you know why
I got Python 3.7
It still doesn't work:
# Work with Python 3.6
import discord
TOKEN = 'XXXXXXXXXX'
client = discord.Client()
@client.event
async def on_message(message):
# we do not want the bot to reply to itself
if message.author == client.user:
return
if message.content.startswith('!hello'):
msg = 'Hello {0.author.mention}'.format(message)
await client.send_message(message.channel, msg)
@client.event
async def on_ready():
print('Logged in as')
print(client.user.name)
print(client.user.id)
print('------')
client.run(TOKEN)
My bot doesn't respond to !hello
Here is the tutorial I'm doing: https://www.devdungeon.com/content/make-discord-bot-python
- That's code for async discord.py. You need to adapt it to rewrite.
- Read migrating guide. https://discordpy.readthedocs.io/en/rewrite/migrating
- Learning some Python ofc.
- OOP!
- Where can I find it?
- Error 404
- Already done
- Uhm?
- Give me a moment, I failed the link.
- Refer to option 1.
- Noice.
- Object-Oriented Programming.
Thank you very much! It works!
is it possible to get all votes from the past 12 hours?
How much time do you guys think it would take to port a bot from js to py
depends on the size of the bot, how much you know of the languages, etc
With like 2/10 knowledge of Python lol
is it possible to make my bot invite other bots with a command
so like !invite (ID)
would add the bot
to your server
Nope
There's a captcha lol
Api doesnt support unauthorized bot joins
alright
thanks anyway
s
is it possible to edit an existing file (add info) on dpy async
if yes can someone send me a link
Has anybody got a link to a tutorial on how to add a web dashboard for a javascript bot please?
theres an oauth2 guide on djs.guide, thats as far as you can get, https://discordjs.guide/#/oauth2/
how to make a rest api, how to handle oauth2, how to make a front end
Would you consider it quite complicated?
if your new to it, yes
for starters you can try playing around with express.js or something
wait since your bot acts as a middleman, can't you host a bot and a website form the same code
and then use that as a like bot/website communicator
and then bam don't you have a website dashboard thingy
client.channels.get(517441679511519242).send("message");
It says type error, cannot read property 'send' of undefined
i am so confused
the long number is the channel ID
should it be channels.get(channelID).send?
i feel like i did something wrong
You need “13422233”
Client.channels.get(”channel id”).send(“message”)
@vernal basin
@quartz kindle Express is so slowwww
@cold harness I used to do this, but I quickly realized that it's not very smart.
it may be slow, but its the most popular webserver framework and has the biggest community
and it still handles 10k requests per second
im using fastify now
not like web server performance even matters for a web dashboard
unless you have tens of thousands of users using the dashboard at the same time
Just because its popular doesn't mean its good
Personally @quartz kindle, I recommend polka
Its faster than fastify for one.
also, it has an api that is very similar to express
so you can basically switch
const app = require('express')();
//to this
const app = require('polka')();
For the most part, and get a big speed increase
is there some way to take the name of a channel, get the bot to take that channel and then post in a channel with a specific name? for example:
#channel-a is where the message is sent
#channel-a-test is where i want the bot to respond.
I mean, just scroll down and look at the benchmarks
Express is last, at 24k requests per second
Polka only loses to native http module, at 50k requests per second
So even for a simple app, you'll be getting a 35-40% speed increase
nvm
Was about to say natan. no way 
they're about the same, not necessarily faster
polka and fastify
depends on which benchmark you follow
if you go by transfer speed fastify wins
yea I'd say margin of error, since benchamrks vary.
But we can all agree, that either choice is better thna express
again, not like performance matters for a discord bot
if you don't have thousands of concurrent accesses
just use whatever is easier
I mean, there is a point where you can't be ignorant
polka is basically express's API.
anything is easy if you take time to learn it
there's also turbo-http which is a node http replacement
roughly twice as fast as all others
koa exists
restana + turbo-http = fastest node framework
what about just http
is there some way to take the name of a channel, get the bot to take that channel and then post in a channel with a specific name? for example:
#channel-a is where the message is sent
#channel-a-test is where i want the bot to respond.
and this would go for letters a, b, c, d, e, and so forth. (is there some way to do this using channel ID's? I'm not sure if there's a correlation between channel ID and name of channel though.)
If you have a set channel you can just have your code so it gets the channel you want to send it in and then responds in there
ah i see
what
Yes IDs are strings
Well many languages like js will screw them up cuz they're too big
That's why they're strings in the first place
Not python
ok but imagine having to indent everything 
You get used to it at some point 
no need to imagine
a lot of bots are actually triggering message updated after the embed load
because they don't filter
i guess yeah
.send({ server_count: client.guilds.size })
to Send guilds size
how to update shard count?
shard_count?
@sick cloud koa is one of the slowest http frameworks you can use
Yeah use express
coment on fais un bot
Use polka
@zealous veldt Express is even slower 
Hi
Hey so I really need some help, i've asked a few other people and theyre like "oh it should be working idk whats causing it"
Whenever someone new tries to use my bot that hasn't before, it doesn't respond. I have to reload the bot and then it works for them.
and sometimes if someone has used the bot before, and then they try to use a command, it doesn't work for them either.
I can send my index file if someone wants to try to help me
if two channels with related names are in the same category, is there a way to send a message to a specific channel without using channel ID?
Category A:
- #channel-a is where the bot receives a command
- #channel-a-test is where the bot should send the message
@oak cliff if its javascript I could help
can you send it in hastebin.com or hatebin.com if it's down since that link broke for me
I dont see anything that wouldn't let them not use the bot
heres a screenshot of it happening
im really frustrated cause it should be working by all accounts but it doesnt >.<
alright, will try
so the bot will pause in the middle of the function and you can inspect the local variables
uh yeah i knew how to do that
the issue i was having earlier with that was i have the ids
how do i find the actual channel and what server its in
Are you using specific ids
well when my bot can't post, it sends a message in console with the path, which has an id in it
to get the guild id that the channel is in you do
<Client>.channels.get('id').guild.id
i see thank you
Anyone able to help me with a really quick js code pm me
No. No one will pm you
Ask the question here if it has to do with bot development
people are V stupid in general
the people in general are the same people in here

if i have an array of values (ie. [true, false, true true]) how could i make a % like 75% true
like a report of the values
filter
yeah, like out of the 4 results, 75% were true
Or what's that thing
Reduce
Use reduce to check if it is true if so add certain proportion of total
f=>if(element == true) {
percent += 100/array.length
}
@sick cloud
Np
let n = 0;
let l = array.length;
for(let i = 0, i < l; i++) {
if(array[i]) n++;
}
result = n*100/l```
what is the best database to use in a bot that exceeds 500 servers and can be modified easily?
Well there's no best database
^
I will use MongoDB but most commands will be in WEB DASHBOARD
^
👍
mongo or rethink are your best bets tho
rethink is better for realtime as well, since thats what it was made for
Im having trouble implementing server count into my bot (python), it says bot is undefined. Any fixes?
make bot defined
to your bot
to your bots client or whatever
no
o
the client object
like if you have client.login or something, idk
you set it to client
i dont use python
client = discord.Client()
i'll try doing bot = discord.Client()
Exception has occurred: AttributeError
any dev know python that can help?
Im having trouble implementing server count into my bot (python), it says bot is undefined. Any fixes?
@west raptor latest, i believe (im also using python 3.6.7)
if two channels with related names are in the same category, is there a way to send a message to a specific channel without using channel ID?
Category A:
- #channel-a is where the bot receives a command
- #channel-a-test is where the bot should send the message
there is a category ID, is there some way to make use of that?
@vernal basin whenever you ask a question always say the lib
however you should know that there can be 2 channels with the same name in one category
ik. is there some workaround like, if it's given there isn't 2 duplicate names?
discord.js
k gimme a sec
@safe path what is "latest"
is there way i can set images format from data:image/png;base64, to embed.setThumbnail("")
upload
IDK man im a python beginner
a python beginner knows what version of something they are using?
thats not an excuse
async or rewrite
@knotty steeple async
@vernal basin js message.guild.channels.filter(c => c.parentID === 'CATEGORYID' && c.name === 'CHANNELNAME').first()
fs.readdir('./cmds/', (err, file) => {
if(err) console.log(err)
let jsfile = files.filter(f => f.split(".").pop() === "js")
if(jsfile.length <= 0) {
console.log("Err: Could not find commands.");
return
}
});
it says files isnt defined
That would be true, you called it file
Trying to made a command handler that gathers commands from different folders. The furthest I've gotten is below, everything is working below this message so far. Except
jsfile.forEach(function(f, i){
let props = require(\`${config.commanddir}${config.commands[i2]}/${f}\`);
props.config.command.forEach(function(name){
bot.commands.set(name, props);
});
});```
entire code is here
```let index;
for(index=0;index<config.commands.length;index++){
let i2 = index;
fs.readdir(config.commanddir + config.commands[index], function(err, files){
if(err) console.log(err);
let jsfile = files.filter(f => f.split('.').pop() == 'js');
if(jsfile.length<=0){
console.log('error reading files');
}
jsfile.forEach(function(f, i){
let props = require(`${config.commanddir}${config.commands[i2]}/${f}`);
props.config.command.forEach(function(name){
bot.commands.set(name, props);
});
});
});
};```
what language is this
Discord js, so java script. Sorry i forget to mention
did you mean commands?
maybe lol
lol
I have a working one if you want it
changed it and got same error
hmm
@safe path Full error and full code please
I’ll get it to you tm, it’s late for me
👌
anyone here good at html lol
What do you need help with @earnest phoenix?
Which part are you stuck on?
Everything 😂
I dont expect a spoon feed but how do u change the background of the color
If you mean color of the background, then it would be
element {
background-color: #FFFFFF;
}
in your stylesheet -- The element would most likely be body if you're trying to change the background for the entire website
Related resources: https://www.w3schools.com/CSSref/pr_background-color.asp
ty
@meager garden sorry for ping but when i edit the website and do <person> it cancels it out how can i stop that?
No worries about the ping, but I'm not sure what you mean about your error
<text> defines an HTML tag, if you're trying to get a line of code it would be
`<person>`
The 2 `'s define the line of code

K
I believe you can also escape it by adding a \ in front of it
whats the best way to make a reminder in js?(and if the process turns off it still works if i reboot)
Save the reminder time and message in a db
Then check your reminder table each x minutes for and compare the time if reached send the reminder and flag it as done or delete it
@latent willow the issue with that is if the process turns off then.... it would stop counting
You don't count you just save the time when the reminder should be triggered and compare it to the current time whenever you check
You can also use <person> @bitter sundial
@topaz fjord yeah but I dont really like the look of that lol
meh
and yeah the markdown parser might use \ which would just look nicer
u
how can i get the avatar of a user in a new member event
What lib
the channel description should tell you to state your library...
is there anything else rather than ffmpeg to play audio?
Javascript @slender thistle @echo pumice
That's not a library
@earnest phoenix that's a language not a lib
discord.js
guys is ffmpeg an app i dont get it
is that a library
??
will it work if i transfer my app to another place
umm... how make ur bot automatically send images and messages to a channel?
Example:
!set-image
The bot sends images daily
how do I make my bot say “I don’t have permission to do that” when the channel has missing permissions because I keep on getting errors from that (discord.py) mention when answering me question
if (!message.guild.me.hasPermission
thats for js righ?
yes
k
?>
oh
it will work if you transfer your app, as long as ffmpeg is installed correcttly
now, how do i make this work
let role1 = member.guild.roles.find("name", "▃▃▃▃▃▃▃▃▃▃");
let role2 = member.guild.roles.find("name", "Player 👊");
let role3 = member.guild.roles.find("name", "Bots");
if(!member.bot) return member.addRole(role1).catch(console.error);
if(!member.bot) return member.addRole(role2).catch(console.error);
if(member.bot) return member.addRole(role3).catch(console.error);
try using else ifs
and not indenting your code incorrectly
and go to #381889950666457088
#deleted-channel ?
join discord api
welp but i need to isntall ffmpeg ont he other machine too?
umm... how make ur bot automatically send images and messages to a channel?
Example:
!set-image
The bot sends images daily
save the channel and image, etc.
and use a timer, or whatever your language has to send messages
@earnest phoenix look up what it is and don't just say no
its hard there are a lot of thigs i do.t know im so confused
do one thing at a time
no reason to be confused unless you're handling race conditions
is there anyway to make it so if someone joins the server with an invite my bot can say who the inviter was?
would anyone be able to help me with a npm install?
https://i.imgur.com/29WQBkn.png @dim grove
it keeps saying "Sorry, name can only contain URL-friendly characters."
Oh, just found out.
!invite
Corrected that, it no longer DMs on leave.
For the NPM install, what are you trying to install? As in, what exactly are you typing?
Huh.
@serene sun what are you trying to install?
(node:15740) UnhandledPromiseRejectionWarning: RangeError: RichEmbed field values may not be empty.
at RichEmbed.addField (/rbd/pnpm-volume/796e667b-22ab-4154-b10d-18c07f3647b5/node_modules/.registry.npmjs.org/discord.js/11.4.2/node_modules/discord.js/src/structures/RichEmbed.js:165:34)
at Object.module.exports.run (/app/cmds/8ball.js:20:8)
at Client.bot.on (/app/index.js:39:28)
at emitOne (events.js:116:13)
at Client.emit (events.js:211:7)
at MessageCreateHandler.handle (/rbd/pnpm-volume/796e667b-22ab-4154-b10d-18c07f3647b5/node_modules/.registry.npmjs.org/discord.js/11.4.2/node_modules/discord.js/src/client/websocket/packets/handlers/MessageCreate.js:9:34)
at WebSocketPacketManager.handle (/rbd/pnpm-volume/796e667b-22ab-4154-b10d-18c07f3647b5/node_modules/.registry.npmjs.org/discord.js/11.4.2/node_modules/discord.js/src/client/websocket/packets/WebSocketPacketManager.js:103:65)
at WebSocketConnection.onPacket (/rbd/pnpm-volume/796e667b-22ab-4154-b10d-18c07f3647b5/node_modules/.registry.npmjs.org/discord.js/11.4.2/node_modules/discord.js/src/client/websocket/WebSocketConnection.js:333:35)
at WebSocketConnection.onMessage (/rbd/pnpm-volume/796e667b-22ab-4154-b10d-18c07f3647b5/node_modules/.registry.npmjs.org/discord.js/11.4.2/node_modules/discord.js/src/client/websocket/WebSocketConnection.js:296:17)
at WebSocket.onMessage (/rbd/pnpm-volume/796e667b-22ab-4154-b10d-18c07f3647b5/node_modules/.registry.npmjs.org/ws/4.1.0/node_modules/ws/lib/event-target.js:120:16)
(node:15740) 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:15740) [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.
I dont know what this means
I dont send empty embeds
@empty owl I think it's self-explainatory
ik
but its not empty
let choicesrandom = choices[Math.floor(Math.random() * choices.length)]
let ballEmbed = new Discord.RichEmbed()
.addField('Question', question)
.addField('Answer', ${choicesrandom})
.setFooter(Asked by ${message.author.username})
message.channel.send({embed: ballEmbed});
let diceEmbed = new Discord.RichEmbed()
.addField(${message.author.username} rolled a dice, ${LAOL} ${lol})
.setFooter('Dice')
message.channel.send({embed: diceEmbed});
see?
I can show u my whole code if u want
here
token
its protected in the env
collaborators can see it
ik
ello
but i didnt invite to collab
How do i make a bot lol
um what???
@empty finch u dont
boi watch a yt seris
relax
hey idk why this isnt working but can anyone help me with this
client.shard.broadcastEval(`let guildDef = this.guilds.get('506559251167313920'); let user; let hasRole; if(guildDef) user = guildDef.members.get('${msg.author.id}'); if(user) { if(guildDef.member(user).roles.some(r=>["Premium"].includes(r.name))) { hasRole = "true" } else { hasRole = "false" } } else hasRole = "false"; hasRole;`)
user = guildDef.members.get('${msg.author.id}'); guildDef.member(user) it's already a member
.some(r=>["Premium"].includes(r.name)) should be .find(r => r.name === "Premium")
also why hasRole = "true"/hasRole = "false" instead of just using booleans?
could anyone help me with a npm install?
you could also initialize it to false and remove the assignments to false
o ok
Why not just <member>.hasRole()
Can anyone help me with this: https://github.com/lokesh/color-thief/
All I want to do is
grab the url param "src" from the URL
and then just return the dominant colour
on the webpage
but idk why it's not working
how would i make something not run in a ready event because it does not use member or message so it cant be that so wat would be before guild.id
client.on('ready', () => {
wait(1000);
client.guilds.forEach(g => {
g.fetchInvites().then(guildInvites => {
invites[g.id] = guildInvites;
});
});
});
I see
i want it to be only for 1 guild
U trying to check invites?
yes
first








