#development
1 messages · Page 1689 of 1
from discord.ext import commands, tasks
import dbl
import os
from setuptools import find_packages, setup
class TopGG(commands.Cog):
"""
This example uses tasks provided by discord.ext to create a task that posts guild count to top.gg every 30 minutes.
"""
def __init__(self, bot):
self.bot = bot
self.token = os.environ.get("dbl_token") # set this to your DBL token
self.dblpy = dbl.DBLClient(self.bot, self.token)
self.update_stats.start()
def cog_unload(self):
self.update_stats.cancel()
@tasks.loop(minutes=30)
async def update_stats(self):
"""This function runs every 30 minutes to automatically update your server count."""
await self.bot.wait_until_ready()
try:
server_count = len(self.bot.guilds)
await self.dblpy.post_guild_count(server_count)
print('Posted server count ({})'.format(server_count))
except Exception as e:
print('Failed to post server count\n{}: {}'.format(type(e).__name__, e))
def setup(bot):
bot.add_cog(TopGG(bot))
youre welcome to friend be but like theyres a 99% chance ill decline it
so i dont recommend that
Lol
uh
Well I got 1% of destiny on my side
"i hope to see you again" doesnt exist in programming and tech support. what you want is "i hope i never see you again", because it means it worked
I'll take my chances
when hes helping nerds

