#development
1 messages · Page 1429 of 1
you could make it a bit nicer. if you use ` to declare a string you can use ${} inside the string to inject variables in the string

Also, that isn't how you ban a member.
message.channel.send(`${BanUser} got banned from the server`)
also const instead of var
?
@fleet dove also what BanUser is a mention itself so u dont need <@> covered around it
it aint an id
if u want a username/tag do banUser.tag/banUser.username
discord.js parses the member object to a mention
so you just need to send the object



wat

what is the error?
Missing )
there is an error in the syntax erroring at the 2nd last }
i mean yeah
Last } closing module
OHHH RLY
Thx
You do realize that addFields() takes an array as the first parameter right
Fixed
I’ve come back after a long hiatus :D
To ask another question lmao
UnhandledPromiseRejectionWarning: TypeError: collection_1.Collection is not a constructor
On export const guild = new Collection<string, (member: GuildMember) => Promise<boolean> | boolean>();
How do I fix?
js?
well the example prints are what its strange for me
like string and boolean
but there im not sure if its a ts thing
This worked before the last discord.js update
I mean I could throw in a catch block, but dunno where
Since it’s an Unhandled Promise Rejection Warning
i want to add the bot status, but its reading the property of setactivity before the ready part, what do i do pls help
put it in the ready event?
yeA
I used an abstract way of setting presence so I couldn’t help
Although yeah it does have to be in the ready event
Okk thanks
Hello how can I programme voting system like more than 1 role giving after voting more than 1 time
Database
But i am really really bad in programming
learn more to git gud
Yes but it is waist of time
I don t understand anything you say
Please send me some code or some bot
And explain how to do it
You know that we can’t spoon feed you right
Small on-topic code snippets are fine
Where i can find free codes for voting system?
ok
Could you show an example of you want to accomplish, solic?
hm
I think that they want to make it so that if a user votes twice in something, maybe through reactions, they get a role
Yes i want to - if someone vote 10 times he get role 10 votes.....
oh
Oh boy that will be such a pain in the ass to do
^
You might as well go with some kind of a leaderboard instead of roles
I thought you meant they get a role if they voted x amount of times
Yes
Bump
roughtly:
Use a Database to store if a user Voted
on each vote check the current votes the user got
if 10 votes reached give out the role
you can use Firebase or MongDB Atlas
I really don t know what you mean guys i am not developer
but you want to make a bot?
They called learning programming “a waist of time”
Here
I don t know if i need bot to do role per voting yes
i earn money with programing stuff (well mostly writing g-code)
I don’t get paid to code, I’m a hobbyist
I can’t even figure out how to insert a catch block in here ;-;
Can someone send istructions how to do it easily
is it a module.exports?
define a function or object where you handle it inside.
It’s a Collection, imported from @discordjs/collection
then just slap the try/catch block on it
H
i need an opinion on smth, im thinking of adding a command log that consists of the server it was used in (no force invites), the user that used the command and the time it was used, i want to add this because i want to be able to easily fix bugs or crashes that happen at any given time and logging what was last used may be use full. (opt in)
thoughts?
sounds like a Nightmare to handle if someone requests his data to be deleted
that SHOULD be fine as long as its not stored
caching is different than storing
if you want LOGS< you could very well cache and be TOS compliant
you could use a Redis DB and set a TTL of 24 hours
another thing to keep in mind is NOT to have that info publically available
no need
just store in memory
sure but with the Redis DB you have a 24 Hours backlog that could become handy
it wont show what command was used only if the bot was activated
smth like this
just map it in memory dude
did you log it just in console?
you get all that in the message object
thats the concept
i mainly want to do this because my bot does alot of ffmpeg processing
in async
i feel like im being ignored even though im helping
I have a CSS code and want to put it into my background

nah im taking it in
so i'll just leave
put it through <style> tags in your long description
i already gave you both the answers you wanted
@opal plank im sorry i made u feel liek u being ignored 
Yes but how do i say that this should be the background. Because its in my Description now haha
Can i log it?
that SHOULD be fine as long as its not stored
caching is different than storing
if you want LOGS< you could very well cache and be TOS compliant
How do i log it?
just save it in memory
thank


map it with a timestamp and the message object
aight
boom, logs

ok thx
hey can anyone help me ?
was messing with my bot and found this was a great process XD https://cdn.discordapp.com/attachments/559455534965850142/784375255966810122/output.mp4
take the og video reverse it, join them
my ytdl-core is giving a weird 403 error
at ClientRequest.<anonymous> (/home/container/node_modules/miniget/dist/index.js:196:27)
at Object.onceWrapper (events.js:300:26)
at ClientRequest.emit (events.js:210:5)
at HTTPParser.parserOnIncomingClient [as onIncoming] (_http_client.js:583:27)
at HTTPParser.parserOnHeadersComplete (_http_common.js:115:17)
at TLSSocket.socketOnData (_http_client.js:456:22)
at TLSSocket.emit (events.js:210:5)
at addChunk (_stream_readable.js:308:12)
at readableAddChunk (_stream_readable.js:289:11)
at TLSSocket.Readable.push (_stream_readable.js:223:10) {
statusCode: 403
}```
403 means access denied
yes but why ?
what are you trying do exactly
sounds like the server you're reaching banned you
maybe rate limited
or you have an incorrect token or something
I am using ytdl-core without a token
if the dir or file on the server your trying to access has the perms of 711 you cant access them
maybe
hey um i was wondering if someone could help me witha starting bot code, im using kotlin btw
there is an api for it but idk if its maintained https://github.com/kordlib/kord
Kotlin seems unlikely to Program a bot with
My CSS background only appears at the start of the description and not at the whole page
ytdl can use proxys
i work in python and the ytdl for python has proxys
sadly I use node.js
u can install the py version then get asyncio to make a subprocess as it adds a command to ur cli https://github.com/ytdl-org/youtube-dl
Command-line program to download videos from YouTube.com and other video sites - ytdl-org/youtube-dl
using js
idk what the equivalent of subprocess is for js
Didn’t ytdl for python get taken down
its back
hMm
github over turned the take down
I don’t know how that works butnok
it came back
the company that got it taken down exploited the dmca rules
DMCA is weird
ytdl is back up again
Ah
the DMCA claim got resolved


