#development
1 messages ยท Page 1765 of 1
i dont know py
me either

yes
yes
i rememebr when i joined this place..
i knew discord.py but not python
good times
an old client of mine would say "the problem is between the keyboard and the chair, isnt it?"
so is py
^^
fix my problems
profanity_list = open(absolute_path).read().split('\n')```
pay up

no....
did it not work
no it did not
maybe i did something wrong
is the absolute path correct?
print(aboslute_path)
is that the absolute path
the variable name is absolute path
classic top.gg members not doing in the bare minimum effort to solve their problems before asking for help
implies that....?
can't you get the cwd?
it should be absolute?

then you know where the issue is
is your file structure like this?
bot
cogs
automod
words.txt
main.py
YEAH
absolute_path = Path('cogs/automod/words.txt').resolve()

crying
same
bruh
okay, let me put in a way even a baby would understand
this should be an ABSOLUTE path. AFTER its declaration
this is either the wrong relative path thats error'ing, or something else
if you print(abolsute_path) and it returns 'cogs\automod\words.txt'
ok
like i said, absolute path, as the name implies, should be A FRIDDING ABSOLUTE PATH
the check why THIS isnt working absolute_path = Path('cogs/automod/words.txt').resolve()
take a screenshot of your folders
thats why i understood its relative
doesnt py have __dirname or something?
exactly #development message
did you try './cogs/automod/words.txt'
lemme try...
i think i did
but im not 100%
yeah no worky
ill do absolute
thanks guys
os.path.join(__file__, "relative", "path") should probably also work but I don't do python so idk
does it str()'s it automatically
y u asking me py questions?
i dont appreciate it
path.join(__file__.replace("automod.py", ""), "words.txt")
this worked
tysm everyone
yall pog
yes
TY SUSSY BAKA
won't check to see if it's a path that points to something that exists though
simp.pics is my old domain lol
actually that one is a test domain too idk what to even name it
why so many
idk I just buy domains for fun
sounds like fun tbh
dude
so your "automod" folder is actually called "automod.py"?
no wonder why nothing worked
i asked you to show a pic of your folders lel
so can i use relative now, or do i still use this
BRO IM DUMB OKAY LEAVE ME ALLONNE
๐ญ
i need you to understand that relative paths turn into absolutes regardless
relative paths are just shorthands
it doesnt matter whether its relative or absolute if the damn folder name is wrong
lmao
also, arent you replacing automod.py with nothing?
which would then turn the actual path into cogs/words.txt?
cogs/automod/automod.py
replace the automod.py
with nothing
path.join(__file__.replace("automod.py", "words.txt"))
it worked
so you're calling this script from inside automod.py?
off() isnt how u unregister event emitters
ohh
you call <emitter>.removeEventLister()
erm
The
EventTarget.removeEventListener() method removes from
theย EventTarget an event listener previously registered with
EventTarget.addEventListener(). The event listener to be removed is
identified using a combination of the event type, the event listener function itself,
and various optional options that may affect the match...
it might be different on node
let me double check
does that extend emitter?
the docs says off is an alias for removeListener
check if it extends EventEmitter
when i do app.get('/',(req, res) => res.send('./index.html')) i want it to run the html file, how can i do it?
require that or use a router
huh?
did you check the docs
,
i meant what i said it
you either require that path, or use a router
you likely using express
i did not understand the router part
just google express routers
as the name suggests, they route
so they would route to your main page
which is, i assume, index
you need to use the static files middleware
you can always read the file yourself using fs then send the text result lul
does require resolve on html files?
require will try to parse it as something js understands
so no, it only works on js and json files
lel
module.exports = "<html></html>";```/s
let msg1 = messages.first().content
How can I put a mention there?
discord.js
I'm doing a filter
technically you can also use webpack to intercept require and convert it into a format js can understand
a mention where
inside msg1
those kinds of things are basically what renderers such as ejs do
mentions.users.first();?
basic string concatenation, you just do "<@user_id>" + your other string
but the bot asks a question and after it have to change the data inside a database
...okay?
sorry, I have like 6 sleep hours in the past 3 days
go sleep
my question is if I dont do the mention.user.first() wich data stores from a mention message?
the name?
or the ID?
wat
my bot asks me 'Hey to who u want to give your money?'
if I tag @ tim and then store the data in a variable
wich kind of data stores?
....wat
I end this command and then I go
you get the message object
inside the message object there is a mentions property
the mentions object contains a list of mentions, including users, channels and roles
you can access the User object or the Member object from message.mentions.users or message.mentions.members
no problomo
a lot in some moments
a mention
it would be easier to understand what you want to do if you show code
do{
let verifica = 0;
//inizio del filtro
message.channel.send(questions.firstQuestion).then(msg => {
const filter1 = m => m.author.id === message.author.id
msg.channel.awaitMessages(filter1, {
time: 5 * 60000,
max: 1
}).then(messages => {
let msg1 = messages.first().content
message.channel.send(questions.secondQuestion).then(msg => {
const filter1 = m => m.author.id === message.author.id
msg.channel.awaitMessages(filter1, {
time: 5 * 60000,
max: 1
}).then(messages => {
let msg2 = messages.first().content
}}
}while(verifica === 2)
inside msg1 I want to put a user
@client.command()
async def meme(ctx):
async with ctx.typing():
time.sleep(0.1)
subs = ['dankmemes', 'memes']
randSub = random.choice(subs)
subreddit = await reddit.subreddit(f'{randSub}', fetch=True)
top = subreddit.top(limit=100)
sub_list = []
async for submission in top:
sub_list.append(submission)
subChosen = random.choice(sub_list)
subTitle = subChosen.title
subUrl = subChosen.url
embedVar = discord.Embed(title=subTitle, color=0xffa300)
embedVar.set_image(url=subUrl)
embedVar.set_footer(text=f"Result from r/{subreddit} || By {subChosen.author} || {subChosen.score}โฒ || {subChosen.num_comments}๐ฌ")
await ctx.send(embed=embedVar)
Why does my meme command take like 1 minute to load? I am using Asyncpraw with Discord.py
jesus
do{
let verifica = 0;
//inizio del filtro
message.channel.send(questions.firstQuestion).then(msg => {
const filter1 = m => m.author.id === message.author.id
msg.channel.awaitMessages(filter1, {
time: 5 * 60000,
max: 1
}).then(messages => {
let msg1 = messages.first().content
message.channel.send(questions.secondQuestion).then(msg => {
const filter1 = m => m.author.id === message.author.id
msg.channel.awaitMessages(filter1, {
time: 5 * 60000,
max: 1
}).then(messages => {
let msg2 = messages.first().content
}}
}while(verifica === 2)
why is there a while there?

let msg1 = messages.first().mentions.users.first()
it's do while
isnt do deprecated?
because I want to check if there is the tag
no
and if the number of coins given is between 1 and 100
oh, its with thats deprecated, not do
that code looks like it will loop thousands of times
because is not finished yet
lol
Imagine replying to your message so people can help you.. ||couldn't be me||
not if after the check I'll add 1 after the mention check adn the numer, for get to 2 and exit the cicle
What does server IP address could not be found, what that means???
but why? if the verifica store the 2 inside
the loop wont wait for it
the loop will only see message.channel.send()
so it will do message.channel.send() until verifica is 2. but by the time verifica becomes 2, the loop already ran thousands of times
Imagine re-replying to your message to get help.. ||couldn't be me||
that means none of us know the answer
lmao
I agree
i dont use py
same?
a Little clue on how check if there Is the right stored value?
what value? stored where?
you want to check if the mentioned user exists in your database?
database.has(message.mentions.users.first().id)
hi
database.has(message.content.test(<@โ!?(\d+)>) ? <@โ!?(\d+)>.match(message.content)[0] : '')```
like a tru champ
reinventing the wheel
big brein time
:^)
did you see the discord.js v13 release date?
bold of u to assume i even check d.js anymore
i assume not
where is the release date even at?
f u then
just show it goddamit
I guess I'll tell u

tomorrow
that means slash commands are gonna come out in discord.js before de3iuerui33uie
pff
google said he'll tell you tomorrow

gottem
lol
The site is loading to much
whats the way to delete messages with python? message.delete right?
is there a way to show permissions needed for the command in a universal error handler?
such as error.param.name is the way to show the error on all the commands
Sure, the instance of the error raised has perms attribute iirc which is a list of perms
yeah im trying to fix this
to show the permission needed
instead of "well you dont have that permission" because they dont know what they need
Uh, why CheckFailure? It's too broad
ah i never knew that
i was trying to fix my errors because they never were showing
so i just wrote up this
i had individual errors and they never worked so i switched to universal and it works for the most part
thank you
Also, the instance of the error won't be discord.Forbidden nor discord.HTTPException. They'll be wrapped in CommandInvokeError iirc, which you already handle
oh sweet
yeah i see what you mean by too broad
every error basically inherits from CheckFailure
would there be a way as done with SyntaxError where it prints the error on each given command except for permissions?
content = f"Command {ctx.command.name} missing 1 required argument: {error.param.name}"
The missing_perms attribute is a list of Permission object, you can stringify and join them
Actually, I'm not sure if it's a list of Permission object or str. You can figure it out yourself ig, I don't really use d.py anymore
oh okay well thank you for what you could help with
Yeah, it should be a list of str. IDK why I thought it would be list of Permission object
what?
Help please..?
I need to fix this bug nd give to client within 12 hours
He means the code of fetching ping of top.gg Api
how does "api ping code" and "${api}" have any sort or resemblance to what u just explained?
Idk
But thats what i guess he means
he probably meant that
no, ${api} won't get u the "api ping"
${something} is just a string substitution
node has nothing called ${api} in my knowledge
only if you do like let api = ...
Building a web dash. I've got oauth set up and everything, I've got the user data, no issues there. I wanted to know how can I check if my bot is in each of the servers the user is in? Basically I want to show a list of the servers the user is in where the bot is also there, and another list where the user is there but the bot isn't. Any pointers? Bot is in JS on a separate host. Dash is in PHP.
I think there's an endpoint for that, go ahead and do some searching, maybe /user/id/servers using the bot token?
Either way you could probably for loop the servers the bot is in and check if the user is in it. I'd recommend maxing out at about 10 shared servers though.
I have a json file with data and I want to set the value of a text box with it. I have a button that runs a function in my index.js but how do I get data from data.json in my js file
This with the bot token? https://discord.com/developers/docs/resources/user#get-current-user-guilds
Integrate your service with Discord โ whether it's a bot or a game or whatever your wildest imagination can come up with.
For that, you'd use the user token (whatever is supplied from oauth) That would work, though the one problem with that is we're back to square one. We need to look for the bot in the server, instead of the user. That's a lot easier to manage instead of the possibility of 10000 servers being checked every time they login

but yeah I think either way you put it, you'll have to check all the servers the bot is in (bot side/server side), send that across, or you would have to go through each server the user is in from the user's side (web panel) and check for the bot.
Yeah I think the best way is to get a list of guilds the bot is in and compare those to the guilds the user is in. My question was how to achieve that using the API for the bot's side of things. I already have the user's guilds.
Your bot's token is static, so just check through the users guilds for users with that token(?)
im using discord.py, and I want buttons. The github page for d.py https://github.com/Rapptz/discord.py shows that there is support for buttons. I tried uninstalling and reinstalling discord.py, but it hasnt done anything. anyone know how to fix this?
But you can't check for users in a guild using the api 
what would be a better way to start out creating a better help command for d.py?
im tired of my current one and need a leading hand
wut
I didn't really understand what you meant
Mm
You mean loop through the user's guilds doing this request for each guild id? https://discord.com/developers/docs/resources/guild#get-guild-member
Integrate your service with Discord โ whether it's a bot or a game or whatever your wildest imagination can come up with.
Using the bot's ID in the request?
Using the name I guess
try installing it from source
I don't work much with the API but
Only problem is that first one requires GUILD_MEMBERS intent
ok thanks
I've been waiting for a month for Discord to get to my application for that intent
do this pip install git+https://github.com/Rapptz/discord.py
Yes
Oh sorry, verification is long closed
The ticket for intents is still open
Since May 1st ๐
I know I applied in the past
I guess my only option is to use the GET/guilds/{guild.id}/members/{user.id} request
Doesn't look like that needs intents
All I need to know is if it returns a result or not
Nice
Thanks for the pointers @west spoke
how can i get the last args in one message (used translate)
export?
i don't think you're using the right terminology lol
what's the context behind the question
what happens when a commonjs file imports a file that uses es6 exports
// commonjsfile.js
const h = require("./es6.js");
// es6.js
const h = "h";
export default h;
should be able to import it just fine and use it normally
(if the runtime recognizes es6)
what will be the value of h in commonjsfile.js
"h"
default export?
yup
Yeah
them what will other exports do
this so thread explains it well https://stackoverflow.com/questions/54047173/mixed-default-and-named-exports-in-node-with-es5-syntax
dose any one know how to add discord emoji's to my bot
You should check if your bot has permission to send messages in the channel beforehand.
However, you shouldn't be sending messages to all channels.
For example, if you were developing an announcements command, you could create an announcements channel instead.
Ah, what library are you using?
@earnest phoenix you could use the <GuildMember>.permissionsIn(...).has(...) expression. It checks if a guild member (e.g. message.guild.me) has permissions to do something in a certain channel.
how do I get a guild by its id in discord js
https://discord.js.org/#/docs/main/stable/class/Client?scrollTo=guilds will give you the GuildManager
then just do .cache on that to get the collection
and finally .get(id) on that to get the guild object
Hey, im currently working on a Discord Bot. It is made with DiscordJS and my database is MySQL. The problem i sometimes have is that requests are timed out or packets out of order, expected 1 got 2. But the error about the packets should only happen when i have multiple inserts in 1 statement. But i should not have that. And for the timeout, is there any way i can increase the time needed or increase the connection limit?
let membersWithBio = [];
client.guilds.cache.forEach((guild) => {
guild.members.cache.forEach((member) => {
const id = message.author.id, num = hash("2021-05_custom_profiles_premium:" + id) % 1e4;
if (member.user.bot || (1000 < num && num < 2000)) return;
membersWithBio.push(message.author.id);
});
}).then(() => {
console.log(membersWithBio, membersWithBio.length);
console.log("Done");
});
Cannot read property 'then' of undefined
only one way to find out
yuck imperative
wtf is the point of that code
memberswithbio
let muterole = message.guild.roles.cache.find(r => r.name === "muted");
if(!muterole){
try{
muterole = await message.guild.roles.create({
name: "muted",
color: "#000000",
permissions:[]
})
hey why is my code not making a role named muted?
But just a normal role named new role, no errors or whatsoever.
i'm pretty sure that needs to be wrapped in a property named data
{
data: {
name: ...
}
}
i think you need to read the docs more than asking questions here
it even gave a clear example
MY EYES
if (!msg.startsWith(`/${clientLang['lang.commandLogin']}`) || msg.startsWith(`/${clientLang['lang.commandRegister']}`)) return writeChat(client, clientLang['lang.onlyLoginOrRegister'])
what i making wrong in thiscode?
someone knows
use data
oh they need to be in data, damn
I made an economy bot, but I want to know how to reward people with cash when they rate 5 stars on my server in top.gg
Can someone help plz
that is against our rules and your bot will be banned if you're caught doing that
you can't reward someone for that btw
Oh I didn't know that
I need some help; may just be stupid
my understanding of this is as follows:
input:
0.
1. something
code:
rs.next(); // goes to the first line and returns true
and
input:
0.
code:
rs.next(); // returns false because it moves after the last line
Im having some database issues and it might be because of this but this is a start
sorry wrong ss
Hm
const parser = require("body-parser");
app.use(parser.json());
app.use(parser.urlencoded({ extended: false });
app.post("/contact", function (req, res){
console.log(req.body, req.body.name)
}```
```kt
<form method="POST" action="/contact">
<inputย type="text" id="name" name="name" class="field">ย
<input type="submit" value="Submit">
</form>```
Console:
```kt
{} undefined```
Help pls
explain further your problem
that's too few info
idk what you're trying to do
well I mean I guess you're trying to get the data from the form and it's not working
not quite sure why he used kotlin code blocks for js and html ยฏ_(ใ)_/ยฏ
lmao
My bot wont start because address already in use :::3000 & :::5000, how can I fix this?
hi
Change the port of the services that are trying to access those ports or stop the services currently accessing those ports
How can I stop them?
What OS do you use?
Kk, run
sudo netstat -lntp (list all used ports) and look for the ports 3000 and 5000 to see what services use them
Or -lnup if the ports are being used on UDP but that's unlikely
I assume it's the "List of possible adress families..."
Correct?
wait
wrong first letter
did i instead of l
It wants a password
Did you forget to press enter?
you forgot netstat
okay I got it now, what now?
There should be a list of ports and what services are using them. Look for the ports 3000 and 5000 and see what services are using them.
You can then stop these services using sudo systemctl stop {service} and disable launching at startup using sudo systemctl disable {service} but beware not to stop any essential services
I got this
They are being used by a node process (see right column). Problally (wheres autocorrect when you need it) a old bot process you can kill it using sudo kill 1093 1093 is the pid number (before the /node) this will still give the process a chance to shut down. If the process remains you can forcefully kill it using sudo kill -9 1093 -9 sends a SIGTERM signal, this doesn't give the process a chance to shut down and just terminates it
I'm trying to do it when someone has 50 votes on my bot but how i can test it
module.exports = {
name: "ban",
description:"ban someone",
usage:"{user}",
run: async (client, message, args) =>{
const validReactions = ["โ
"," โ" ]
if(!message.member.hasPermission("BAN_MEMBERS")) return message.channel.send({embed:{
color: "RANDOM",
title: ":crosss:\nYou need **BAN_MEMBERS** permission to use this command"
}})
if(!message.guild.me.hasPermission("BAN_MEMBERS")) return message.channel.send({embed:{
color:"RANDOM",
title:":crosss:\nI need **BAN_MEMBERS** permission to ban members"
}})
const target = message.mentions.users.first()
const reason = args[1]
if(!target) return message.channel.send({embed:{
color:"RANDOM",
title:":crosss:\nMention a user to ban!"
}})
if(message.author.id === target.id) return message.channel.send({embed:{
color:"RANDOM",
title: ":crosss:\nYou cannot Ban your self!"
}})
if(target.bannable) {
message.channel.send({embed:{
color: "RANDOM",
title: `Would you really like to ban ${target.tag}`
}}).then(async (msg) => {
const emoji = await client.confirm(msg, message.author, ["โ
", "โ"], 300000);
if(emoji === "โ
"){
target.send({embed: {
color: "RANDOM",
title: `You have been banned from:- ${message.guild.name} By:- ${message.author.tag} For:- ${reason || "No r Reason"}`
}}).then(() => {
message.guild.members.ban(target, {reason: reason || "No Reason"})
})
message.channel.send({embed:{
color: "RANDOM",
title: `:tick:\n Successfully banned ${target.tag} For:- ${reason || "No Reason"}`
}})
msg.delete()
}
if(emoji === "โ"){
msg.delete()
}
})
}else{
message.channel.send({embed:{
color:"RANDOM",
title:":crosss:\nCannot able to ban that user"
}})
}
}
}```
message.channel.permissionsFor(message.guild.me).has(permission here)
My ban command is not working
define "not working"
:renegade:
can you fix your code's indentation so its easier to read?
Ok
Ping me
If you got it
Throwback to Python's indents
๐
your problem is that you're checking if target.bannable is true
but your target is not a Member object, its a User object
Users dont have the bannable property
Member and User are two different things
How can I fix this?
Discord should have an prettier button for pre blocks hah.
use a Member instead of a User
sure lul
but they'd have to support 100+ langs
I mean for this tool: https://prettier.io/
Let's face it, most of the issues are with JavaScript anyway.
<?php
$keys = file_get_contents('prokeys.json');
$data = json_decode($keys, true);
session_start();
$str=rand();
if(!isset($_SESSION['result'])) {
$_SESSION['result'] = sha1(rand());
$data[$_SESSION['result']] = {"expire":date('d-m-Y' + 24*3600*30)}
}
echo $_SESSION['result'];
?>```
Do you see anything wrong? coz if i try to reach the file it just download it and doesn't show nothing
ye but syntax highlighting already supports 100+ langs through highlight.js, they are probably not gonna want to implement something that only supports a few langs
they'll likely go all or nothing
This would prevent people from sending messages if they have permission. Probably the opposite of what you want?
if its downloading it then the content type header is wrong
try to explicitly set the content type header to text/plain
!
use ! to invert the condition
I kind of saw this coming from light years away
if(a.has(1)) // a has 1
if(!a.has(1)) // a does not have 1```
yes
are you using SEND_MESSAGES as a variable?
if(!message.channel.permissionsFor(message.guild.me).has('SEND_MESSAGES')) return;
lel
Buttons are nice. They feel really cohesive with the rest of the Discord app :)
so what should i do?
ye, im just waiting for them to work in DMs before i push them to my bot
same lol
Is there any way in python I can get lists of invite link of the server bot is in or if bot can identify if the server is public or private and give list of its id regarding that?
You'd need permission to view invite links (I think manage server). However, that may be a privacy concern depending on the way you use it.
I need help with a discordjs music bot dm me if you can help me
It's better to ask your question in this channel instead.
Can you help me? @sudden geyser
Who knows.
Why is Indian memer bot not working
Though you may want to see https://dontasktoask.com/
If you don't own the bot / don't have a development question, you may want to see if the bot has a support server.
Obvious things aren't his thing, lol
Confused.
Aren't we all
Is this some kind of new update? It's first time I'm seeing one
why not just use the master branch
why not just use the raw api :)
why not just use assembly
nah just get @quartz kindle to make his own lib instead of waiting for djs updates to go djslight

I don't think the master branch has buttons yet
probably in v13
checks repository for pull request https://github.com/discordjs/discord.js/pull/5674
also finds https://github.com/discordjs/discord.js/pull/5562
No longer with the broken rebasing I accidentally introduced in #5656
For anyone curious, buttons look like this:
This includes:
New MESSAGE_COMPONENT Interaction type ComponentInteraction
A base...
master has a draft PR
what the fuck
lmfao
The repository's closed issues & pull requests is a goldmine
does anyone know how i can make a pro version of a python bot? like what services should i use and how
depends on how you define pro
like premium version so some1 can pay to have some privileges
Use a database to save pro users
There are many ways to create a premium version for software. One way is to have a table in your database for pro users (or guilds / some group) and to enable features by checking if the target is premium.
As for services, many bots use Patron or PayPal.
There is a npm module for the buttons if you use d.js
i just ment like what services i can use
Paypal api is a nightmare, and patron doesnt send you the discord user id, so you have to sort it out yourself. A alternative would be a proper webstore and something like chargebee for the payment handling
yes but how i can automatically save the guild from patreon if i only have the user
I've never used the two services myself, so I'd have to try it out and see for myself.
hey just a psa, nobody will buy the pro features unless you're offering something really special
i'm trying to use chargebee but idk how to automatically save the guild id
It's just what bots commonly use.
Also patreon api is deprecated
you can still use it ( i think )
Make it a required field to fill out or use oauth /discord api for discord logins and force the users to select a guild
oauth is probably more reliable
Yes you can
actually dk how to use it in chargebee
my bot is waiting for approval since 2 weeks
it's normal
Requires that you make a website.
Or how did you try it to use currently?
Bcs ive got a brilliant idea, you could use the new buttons to do the entire thing within discord.
you can't
buttons are just event triggers and external links
there's no payment gateway
Yes but you could integrate chargebee into one
??
You dont need much to use chargebee as payment gateway provider. A simple html button is enough
uh... no?
Yes? It doesnt need much to work. Sure a fany website would be better but it should work
dude what are you even on about
you can't make discord buttons act like a payment gateway, point blank period
the best you can do is have a link button that leads to the payment gateway site
I'm actually trying to do a really weird thing, so tell me how can i do it with discord buttons?
Not discord alone. I tall about using chargebee as gateway
Like ive said a few times
??????????????????????????????????????????????????????????????
please i'm going to have an aneurysm
https://www.chargebee.com you use this for managing the payments. You just need a simple html button to get it to work
but you can't
use
discord
buttons
discord buttons don't allow injecting custom html
You dont even need html, you just need a link that integrates into theyre api
discord buttons (that aren't link ones) are strictly closed to the gateway flow (or webhooks, if you're into that)
you can't integrate other services into that
a link button is the best you can do
which is the same as a hyperlink or just sending the url directly
i don't think you quite understand how buttons work
I saw a dude running a gameboy emulator off buttons so a payment gateway should work
that's not the same thing
the gameboy emulator works because you receive an event when a user clicked the button
the event provides the user info
this works because there isn't any other service
it's just the host machine and the end user
And when you listen to the event and send a http request to a certain url? Like with node-fetch? Cant really look into it rn bcs im at work
yes but how are you supposed to know that's the right user
that's heavily exploitable
you don't know who the discord user is on chargebee
You can force it to dms
^
I wouldn't trust a random bot with that info
and as of right now, buttons can't be used in dms
that whole system you envisioned is basically playing secret santa
which you can't do when you're carrying such important data
ok, then i think that if it's remotely possible to do it with buttons is hard, then how should i use oauth with chargebee like i ask to select a server and then when the payment is done i do something on a database?
The bot itself doesnt know any payment informations they are all handled by chargebee, the bot just sends the user to the webpage for the selected package
and actually how i can use oauth to ask gor guils?
Just with the discord userid in the header
Did you know how to make a website?
not really, i mean just can do a static website
Yea, there are tutorials for discord oauth
so a link button ๐ง
or a hyperlink
or just sending a normal link
it's all the same thing
and that completely drifted from the idea in this message
I should have added some more context. So you could to the entire thing without a website
you could use buttons to control bot currency payment
but i don't see real life payment being feasible.
I don't even know js
Then you may want to start by learning it more
learn it ๐
I have a question: i made that when you reach 50 votes (stored in a database) you'll get a reward, how i can test it?
actually testing if the vote event works
so your question is about the event? or about checking if someones over 50 votes?
about the event
what about the event?
like how to make sure it works? you can just log it to check if it works.
yes but i mean there isn't anyone that can vote the bot now
oh, there is a test button on the site.
where?
oh ok
From cffi callback <function sock_state_cb at 0x00000208237F2310>:
Traceback (most recent call last):
File "C:\Users\pc\python\lib\site-packages\pycares_init.py", line 91, in sock_state_cb
sock_state_cb(socket_fd, readable, writable)
File "C:\Users\pc\python\lib\site-packages\aiodns_init.py", line 104, in _sock_state_cb
self.loop.add_reader(fd, self._handle_event, fd, READ)
File "C:\Users\pc\python\lib\asyncio\events.py", line 504, in add_reader
raise NotImplementedError
NotImplementedError
??????????????
One message removed from a suspended account.
F
can you import an scss file into a js file in vite
wdym?
What did you do
setting custom name servers for aiohttp in a util function
im writing styles for my react components in a scss file and i want to import the style from it
but isn't vite for vue?
import "./blah.scss"
big no
it can bundle and serve anything
including vue
do npm i node-sass
then import "./blah.scss"
wont dart sass work?
(IDK never heard of dart sass)
in the file itself.
So all the className will take the styles
Or the official docs https://create-react-app.dev/docs/adding-a-sass-stylesheet
so
// App.jsx
import "theme.scss";
function App() {
return <div className="App">Helo Wurld</div>
}
// theme.scss
.App {
background-color: $teal;
}
yes
np ^ยฐ^
but what if someone wants to customize the theme
@near stratus would a style prop suffice
you tell them to go fek themselves :^)
like this
function MyComponent (props) {
const [isActive, setActive] = useState(false);
const toggleClass = () => {
setActive(!isActive);
};
return (
<div
className={isActive ? 'your_className': null}
onClick={toggleClass}
>
Sayonara baka
</div>
);
}
??
You can toggle classnames
or this?
import "defaulttheme.scss";
function CustomizableButton({ style = null }) {
return <button className="button" style={style}>customize me</div>
}
then you're in my team
I don't use any scss file actually
I make a separate js / ts file and export an object carrying the style
im migrating from a theme.js file with a useTheme hook to a theme.scss file with no hook needed
I need some help, I want to have this but how do I get it to work
Browser picks up mobile phone being used redirects website to โ/mobile.htmlโ like Twitter for example when you go on it via a phone browser the URL changes to mobile.twitter.com I would like something similar but it just go โoh this is a phone so Iโll show them this site instead of the larger siteโ
screen.width
?
check their user agent and if they have mobile user agent redirect them
I'd like to ask, what are regexes mostly used for?
tell me when this channel is free i need some help with js
pattern
Like?
Send.
client.on("message", async (message) => {
if(message.author.bot) return
const channel = message.guild.channels.cache.find(c => c.name === 'chatbot')
if(message.channel === channel) {
fetch.default(`https://api.monkedev.com/fun/chat?msg=${message.content}&uid=${message.author.id}`).catch(console.error)
.then(res => res.json()).catch(console.error)
.then(data => {
message.channel.send(data.response).catch(console.error)
}).catch((error)=>{
error;
})
}
})```
```DiscordAPIError: Cannot send an empty message```
the code runs perfectly
only if we delete a message will chatting with the chat bot it gives that error
/^boo/ would match string starting with boo
Why the ^?
eh
Does it mean Strings starting with the regex?
if(data.response){
message.channel.send(/*......*/)
}
y e s
will try that
and $ means ending with
Ooo.. alright. :)
@near stratus problem
{this is my code before using a scss file}
// components/TabButton.jsx
import useTheme from "../useTheme";
export default function TabButton({ children, href, theme, active}) {
theme = useTheme(theme, "TabButton");
// ...
return <button style={{
// PROBLEM LINE
backgroundColor: active ? theme.backgroundColor.active : theme.backgroundColor.inactive
}}>{children}</button>
}
with className I can't access the backgroundColor stuff
heck i cant even use that stuff in a scss file because it's invalid css
gotta use background-color
TypeError: Cannot read property 'json' of undefined```
now this is what happens when i post a emoji
this is for the chat bot
Your "path" variable contains space
client.on("message", async (message) => {
if(message.author.bot) return
const channel = message.guild.channels.cache.find(c => c.name === 'chatbot')
if(message.channel === channel) {
fetch.default(`https://api.monkedev.com/fun/chat?msg=${message.content}&uid=${message.author.id}`).catch(console.error)
.then(res => res.json()).catch(console.error)
.then(data => {
message.channel.send(data.response).catch(console.error)
}).catch((error)=>{
error;
})
}
})
client.on("message", async (message) => {
if(message.author.bot) return
const channel = message.guild.channels.cache.find(c => c.name === 'chatbot')
if(message.channel === channel) {
let d = fetch.default(`https://api.monkedev.com/fun/chat?msg=${message.content}&uid=${message.author.id}`).catch(console.error)
.then(res => res.json()).catch(console.error)
if(d.response){
message.channel.send(data.response).catch(console.error)
}
}
})
like this ?
i will try and tell you
@near stratus i think i got a quick and dirty solution
return <button className={active ? "active" : "inactive"></button>
@mixin tab-button() {
// required styles
}
button {
.active {
@include tab-button();
background-color: "smth";
}
.inactive {
@include tab-button();
background-color: "smth else";
}
}
also the button selector doesn't have to be a class because it has no styles on it's own so it wont affect normal button elements
nah that code doesnt work akio
lmao did you just copy paste what akio told you
lol

remember to use state and not props or else it won't reload itself
what error ?
then console.log(d) and see what's it showing
alr
Say no ๐ โโ๏ธ to incremental keys โ say yes ๐โโ๏ธ to random keys ๐
no dont use that
what do u think of this? its my first time using pillow lol :P
not the worst
wut ?
?
already using that
no
what's pillow ?
like some library ?
no
it is?
oh sorry
i confused
anyways pillow is used for image modification
oh,
like canvas ?
so i used it so it puts the image of the author
ye
cool
ok so akio
now the command works
but it still gives the same error for the global emojies but doesnt give error for the server added emojes
like it will give error for ๐ but not for 
can i just make it not show the error
is the api accepting unicode ?
if u try to make something like this
see
this is discord.py btw
i am not sure about that
no im talking about js
TypeError [ERR_UNESCAPED_CHARACTERS]: Request path contains unescaped character
escape it
bot.send(":eyes:")
^^
\
wait
\๐ก๏ธ
client.on("message", async (message)=>{
if(message.author.bot) return
const channel = message.guild.channels.cache.find(c=>c.name==='chatbot')
if(message.channel === channel) {
fetch.default(`https://api.monkedev.com/fun/chat?msg=${message.content}&uid=${message.author.id}`).catch(console.error)
.then(res=>res.json().catch(console.error))
.then(data=>{
message.channel.send(data.response).catch(console.error)
}).catch((error)=>{
error;
})
}
})
what exactly do you want me to escape
message.content
but thats the main part
encodeUriComponent (caps may be different) on message.content
that might be the issue
so maybe remove emojis completely "".replace(/([\uE000-\uF8FF]|\uD83C[\uDF00-\uDFFF]|\uD83D[\uDC00-\uDDFF])/g, '')
You're supposed to compare channel IDs, not channel objects
the code is right and working
voltrex
TypeError [ERR_UNESCAPED_CHARACTERS]: Request path contains unescaped characters
this is the error i am trying to hide
client.on("message", async (message)=>{
if(message.author.bot) return
const channel = message.guild.channels.cache.find(c=>c.name==='chatbot')
if(message.channel === channel) {
fetch.default(`https://api.monkedev.com/fun/chat?msg=${message.content.replace(/([\uE000-\uF8FF]|\uD83C[\uDF00-\uDFFF]|\uD83D[\uDC00-\uDDFF])/g, '')}&uid=${message.author.id}`).catch(console.error)
.then(res=>res.json().catch(console.error))
.then(data=>{
message.channel.send(data.response).catch(console.error)
}).catch((error)=>{
error;
})
}
})
Here try this
@low river
ok wait
That's not the way to do that, use encodeURIComponent()
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/encodeURIComponent
DiscordAPIError: Cannot send an empty message
this is what i get now
Then the response of the API is empty
how to hide the empty codes
reference
#development message
Starting from point zero
You can't hid it, check if the message is empty before sending it and send an error message when. It is
btw this only happens for these emojies otherwise it all works just fine
You're API probably can't handle emojis that means, or at least not in discord format
yup
^^^
the replace wont work
same error
also the api cannot handle emojies like batman said
Hey what's wrong with this?
bot.on('guildMemberAdd', member => {
member.send("test");
});
The dms are open and it still won't send anything
You might need to enable the guild_members intent in your client config
isn't it under oauth2?
I don't think it is
If it is you need to enable it in client config AND oauth2 so enabling it in client config won't hurt
where is my client config tho
Pass it as first Param when creating the client instance
At new Client(config here)
And you were right guild_members is in fact a privileged intent so you need to enable it at your discord bot app, you can enable it on the home page
@slender thistle yo
I didn't hear a response from you about my offer
Would you be interested in helping me with my bot?
Bro
Aghhhhh
When my bot is invited to a new guild, how can I get my bot to send a message when it joins?
in which library
discord.js <<< coding language
^^^^^^
library
in conclusion, my library is discord.
discord.js
wait nvm
that's the wrong thing
but follows a similar concept
yeah
thats what i need then
use that event and then find a channel you can send messages into (a sample of that is in the link i sent)
the one you sent had more explanation and examples though
how does that matter
wherever you hook the rest of your events
you probably should code your bot from scratch
also this
yes ik but its too late now
literally
i was gonna code it from scratch
but then i heard that slappey kept stuff clean
and i dont think it stops u from anything
well slappeys going well for me
sureeeeeeeeee
i have around 40 commands and its working great
my dad works for microsoft
o hon
in fact he owns it
me scerd
how's the divorce going
what even is slappey?
Yeah
lmfaoao no i just used CRA as an example because the CRA boilerplate is similar to slappey boilerplates
yup
it's meh
because it's making you use es6 syntax
and some intermediate features
and obviously 90% of the userbase are newbies
tbh it is a bit difficult cause u cant really use client.on and stuff
u have to change a lot of stuff
aw I thought it would use some advanced builder
but it's just raw strings shoved into the file
why wouldnt it be?
lel
give it a good slap
i see the slap worked
aight well thanks for this screenshot
a picture is worth more than a thousand words
but reading docs is worth more than a thousand pics
database which is better for warn , check warn , rank. removewarn , customable prefix
Most databases will be fine.
If you want a starter database consider SQLite.
Or some database you like / find easy to work with (e.g. MongoDB)
never use a database for
Then you may want to spend the time to learn about them
relational databases are always going to be better for discord purposes because everything you're storing is relational
There's a lot to love and hate about them
I recommend a relational for the same reason cry said, but that doesn't mean you can't find success with other database models.
I am making an economy bot and I was wondering If it is possible to reward someone with cash when they rate our server on top.gg
Is that possible?
..
You already asked this question.
No before I asked if it was possible to give a user cash when they rate it 5 stars
same thing
Is it not allowed
@woeful pike is it possible to reward someone with cash when they rate any amount of stars my server on top.gg
no incentivizing reviews
I think that use case is allowed. Was thinking of voting
this is how it works on every platform that deals with reviews