I'm sure I'll have some error
and im making fun of them
Thank you again
np
I am not.worthy of your presence
i want updates!
I will
I'm sad i gotta trash what I made tho
But alas...thus is life
The wheel turns
Destiny guides us all
Ok I had to stop and come back for a sec
You are right this video.is way better
Ty again
Hello I'm back
Os.chdir(mybot)
Where do I find the right words to replace mybot
btw who gone check the test bot
php™️
i have a txt file, with a bunch of words, each one in a line, how can i check if a string has any of those words?
py
Found a fix.... on 256mb ram allocation it showed the incorrect bytes used.... fixed the code
read the file, split by lines, iterate through the words with a for-else statement and check if it's in the string, if so break. If it didn't break, it goes to the else statement, which means the string doesn't contain any word from the file. There are certainly better algorithms for this, this is just a quick approach.
@drifting wedge u could use regex
You could probably do the check in one line using any()
basically i need to check if a string is a url/website
pls do shiv isnt here and i dont feel like coding
so pls do it for me
jkjk
but if you do have something
id love to use it
but explain how it works lol
((http|ftp|wss|https):\/\/[\w\-_]+(\.[\w\-_]+)+([\w\-\.,@?^=%&:/~\+#]*[\w\-\@?^=%&/~\+#])?)
explain pls
thats the pattern
ive NEVER done regex
oh ok
so idk ANYTHING
use that knowledge and use the pattern i gave ya
If you were to go with the regex approach, refer to this as well https://docs.python.org/3/library/re.html
https://i.callumdev.pw/sjfrz.png
since I prevent the default action on the submit form (to stop the redirect and use a custom post request)
how can I still make sure it checks that all required fields have an input?
whats the method for this?
If you're sure the url will only be in the beginning, use re.match, otherwise use re.search
k cool
ty
re.search("((http|ftp|wss|https):\/\/[\w\-_]+(\.[\w\-_]+)+([\w\-\.,@?^=%&:/~\+#]*[\w\-\@?^=%&/~\+#])?)", content): so like this?
try that, but I think you should use raw string
wdym?
content is just the raw string but all lowercase
shouldnt affect anything
No, I mean the pattern, since you don't wanna escape the backslash, but idk try it
OHHHH
elif re.search("""((http|ftp|wss|https):\/\/[\w\-_]+(\.[\w\-_]+)+([\w\-\.,@?^=%&:/~\+#]*[\w\-\@?^=%&/~\+#])?)""", content):
should this work?
yeah sorry, this pattern comes from dotnet regex
i dont know for sure it js takes it like that
that's just multiline strings, not a raw string
(im doing py)
double quote ?
Why are you trying to write your own URL validator anyway
how do i do a raw string?
I just tried it using general string, it works dw
'
r""
what error?
not errors
alerts
can be ignored
it was bc of escape \
what string types are there?
f and r?
there are binary literals and unicode literals as well
b"" and u"", you can combine those ig
doesnt appear to work
only with actual https://
google.com works
and like www.google.com
if its only for https links i can just use if https:// or http://
What are the inputs?
what i put?
i tried
Search the world's information, including webpages, images, videos and more. Google has many special features to help you find exactly what you're looking for.
ah, the scheme is required, you can make it optional
but that might lead to false-positive ig not sure
i dont know that much advanced shit lol
what is a scheme?
also whats a kwarg lol
scheme is like ftp, http, wss
wss?
kwarg is a keyword argument https://www.python.org/dev/peps/pep-3102/
For websocket
oh
these are schemes
yeah, if you make the scheme optional, it'll match a.b which is not quite what you want 
But the clickable ones are the ones with the scheme, aren't they?
i mean the question isnt neccessarily about if i should use regex
but how i should deal with links
like should i block the clickable links
or just ALL links
wss://google.com
thats not clickable?
Seems only https? clickable, not sure
that's why I put a question mark, the s is optional
OOHH
thats a tihng
lol i havent looked into advanced stuff yet lol
how would that work?
https? in message.content?
in a string?
it's a regex pattern
? means "match 0 or 1 of the preceding token"
regex is not hard at all
you just need to understand what each thing is
says the person who knows regex
Just need some time and effort 
and most importantly, don't try to read other people's regex
it's impossible
it's dangerous to go alone, take this with you https://regexr.com/
yeah that site is cool, it breaks down the pattern for ya
I'd say regex is easier than programming
self.antispam.append(message.author.id)
counter = 0
for i in self.antispam:
if (i == message.author.id):
counter += 1
await sleep(5)
self.antispam.remove(message.author.id)
if counter >= 4:
await message.delete()
await message.channel.send(f"Hey {message.author.mention}! Please don't spam!", delete_after=10)``` any ideas to make this work better / any ideas to fix it?
is that supposed to be ran on each message?
yes
content is the message content but lowercase btw
not useful here
but its just easier
await in events is kinda bad
how so?
wait wot
then check if the id is in that collection
if it is, user is ratelimited
else it's not
wait explain in dumb wordsd
Someone spams, sleeps for 5 seconds to delete the id of them, same guy just spams 4 seconds after, the id is removed a second after, the remove line raised ValueError 4 seconds after 
something like this ig https://pypi.org/project/expiringdict/
it doubles as a handy cache
wait wdym?
k
each time someone enters the building, you put a cucumber in the stand
all cucumbers will expire after 5 seconds from being put in the stand
is redis overkill for this? 
if the person re-enters the building while its cucumber hasn't expired, you kick the person out of the place
totally 
so store a list of dicts
then check if the user is in the cache, if it exists, check the count
uhh
if the count is below 5, increase and save
I'm bad at putting it in words
i could store each user as a dcict
dict
in the list
on message
the dict counter goes up
but i need to after 5 seconds make the dict counter go down 1
which is the await
work with 0
?
if the user isn't in the cache, then consider it to be 0
(or 1 if you REALLY want to use 1)
basically:
busy waiting
i mean i can just make it wait last?
If that's a separate listener, does it really matter?
try using the wait method, if you face issues try using the self-expiring dict
ty tho
where do you all host your discord bots ?
i host mine on an old laptop that i always keep on
but you can use heroku since its free and easy
Uptime Monitor,Heroku Etc.
Task was destroyed but it is pending!
task: <ClientEventTask state=pending event=on_message coro=<bound method BotBase.on_message of <discord.ext.commands.bot.Bot object at 0x7fe16116d850>>>
Anyone?
the heck is this
how do i run a C++ file in VS code?
You need a C++ compiler installed, and the code runner extension
Hi, pls tell me the command which sends dm to voter after voting the bot.
we dont spoonfeed.
you need a webhook first
check topic of #topgg-api
https://i.callumdev.pw/vntsb.png
why is this not sending data?
tried with "body" and "data"
nvm brruuuh ofc contentType was needed
what event is used to check if a attachment was sent?
the message event
wait what
check if the message contains an attachment
oki got it
hello i just wanna know about the error of api of my bot can i know why discord is banning my applications api
Hello. I don't know if You can help with this, but I'm trying to create a simple bot for one server, and idk how to.
Do you know how bots are made?
Not very
You should start with that then, and then decide if you're willing to learn
You mean watch YouTube videos?
Not only watching youtube videos
#502193464054644737 message
This may be helpful if you want to know how bots are made
What is other way to learn?😁
Oki
Reading
what kind of bot are u trying to create
Like - Moderation, leveling and some custom commands.
i want to learn something
u can use botghost.com for that
if u don't know how to code
?
solve what
like what?
let auth = req.headers['authorization'];
if(!auth) return res.json({status: "Failed", message: `You didn't provide a 'Authorization' header!`});
if(auth !== process.env.Auth) return res.json({status: "Failed", message: `You didn't provide the correct authorization key!`});
if(!req.body) return res.json({status: "Failed", message: `You didn't provide any data!`});
if(!process.env.dbl) {
console.log(`You didn't add your dbl api key in the .env file.. smh`)
return res.status(401).json({status: false, message: `Unauthorized`})
}
let bot = req.body.bot;
let {body: user} = await get(`https://top.gg/api/users/${req.body.user}`).set("Authorization", process.env.dbl);
post(process.env.Webhook)
.send({embeds: [{
title: `Vote Here`,
color: 0xbc00ff,
url: `https://top.gg/bot/${bot}/vote`,
timestamp: new Date(),
author: {
name: `New Vote by: ${user.username}#${user.discriminator}`,
icon_url: `https://cdn.discordapp.com/avatars/${user.id}/${user.avatar}${user.avatar.toString().startsWith("a_") ? ".gif" : ".png"}`
},
footer: {
text: `Discord Bot List`,
icon_url: `https://i.imgur.com/78Hl85r.gif`
}
}]}).catch(console.error)
});
app.listen(4000, () => console.log(`Website is up and running`));```
If you don't respond with a 2xx response once you receive the webhook it's going to retry
up to 10 times
@dusky sundial bro how much time will it take for verify
about a week
1week has finished
You added your bot 2 days ago, so that's not true
Oh
https://sourceb.in/u8zgxqnMzH
My code is not even working completly
.setAuthor(`${user.user.username}`, avatar)
plays audio for what?
In discord vcs
?
Line 13
Oh
of image
Thx
discord.js already has the feature
just give path to File or
Oh
Same problem on lines 26 and 27
setTimeout(function(){
//Code
}, 5000); //time in milliseconds
message.channel.send('')
}```
What are you trying to do?
help me ):
you havent asked what you need help with
What are you trying to do?
you just threw code here
I just wanted to make a command like !cd and bot replies "Alright, I'll remind you in 1 min" and after 1 min bot replies me " your cooldown is over"
How do I fix line 14?
.setDescription(`${user.user.username} You were muted because your actions inside ${message.guild.name} server`)
it seems like you copied setTimeout without knowing what it does
Put the send inside the timeout function
check that
My bad. I edited! 14 is good
message.channel.send('setTimeout(function(){
//Code
}, 5000); //time in milliseconds')
}```
like this?
ok
So like these
const Discord = require('discord.js')
module.exports = {
name: 'mute'
run: async (message, args) => {
if (!message.member.permissions.has("MANAGE_ROLES")) return message.reply("You don't have enough perms")
const user = message.mentions.members.first()
const sayMessage = args.join(" ")
const say = `${sayMessage}`
const avatar = `${user.user.displayAvatarURL({dynamic: true})}`
const embed = new Discord.MessageEmbed()
.setAuthor(`${user.user.username}`, avatar)
.setDescription(`${user.user.username} You were muted because your actions inside ${message.guild.name} server`)
.setColor("F73272")
.addField("\u200b", "\u200b")
.addField("**Moderator**", `${message.author.username}`, true)
.addField("**Reason**", say, true)
.setTimestamp()
.setFooter("Mute Case#0356")
user.send(embed)
const embed2 = new Discord.MessageEmbed()
.setAuthor(`${user.user.username}`, 'Mute case#0356')
.setDescription(`${user.user.username} has been muted by ${message.author.username}`)
.addField("\u200b", "\u200b")
.addField("Reason", say, true)
.setTimestamp()
.setFooter("🌴Justice has been served", avatar)
message.reply(embed2)
}
}
Looks better but I'm on my phone
Try it and see
Check your logs. It'll tell you where the errors are if there are any.
The user.send(embed) worked but the message.reply(embed2) didn't
IconURL
There's your answer in the logs
const Discord = require('discord.js');
const { prefix, token } = require('./config.json');
const client = new Discord.Client();
client.once('ready', () => {
console.log('Ready!');
});
client.on('message', message => {
if (!message.content.startsWith(prefix) || message.author.bot) return;
const args = message.content.slice(prefix.length).trim().split(/ +/);
const command = args.shift().toLowerCase();
if (command === 'cd') {
message.channel.send('')
}
// other commands...
});
client.login(token);```
Replace mute case#0356 with avatar
tell me now
read what i sent
we arent going to spoonfeed you
its the 5th time you post this without listening to our answers
You literally just copied another piece of code you found online and now you want us to write your command for you.
so im using mongodb, and i have this code
let res = await Guilds.findOneAndUpdate({ id: "test" }, { $set: { hmm: "dgisdfjdsf" } }, { returnNewDocument: true });
``` but res.value is showing the old version of the doc even tho i have `{ returnNewDocument: true}`, ive tried `{ new: true }` but that doesnt work either
@lunar patio Before you make a Discord Bot, you should have a good understanding of JavaScript. This means you should have a basic understanding of the following topics:
- proper syntax
- debuging code
- basic features (vars, arrays, objects, functions)
- read and understand docs
- nodejs module system
As much as we d like to assist everyone with making their bots, we rarely have the time and/or patience to handhold beginners through learning javascript. We highly recommend understanding the basics before trying to make bots, which use advanced programming concepts.
Here are good resources to learn both Javascript and NodeJS:
Javascriptinfo: https://javascript.info/
Codecademy: https://www.codecademy.com/learn/javascript
FreeCodeCamp: https://www.freecodecamp.org/
Udemy: https://www.udemy.com/javascript-essentials/
Eloquent JavaScript, free book: http://eloquentjavascript.net/
You-Dont-Know-JS: https://github.com/getify/You-Dont-Know-JS
NodeSchool: https://nodeschool.io/
CodeSchool: https://www.codeschool.com/courses/real-time-web-with-node-js
Evie s Accelerated JS: https://js.evie.dev/
Please take a couple of weeks/months to get acquainted with the language before trying to make bots!
@rose warren Thank you so much I fixed it now it works
👍
Always use logs and djs's own docs. They'll give you the answer 99% of the time when it comes to embeds. https://discord.js.org
Now I just have to find a way to give the user the muted role
That's the fun part
Use the docs they'll be helpful when finding out how to give a member a role
K
It was helpful
const role= member.guild.roles.cache.find(role => role.name === "role name") member.roles.add(role)
this guy wants to get spoonfed, he DMd me a few days ago to get complete code snippets, after ive told him i wont spoonfeed hem he proceeded to demant complete code snippets.
why even bother writing code if you're going to treat it like a homework assignment to get an A on
Lol his bot literally requires all the perms + admin
hi umm
anyone knows form data?
fd.append("name", files[i])
}```
This only appends 3 items into the "name" array for some reason when i have 5 items. (ignore the syntax, just an example)
that's not how a for loop works
i know...
that was just for faster reference for what im doing