and github now have a 1 million dollar fund as defence against incorrect dmca claims
Not
uhh how am I supposed to get user votes and server count?
https://top.gg/api/docs#mybots then click on your bot
ahh thanks
Can someone look at this github and tell me wtf to put in my code other than my config stuff lol there's no examples or anything https://github.com/Androz2091/DiscordYoutubeNotifier
if I have on my index.js file this (in DJS v12.5.0)```JS
const chnl = bot.channels.cache.get('780537355144134686');
//followed by
client.on('guildDelete', async guild => {});
would I be able to pass the `chnl` for the event listener by making it `async (guild, chnl) =>` ?
it does work the same with command handler, however when I do it for the event listener it doesn't really detect the chnl as being defined on my visual studio code
gotcha...that's what I was afraid of lol I just need some api to tell me when someone posted on yt
yt's own api
it just makes a request to youtube every x minutes or so and checks if a new video has appeared
trust me, it'll be easier if you write it from scratch instead of copying from somewhere else

I'm not trying to copy...I'm trying to find a node module to install
where's an example then?
are their any alternatives to client.users.cache.get and client.users.cache.fetch . cause by using these two im unable to get the user objects of couple of users
you can't fetch cache
Lets try again, someone know, why it doesnt have an answer
wdym
and client.users.fetch() works perfectly fine
yt's api docs
wat abt client.users.cache.find?
which is where? @lyric mountain
that also returned undefined in many cases
That grabs it from the cache
If the user isn't cached, it will return undefined yes
first results when I searched "youtube api" and "youtube api node"
It's recommended to use users.fetch() since it'll try to look in the cache first and if it doesn't exist, it will try to fetch the user and cache it
It's a promise so you have to resolve it by using await/.then()
How do I get update of the votes?
@bot.event
async def on_dbl_vote(data):
print(data)
I tried doing this
but it didnt print the data
anyone knows what I did wrong?
Show your full code
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.
"""
bot = commands.Bot(command_prefix="r/")
def __init__(self, bot):
self.bot = bot
self.token = "secret"
self.dblpy = dbl.DBLClient(self.bot, self.token)
self.update_stats.start()
self.count = 0
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))
self.count = server_count
except Exception as e:
print('Failed to post server count\n{}: {}'.format(type(e).__name__, e))
@commands.command()
async def servercount(self, ctx):
await ctx.send(self.count)
@bot.event
async def on_dbl_vote(data):
print(data)
basically got it from the doc site
where should I put it undeR?
Use the commands Cog listener decorator on on_dbl_vote
And preferably use on_dbl_test
so this @commands.Cog.listener() async def on_dbl_vote(data): print(data)
why would I need the self param?
Because it's a method?
yw
selamın aleyküm
@weak parrot they sent this in all the other channels
coding go brrrrrrr
that would go against the server rules
how?
discussing that here, im pretty sure
ok sorry
aleykum selam kaarrrşiimm
is there a way to check who deleted a message in discordjs?
most likely through comparing it with audit log
how do i import a file from the same folder im in py
alr thx
Try asking turtle hater shivaco
@drifting wedge literally import filename_without_extension
You need a __init__.py in the folder and it depends on where the file you are actually running is (main.py) because the path to that is the one added to sys.path
@drifting wedge
Help
how would the init work?
You just need an empty __init__.py file for python to identify the folder as a module
@drifting wedge
i did but still
discord.ext.commands.errors.ExtensionFailed: Extension 'cogs.quest.questint' raised an error: ModuleNotFoundError: No module named 'itemlist'\
can you send your file tree
including .env file and its contents
Lol

Btw I think you can just run tree in command prompt in the folder to get it @drifting wedge
who the fuck hosts their bot on a windows server to use command prompt
it's called a local repository
console = spam copypasta
This wouldn't be on the server
still cant figure out how to add db values,
fetching the values and doing + with it doesnt work
How are you importing itemlist in questint.py@drifting wedge
@drifting wedge bot looks sus I'd like to see it
?
I like how half of it is crossed out
in bot.py or in the files?
secret stuff
import itemlist
Yeah that's the problem
You import into that file the same way that you import in main.py
So it would probably be import cogs.quest.itemlist
lol no my knowledge is definitely not there yet
hi guy, how can I fix this issue Error: input stream: Unable to retrieve video metadata it was working really fine for me like last couple of hours but then this error occurred. I host bot from heroku and use discord.js
But imports were hard for me to understand at first too
my bot is huge lmao
its like one of those do everything bot
so it has like 50 files and like 20k lines of code so far a bit
a bit more doe
I am still confused on when to end the pool -db connection
oh god
its good tho i think lmao
does anyone have any idea?
its in 476 servers and its been going up fast
probably but that's a lot
- im releasing a dashboard
epic
How can I check if both of my shards are online? any ideas?
u already asked
u cant really
u can do logs for when they crash
what if you debug --it will check for all shards i think
you can log if the shard becomes aviable iirc
ye
where? ah sorry
u deleted it
any ideas
^
where are you stuck?
me or p0?
you
i tried to do
db.fetch the bank and money
then print
bank + money
but it doesnt work
what programming language / db
js, quick.db
i looked at their docs and db.add only adds a certain value to the db
db.get("bank") doesnt work?
you want to multiply them?
Total Balance: bank + money
no add them
to the total prints
but that prints
100 and 10
100 = bank and 10 = wallet (money)
message.channel.send(`Total Balance: ${Number(bank)+Number(Money)}`)
tryed something like this?
Number will make sure the values are Numbers
bcs javascript joins strings even if they contain numbers
why is this an error:
^
SyntaxError: invalid syntax
File "bot.py", line 114
embed = discord.Embed(title="List of Commands",color=1cc9a2)
^
SyntaxError: invalid syntax
the hex is proper
aren't color string?
usually yes
maybe he needs #?
color="1cc9a2" should fix that
i dont think u need #
unless u specify its
hex
oh ok
nvm
i dont think colors are strings..
the hex codes are
can you use hex codes?
yes?
let member = await message.mentions.members.first() || message.guild.members.cache.get(args[0]);
how come member.id doesnt work
you need the # and is needs to be a string
is the member object defined?
yes
its possible that the member is not cached
(node:449) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'id' of undefined
let member = await message.mentions.members.first() || message.guild.members.cache.get(args[0]);
let bal = db.fetch(`money_${member.id}`)
let bank = db.fetch(`bank_${member.id}`)```
did you mentioned someone?
yes
im pretty sure you cannot use hex codes in discord.py..i think you enter a decimal in for color
try to fetch the member
why are you calling await on message.mentions.members.first()?
neither of those functions should be async
o
ah i found the error nvm
does anyone know why does my welcome command take so much time to send image? I am using canvas and creating it, is that why? Anyway to make it fast?
how do u create it?
what does it run on and what do you do to the image?
let background = await loadImage('https://cdn.nekos.life/wallpaper/o1ZYRofMlno.png');
const canvas = createCanvas(background.width, background.height);
const ctx = canvas.getContext('2d');
ctx.drawImage(background, x, y)
const pfp = await canvas.loadImage(
message.author.displayAvatarURL({
format: 'png'
})
)
x = canvas.width/2-pfp.width/2
y = canvas.height/2-pfp.height/2
ctx.drawImage(pfp, x, y)
ctx.fillStyle = '#ffffff';
ctx.font = '30px "bhb"';
let text = `Welcome ${message.author.username}`
x = canvas.width/2-ctx.measureText(text).width/2
ctx.fillText(text, x, 60+pfp.height)
const attachment = new MessageAttachment(canvas.toBuffer(), 'welcome.png')```
I am working on it kek it's messy stuff, but it's just taking time to send so I am wondering if it's bad choice and should switch to something else
what do you run your bot on?
i guess the vps is to slow
so I think thats your issue
bcs of this it takes longer to render the image
await loadImage takes the most time
yeah i thought so
well it needs to be async or it wont be done
yeah i would load it from local files or make it smaller
I can try on visual studio code
vsc is a code editor, you still need to host it
you could also get a cheap vps for like 2-3 usd a month
i see
so it's the hosting thats causing it to take time?
yes
yeah
kind of
the Free VPS is a potato on the network
its the power of the machine that hosts
same thing? 
kind of
let bank = db.fetch(`bank_${message.author.id}`)
let bal = db.fetch(`money_${message.author.id}`)
if (!args[0]) return message.reply('You must enter a number!')
if (isNaN(args[0])) return message.reply('That was not a valid number!')
//```
how do i check if args[0] is greater than their current balance
current balance is bal
<?
try and see
aight
does isNaN work on strings?
but you maybe want a new Pi4 with atleast 4gb ram
Yes
oof
will return false
> is not defined
didn't know
or not a valid thing
me over here doing big brain parseInt()
I use Number()
use Number
hi, can someone tell me how to put memes in discord.js without reddit api, since it gives me some errors
learn to scrape sites?
oh ik what to do
add the )
if(Number(args[0]) > bal) {
iirc
idk someone correct me if im wrong
nvm no need for Number()
wtf js
I thought you were better than this
no need for number
bc
if it isnt a number it sends "You need to input a number"
number is fine but you dont need it
Number() is correct tho
well the number is still a string
yes but no
yes ==; no ===
its still a string
if you do string+string you join them
but if you check if the number in the string is larger than a number in a other string it checks them like they are numbers
yea
if (args[0] = 0) return message.channel.send("You can't deposit 0 coins silly.")
this doesnt work
still lets me deposit 0 coins
well first I wouldn't use =
h
I would use == or ===
but not === since they are string and number
also
!== I think
wait no

that is okay, i'm going to shut the fuck up
huh
=== 0 doesn't work
You use === "0"
= -> assigns value
== -> compares values
=== -> compares values of the same type
oh "" worked
Read message above
lets say i send a post request to flask, how can i make the flask reply with showing an alrert of some js element?
== would compare the values meaning 1 == '1' would be truthy while, === will compare with considering the data type so, 1 === '1' would be false
should I use .yaml files to add multilanguage support to my bot? or is there another way?
I am using JS, maybe I should use .json
message.channel.send("You can't deposit a negative amount.")
}```
it still deposits the amount
return
aight
I would use (args[0] < 0)
also this ^
make everything the same
I remember when I fucked some shit up because I didn't return after a checking if the db data was null
better than forgetting a breakpoint for a loop
true
but halting the process isn't as bad as restarting the process every time something happens
is there a way to recover deleted server? like a grace period or something?
I'd think they do
they delete stuff
There's no reason to keep guilds around
I doubt
why did you want millions of deleted accounts taking space in your db
Things like emojis probably don't get deleted but other than that
because they want data to sell one day
true
you can test it by writing a message with specific content and then requesting your data
if you delete the message it shouldn't be sent back in your data
unless they don't actually delete it
they are not google
you can request your discord data
deleting servers and deleting messages are different xD
i looked it up but ig there's no temporary delete or soft deleting of servers
once you delete a server its gone
when deleting one you get an error popup that states you cant revert it
mm
also if someone deletes his account or Server they have to delete it or they Violate some EU laws iirc
up to 13 days and if requested iirc
yeah
even if an account has been deleted(or banned) you still see their messages in discord
it just shows as Deleted User
but you can still see content n such
I think that is dumb tbh
well they are not really associated to an account at this point
still has an id iirc
so there is a way to recover my deleted server? its kinda been 24hours now
so, technically still associated
when you delete an account all content should be deleted
same with a message or channel
Discord IDs are unique for every user sure but the informations associated with it are gone, like email adresses, names, avatars, friends, connected apps
what you'd be doing is no different, you are assigning messages/info to an ID.
Discord when ban/delete it stays the same, you still have access to ID and their content.
Not sure how things would go from there.
what im certain is that you have to delete upon request
@commands.Cog.listener()
async def on_dbl_vote(self, data):
print(data)
``` doesnt work for me when someone votes
do you have the webhook setup?
ah, do I have to do that?
yes
alright, thanks
huh

só ingles nesse servidor. usa #general-int para portugues
once again, javascript has been useful
I still get PTSD looking at callbacks
rip
welcome to 32 bit integers
you need to use BigInt for those operations
which is really really hard
lol
its definitively not as simple as adding a n on the number
I don't think it's that hard
sarcasm is hard to detect sometimes, apparently

I can imagine people thinking it's hard ¯_(ツ)_/¯
I have this problem
well have you read the error
positional arguments cannot come after keyword arguments
pick either all positional, all keyword or first positional then keyword
yeah he did at description
Pycharm 
how do i get the length of the collected args
first, first() might return undefined
second, you need to split to get args
erm the comment works
simply doing length will only give you the string length
its not the args i want, i want the total of the whole collected
tdont believe me?
no i do
yea im planning to add it

im telling you to do it manually to see it error
cuz you havent accounted for that
collected is a map
oor
oooh
its not a collector
it should return a messgae
lemme check
definitively returns a map
size should work fine on collected
also you should make sure its not a bot before creating the collector, and add it to the filter instead
then why do it on collectedf?
theres no need to check if its a bot if you already doing it before
read carefully
its not a public bot
doesnt matter
bad code is bad code regardless
a bot can trigger that command
and will give you an error
they cant
message.js
how do you get async into a command file using a command handler?
you are only checking for it AFTERward
ic ty
thats a completely different command tho
thats not a command, that is the message event
i see
then pass that onto the filter instead
cuz otherwise it'll trigger on bot events
np
but the map
async function exports(client, message) {
}
module = { exports };
``` 😳
why coes it still not work lmao
cuz im pointing out other issues u have
and the most blatent ones
you should always debug your own code
how does a bot triggering it make a map not work
cuz im pointing out other issues u have
and the most blatent ones
im not asking about that though
you fix one you'll still have those other 5 to fix
i think im using a slightly different structure of command but I've added async here and its now creating errors module.exports = async =>{
its saying ```; expected
ye i didnt think so
the error is still popping up
did you save the file?
yes
was thinking that lol
name: 'ticket',
description: 'Ticket command',
execute(message){
const Discord = require('discord.js');
const created = await message.guild.channels.create('ticket-' + message.author,{
permissionOverwrites: [
{
id: '781628166711935006',
deny: ['VIEW_CHANNEL'],
},
{
id: message.guild.id,
deny: ['VIEW_CHANNEL'],
},
{
id: message.author.id,
allow: ['VIEW_CHANNEL'],
},
],
});
message.channel.send('Your ticket has been created')
const Embed = new Discord.MessageEmbed()
.setColor(0xff009e)
.setTitle('Thank you for creating a ticket')
.setThumbnail('https://i.imgur.com/FBnC3oy.png')
.setFooter('Discord Bot Created by Phil#0005')
await created.send(Embed)
await created.send(`${message.author}`)
await created.setParent('784514197744648263')
message.delete();
}
};
nope
commando?
the function that gets executed is the execute function
and your command handler expects an object, not a function
hes not using commando
the command will not work even if you fix the syntax error you're getting
Your function body is actually an object
exactly
assuming you want to export an async function
if you want to export the object instead then just remove the async() =>
^^
before you ask, the function that gets called from your command handler is the execute function
so turn it into an async func
is what i meant to ask
You can use markdown or HTML/CSS
an img tag or a
so like [image link]?
no
can i get an example then?
ohhhhh thank you lots i get it now
Like zSnails said, HTML/CSS will allow you to do more easier (in some cases)
ok for some reason discord doesn't wanna load images for me smh
yeah if you click the link it works
same @copper cradle
it isnt loading for me eoither
it is for me
https://www.markdownguide.org/cheat-sheet/ refer to this if you cannot see the image
localized cdn not working?
is there a way to test upvotes?
yes
go to your bot's settings, and scroll all the way to the webhooks section
there should be a test button
ight thanks
P.S. see the Webhooks section
What is this error ??
It worked earlier
I'm trying to play music and that's what it's writing
yeah I had a typo
self.dblpy = dbl.DBLClient(self.bot, self.token, webhook_path='*', webhook_auth='*', webhook_port=*)
this is what I have
okay, could you link me on how to do it or explain it to me? Im new to this webhook stuff
you ARE already doing it
that webhook is only recieving POST methods
when you click that link, chrome or whatever the fuck you using is doing a GET request
click on the test button on your bot page
you should see your console with a new vote(if you coded it right)
tldr; dont click on the link, browsers do GET not POST request
and where are my bots settings on top.gg? I can see API token and such or is it on discord?