anyway. on the server side i receive only 3
name: [ 'yuno gasai', 'amano yukiteru', 'akise aru' ],
but i have 5 and when i check fd.entries()
it shows me all 5
Or don't use query params, send the array as the body of the request
hey
so i have made a bot that actually triggers on certain words being used
it works for the description
but not for the title of the embed.
The trigger word had to be Donate.
but it didn't trigger.
const fake = message.content || message.embeds[0].description || message.embeds[0].footer || message.embeds[0].title
let m = final.filter(a => fake.includes(a))
let z = final.some(a => fake.includes(a))```
Technically you'd need to check for the word in all of those instead of relying on absence of others
nvm i found out that || can only hold 2 options
now i've made a fucking necklace of ||.
my bad.
bruh
this line deleted all my channels somehow
its not even in a loop
oof
good its a test server ey
lol
what command
The description of one of the commands is either too long or too short
it's in the error message
Is it recommended to use guild based Slash commands instead of global Slash commands? Not Just for Testing...
Can i use PYTHON for discord bots
you don't need permission to create them, you just need the applications.commands scope to be able to use them
yeah i had assumed as such
cringe tbh
yo wat theme
I don't think so
Get an option to get the text after
In ts typedef how do you specify an array with a length from 1 - N
you can't, typescript doesn't keep track of array length. You could use a tuple though
can someone help me
im doing this:
url = "https://discord.com/api/v8/applications/ID/commands"
json = {
"name": "ping",
"description": "pong",
"options": []
}
headers = {
"Authorization": "Bot TOKEN"
}
r = requests.post(url, headers=headers, json=json)
why is this not working?
interface h { hh: number[length from 1 to 25] }
(cant use line breaks because im using discord in the browser on mobile)
Your url doesnt have your id 🤦♂️
Tuples are the only default way to do it
type: [number, number, number
but that would mean i cant do an array with length smaller than that
[number, number, number|undefined]
W H A T
anyone know why its not working?

why is your options array empty
you could just leave it out
and also have you authorized your app to your server with applications.commands scope
you never know that might be the problem ¯_(ツ)_/¯
guys can I ask do you guys have an insight on when we can have the discord.js full support for discord slash commands?
as soon as possible
i hope so
contribute to https://github.com/discordjs/discord.js/pull/5448 if you want it to get merged faster ig
is there people who proposed different versions about this too?
sup ppls
\🍰
on pc and website use \ before the Emoji
on android use emoji `
normal emojis that are in the client are unicode emojis and they don't have an id
see
that's a default not Custom
yeah
ohh okay
\🍆
it doesn't have id use unicode
@earnest phoenix copy paste from here
https://getemoji.com/
Copy and paste every emoji with 👠no apps required. 😊🥺😉ğŸ˜ğŸ˜˜ğŸ˜šğŸ˜œğŸ˜‚ğŸ˜ğŸ˜³ğŸ˜ğŸ˜£ğŸ˜¢ğŸ˜ğŸ˜°ğŸ¥°
𓀂
I got this one from there
🔴 🟠 🟡 🟢 🔵 🟣 ⚫️ ⚪️ 🟤
Poggers
do you use node.js
node.ts
because I found a javascript library for emojis
well i haven't seen if it does have ts declarations
hold on...
it does have declarations
npm install -S emoji-js
npm install -D @types/emoji-js
What this does?
Dosa This
what
Boys should not use girl animes \😳
how do you know they're boys
Ik
and also what's wrong with that
my pic is not an anime character. It looks like one but it's not
right
pls don't do this here this is unrelated
it's from a vn made by an american weeb
Noice
@pale vessel @waxen bough u bOtH aRe AnImE lOvErS
@cinder patio u too lol
...
huh
I'm a dog
...ok?
look, we don't really care
i was just trying to help someone and the next thing i know ...this
@rustic nova someone being annoying in #development

𓀂
yes and they don't even know what ddlc is smfh
smfh?
@earnest phoenix can you stop being a nuisance in development if you both don't want to help and/or need help, thanks
Oh sorry I thought I'm in chats Such A Great Dumb That's What Everyone calls me
great dumb...
it means ?
did you store data, like Guild IDs for Per Guild configs
Adding an option in the clone() method which is the reason makes the bot not allowing anything to run meaning not allowing the channel to be nuked. (Not raiding) Making a nuke command, not used incorrectly, no hurt pls
Do you store any user data?
Say that you don't store any user data.
Since 100 characters is the minimum limit
You can write I believe that my answer to the following question is no as I don't store any user or server data from users or servers.
just type i use user data and sell them to govt for good purposes
.. or that.
😂
xD
Welp
ty all
exdi
Lel
i read that
😉
lol
what do i help with?
Hi
question, how do you guys store data for your bot? do you guys use database or just save them in json file?
This
idk, i never made the nuke command
databases. Don't ever use JSON as a database, it's not good. use sqlite or a db server.
um why json is bad?
I prefer MongoDB for beginners.
Because I said so.

😂
didn't ask.
Didn't ask for you to not ask. Lmao
what can i do now ;-;
databases are too complex for my brain to understand.
use Enmap or quick.db or nedb
they're super easy
can someone explain why
are they available in npm?
yes, all 3 of them are.
we can't unless you give us more details. What's your error, what's your code?
oki but is there a way i can use mongodb in my 32bit pc? (i cant install their applications :v)
umm, fill it with since the reply to the previous question was no henceforth i would like to say no to this too, which means i am not using any user data
is it maybe logging something through client.logger.error or outputting an error to console otherwise?
I used the same source code for my other meme command and it works
use mongodb atlas (hosted free mongo server) if you can't install the server.
if it's 100% exactly precisely the same code with no difference, that doesn't make sense. What's different?
hmm ok
at where ?
The same code, just the subreddit is different.