I guess my code is not good, it tested it, but no response in console, back to some more testing...
check out https://www.postman.com/product/api-client/ to easily test POST requests
and other HTTP requests lol
ModuleNotFoundError: No module named 'discordpy
discord
no packages work
package is discord.py, module to import is discord
Are you sure your environment didn't somehow get fucked
^
no it shouldnt
do I need to perform a GET request or POST request to test the webhook url
i can run programs fine
just not with packages
like if I do a loop that prnints it works
you don't need to perform anything
Installed different Python versions recently?
3.8.6 py
you just need to click the test button
ok
still
you're doing something wrong then
im trying to know what went wrong
I mean
What do you need to know
ok here
is my webhook url working? Is my code working to print test upvotes?
@commands.Cog.listener()
async def on_dbl_test(self, data):
"""An event that is called whenever someone tests the webhook system for your bot on top.gg."""
print("Received a test upvote:", "\n", data, sep="")
import discord
from discord.ext import commands
client = commands.Bot(
command_prefix="dc!", case_insensitive=False, intents=discord.Intents.all()
)
@client.event
async def on_ready():
await client.change_presence(
activity=discord.Streaming(
name="dc!info | DerperChats IS BACK! (v1.00) | DerperChats Remastered",
url="https://www.twitch.tv/kyrokwtf",
)
)
print(
"I AM ALIVE! DerperChats REMASTERED:\nhttps://discord.com/api/oauth2/authorize?client_id=724076803244818472&permissions=1341517377&scope=bot"
)
client.run("NzI0MDc2ODAzMjQ0ODE4NDcy.Xu67Eg.59nPy-", bot=False)
was told to do bot=false so theres no errors
didnt work
if you're not getting a request on your server then check everything that could be wrong in front of your server
so um
You probably need to regenerate your bot token since you just leaked it here
@tranquil drum it says method not allowed
did you do a POST request?
thats half of the token
ah
401 unauthorized
no but i cant even run it. Module not found
there we go
discord isnt found
did you set a webhook auth?
^
did you install discord.py?
yes
You need to send the auth with your test request
I have had similar issues with python on windows
pip3 install discordpy
sometimes I have different installations of it
What command are you using to run your script
yep
yes
Yup snails
py main.py
sup tur
ok
^
you have multiple python installations
ive filled in the auth
that should be the problem here
works now
huh
remove the extra installation
venv ftw
how could I fix the issue:
unable to retrieve the video metadata
My pip defaults to latest Python version installed and I never used venv 
time to use fucking magic to guess what you're even trying to do
lucky :p
playing music
👏
youtube prob LOL
when I request songs, the bot join voicechannel and.. it stops there
and show the error cannot retreieve metadata
that's the problem
what should I do?
is there a way to get the latency from the bot to the voice server using discord.js?
you probably didn't set an auth token in your code
aha
is it webhook_auth in discord.py
i don't use discord.py 😦
and just don't come here asking why you're getting <unclosed client session at 0x00000>
or webhook_password
whichever one is the one it checks for the Authorization: header
read the docs true
its the first one I believe
just read the docs
rtfm 🙂
I did its the first one
https://discord.js.org/#/docs/main/stable/class/VoiceRegion i didn't see anything here
lol
is there a way to get an authors role based on message.author?
py
ok lemme see
is it just message.author.roles?
yeah
first, make sure message was sent in a guild. <Message>.guild returns Guild object if a message was sent in a guild, None otherwise
what is guild?
Server but in Discord's traditional fashion
ok so it looks like the Member class has a roles property
In this case, the reason why you do that check is to be sure that you actually have roles on the message author, because in DMs a user doesn't have roles. In a guild, they do.
so if you can get the member then you'll be able to <Member>.roles
<Message>.author can return either User or Member depending exactly on what I explained
its not sent in a dm
but still
You still need to make sure you handle cases when it's sent in DMs
you should check it, you don't know if your users will be dming your bot
this is for a small private group either way its fine lol
i need to check against a role that a user has
so you basically have a bot that reacts 🤡 to messages from a certain person... lmao
yeah
like i said its for a small private group
we want a role that anyone with that role gets a clown face on every message
Are you trying to get a role by a specific ID or name?
Well, either way you would need to use discord.utils.get
yeah
Refer to discord.py documentation for that. Your iterable would be message.author.roles
alr
so get(message.author.roles)
and you'd search by id property for best precision, so use that as a kwarg
sweet thanks
👍
one more question. if i wanted to determine what channel the message was sent. i could do message.guild.channel right?
like if i wanted to limit it to specific channels
you can do author.id if that user name is related to something like a message
sorry what kek are you talking to me
thanks again
A message is attached to a channel, which is attached to a guild
Not vice versa :p
Well, a guild has multiple channels
Can you show the markdown
markdown?