at FOR WHAT PROCESS
purpose
Also you didn't actually answer my question
ok
What is the error yo'ure getting?
It isn't sending any meme, like it should.
First, glitch actually has a terminal
I know
9 months
That's... pretty simple english man
yo'ure
do'nt

WHAT IS THE PROCESS FOR USERS TO REQUEST DELETION OF THEIR DATA?
Are you really expecting us to know the answers to these very simple questions? You're the dev, if you don't actually know whether you store data, that's bad.
you answer it
im at the terminal
no u
DM, emails, however you do it?
what next
Here's your answer: " I have no idea what security is or how to handle any of this so I don't have any process in place for any of it I just want a bot with a checkmark"
LMAO
use your eyes, look at it? what does it say?
nothing
run your command again
yeah I know it's not working we didnt fix it
I assume it's not bad if your gonna use json files for long term data storage.
debug it
I want to know if anything actually see anything in the console log when you run it
like, basic debugging
what's bad is it's constantly being replaced
i just used json for that
IF you're not actively changing or modifying the file during runtime, yes json is fine
But then that's not a database those are just config files or backup files.
i want to use database that doesn't need remote server. because apparently a lot do
nothing got logged
Hey remember earlier I suggested 3 different databases you could use
Here: #development message
sup hind 😉
Then the command isn't running at all. Can you show me your other meme command that does work? I Want to compare
if you are, do not use file-based DBs
they corrupt very easily
and loose data all the time
noever happend to me tho samm
Look
i see
And you're, like, 100% sure you saved this new file and restarted your bot ?
glitch autosaves
let me refresh it
refreshed it
I don't really understand the use of glitch for discord bots
Because it used to be the one good free option
before repl.it got known for "replacing" them
oh
I literally had a guide on AIG where I posted how to use it because heroku was shit and too hard for people and repl.it was a bit of an unknown at that time
still isnt working
now that guide says "don't use this it's not good for hosting"
but people just don't want to listen
Heroku is super easy and fast though
It really isn't as easy as any other service.
If you don't know how to use git
Also Heroku's now even more locked down and useless than glitch from what I understand?
Might just be people that didn't have a CC or know how to use workerfile or whatever
Add a console log right before the https.get and see if it even runs
add more console logs
add more debugging
figure it out
i think the thing about hosting bots on heroku is a little stretched imo
or install vsc and use the debug features
there's nothing preventing you from doing it, it's just discouraged on
if you have a bot that's minimal on processing or memory usage, then go for it, but a bot that's intensive and requires things like constant database changes, massive-scale API calls, and etc. is probably not a good idea to host on heroku at all
i think the best one for me is nedb so far because it's async. in enmap everytime i have to specify path arg and it's sync. quick.db is sync too.
Ok well hold up
why is sync a problem? That's usually a benefit
also the path is optional in every enmap feature 😛
looks like a mongodb clone
doesn't it block other scripts from running though
it doesn't because it's pretty much instantaneous, it's the fastest database interaction you can find
so i don't have to worry abt it
better-sqlite3 (which both enmap and quickdb use) is blocking but also something like 500% faster than async dbs
On those tiny-ass interactions you're going to be doing it doesn't matter at all
Hi
Im thinking what might happen when there's too much happening in my bot is that really the case
Both these modules have over 2 million downloads and not once in the entire existence of enmap has anyone ever complained about process blocking having been problematic for them.
ohh thanks for the info
Hello I would like your help, I am looking to create a command with my bot that sends a first embed and adds arrows emotes below and make sure I can navigate in my menu as long as a cross emote is not put . But I have no idea how to do this can you help me?
man i have troubles installing enmap
apparently it can't cd to my directory
probably because it has space
yes, remove spaces and special characters from your path
also read these instructions extremely carefully
https://enmap.evie.dev/install#pre-requisites
i am running dual boot and that path was symlinked so I can access from both systems
yeah that sounds like a massive pain in the ass and also you aiming a shotgun straight at your foot with a twitchy finger on the trigger.
hahah yes
also how does dual booting affect folder names though
I have Windows 10 and my username has space. that's where the original path is located
and it's symlinked to my documents folderi in ubuntu
ah well surely there's a wya to get a path without, like, y'know, D:/devel/bots/mybot 😛
I can't switch it around because windows can't access ext partitions
I got no time to deal with it right now. I guess tomorrow..
i'll just sleep i guess
bye
what "everything" have you tried and how didn't it work?
whn they vote the bot
ye
the api gives you the ID of the user
yes
just get them from client.users.cache.get("user id here")
Yeah i tried it... Lemme try again ig :?/
oki
Yeah
But it said bot.users.chache.get isn't a function last time i tested... But how to test it i've already voted...
I think, yes
okok
So
app.post('/dblwebhook', webhook.middleware(), (req, res) => {
console.log(req.vote.user)
bot.users.cache.get(req.vote.user).send("Thank you for voting me in top.gg!")
})```
code
Cannot read the property of send
is the error
console.log(req.vote.user) <---- this logs something. what does it log
ok good
and it's your ID?
Great. So it is a question of your user being uncached
Hmm yeah
you'll need to fetch them instead. bot.users.fetch(req.vote.user) but note that you'll have to await this because it returns a promise, it's not synchronous.
hmm
lemme try
await bot.users.fetch(req.vote.user).send("Thank you for voting me in top.gg!") not work
and also that
So what can i doo?
perhaps read https://js.evie.dev/promises
hmm k
app.post('/dblwebhook', webhook.middleware(), (req, res) => {
console.log(req.vote.user)
await bot.users.fetch(req.vote.user).send("Thank you for voting me in top.gg!")
})```How to add async in this function @umbral zealot
i meant where
don't make me repeat everythign that's on that page. Read it, learn, understand.
Oki
ty
app.post('/dblwebhook', webhook.middleware(), async (req, res) => {
console.log(req.vote.user)
await bot.users.fetch(req.vote.user).send("Thank you for voting me in top.gg!")
})```Now it says `TypeError: bot.users.fetch(...).send is not a function`
ok
you mean DiscordAPIError?

ok
So this would fix it?```js
app.post('/dblwebhook', webhook.middleware(), async (req, res) => {
console.log(req.vote.user)
(await users.fetch(req.cote.user).catch(() => null))?.send("My message")
})```
Yes
are you on node v14+?
yes
Ah, nice
change users to <client>.users
node v12.16.1
oh, then you can't use optional chaining
you can't update then
So what will be the code?
So what is it
just do js const user = await client.users.fetch(id).catch(() => null); if (user) user.send();
if you still want one line then you can do js (await client.users.fetch(id).catch(() => ({ send() {} }))).send("something");
sending can also fail so you should probably handle that too
is there any way to easy up?
let {textcolor} = req.body
await db.set(req.params.id,{
textcolor:textcolor,
})```
use void (await client.users.fetch(id).catch(() => ({ send() {} }))).send("something"); unless you want the sent message, use catch()
app.post('/dblwebhook', webhook.middleware(), async (req, res) => {
console.log(req.vote.user)
const user = await bot.users.fetch(req.vote.user).catch(() => null);
if (user) {
try {
user.send("Thank you for voting me in top.gg!");
} catch (err) {
if (err) return;
}
}
})
```This will remove those errors right?
What's the point of void there
await it
let {textcolor} = req.body;
await db.set(req.params.id, {textcolor});
Hello, would you know how to delete all the reactions of a message except that of my bot (for an embed pages)
is this message for me?
ignore that
await the send and that if check in the catch is useless
add await
Oki
the error will always be defined if the code jumps to the catch clause
app.post('/dblwebhook', webhook.middleware(), async (req, res) => {
console.log(req.vote.user)
const user = await bot.users.fetch(req.vote.user).catch(() => null);
if (user) {
try {
await user.send("Thank you for voting me in top.gg!");
} catch (err) {
if (err) return;
}
}
})
```Now?
good enough
i'd use user.send().catch(() => null); or try { await user.send(); } catch {} or void user.send();
But still now it works right?
yeah
ofc
ested and it worked
you don't need thatif (err) return; like cry said, it's redundant
err will always exist in catch
Lol
ok
app.post('/dblwebhook', webhook.middleware(), async (req, res) => {
console.log(req.vote.user)
const user = await bot.users.fetch(req.vote.user).catch(() => null);
if (user) {
try {
await user.send("Thank you for voting me in top.gg!");
} catch (err) {
return;
}
}
})
```Ye ty
Also you need to send 204
can someone help me now 
A status code
oH LIKE 404
How u do dat?
res.sendStatus(204);
im sry not that good coder
Ok i'll try
app.post('/dblwebhook', webhook.middleware(), async (req, res) => {
res.sendStatus(204);
console.log(req.vote.user)
const user = await bot.users.fetch(req.vote.user).catch(() => null);
if (user) {
try {
await user.send("Thank you for voting me in top.gg!");
} catch (err) {
return;
}
}
})
done?
I suppose
it does?
yeah
that's kinda stupid
it shouldn't call next() then
oh then the function isn't gonna get called I guess
How can I do file directories in repl? Lets say I wanted to do like.. image manipulation
what language you using?
repl is simply a hosting service
imagine manipulation you do with your own code
gotta wait for someone who knows py to let you know
for image manipulation
Like
surely python has memory buffers
this part
image = Image.open('C://Users//User//Desktop//wantedposter.jpg')```
i cant do that on repl
since
this
Hey there
if your wantedposter.jpg is on your project, it should be able to open
just use a proper path
cuz like i said, that path is on your local computer
not on repl
I have an api and I want to implement an API key system
I have everything set up
User can request a key and I will approve it manually.
The problem is, where can and how can I add the api key in existing list of api keys so I don't have to restart api again and again
what's the best database to use for this
Thanks in advance
My api is made using express package
yea thats the problem
@earnest phoenix
i got it working @opal plank tysm
i wathced a yt vid about relative paths
and boom
ty
How do I find MY port?
Do netstat -a in command line
it'll show all the ports currently served
both internal and public
how can i find the amount of users using my bot, or in a server with it.. like yk sometimes people put in their status "watching 1000 members"
ITS ALIVE
now it's dead
it shows many... Do I pick one and it will work?
or is there a specific one
no use the one whats not listed there
you dont "find your port", you have 64k different ports, you chose one to run a server in
unless you're using an app hosting like glitch/heroku/repl.it in which case they chose which ports you are allowed to use
in which language/lirbary?
py
python is the language but what about the library 
come on now
that'd be an ok question to ask if the language was js cause there are hundreds of discord libs
python has other libs than dpy too, well not hundreds though
does that even matter? 99% of people use djs anyway
xd
except me, im special
in the bad sense of the word

speshul
does it count if i don't even do my bot in js?
spechul
then you arent part of the cool kids
i am; holy C
you are either a Haskell Dev or you're bunched with the rest of the js/py members
let me manage my own memory
and dangling pointers are nice
but true, i should probably learn haskell
i probably have an answer
I have 1GB vram can i play teardown
use the force, thats the answer
42 is always the answer
teardown?
Yes
the heck is that related to #development ?
the amount of ram on your gpu is not all that matters, processing power and memory bandwidth matter too
You can check on the steam





