#discord-bots
1 messages · Page 631 of 1
👍
Is there any way to get the command's argument to another command? (i use group command)
!d discord.ext.commands.Command.signature i'm pretty sure it's this
property signature: str```
Returns a POSIX-like signature useful for help command output.
how can i use it because it doesn't explain
raise CommandOnCooldown(bucket, retry_after)
discord.ext.commands.errors.CommandOnCooldown: You are on cooldown. Try again in 38.01s
```How do i print out the cooldown?
The 38.01s
error.retry_after
Do u have an error handler?
error is a parameter?
No
O, u need tho
Oh
@bot.event
async def on_command_error(ctx, error):
if isinstance(error, commands.CommandOnCooldown):
print(error.retry_after)
Ohh
Sorry for spoonfeeding ;-;
So is error a parameter?
@bot.event
async def on_ready():
guild = await bot.fetch_guild(id)
print(guild.name)
members = await guild.members
for member in members:
print(member.name)
why doesn't this work?
Yea, a required param
Oh ok
Don't fetch it
y not?
you dont need to await guild.members
!d discord.Client.get_guild
get_guild(id, /)```
Returns a guild with the given ID.
Hello
Use this
Hi Hunter
Hi
no more await ctx.send(“!ot”) I see.
Not for saying a little Hi Hello
async def on_ready():
guild = await bot.get_guild(id)
print(guild.name)
members = guild.members
for member in members:
print(member.name)
this is the updated code and this is the error:
TypeError: object NoneType can't be used in 'await' expression
how to use signature
Something is None
how can i convert a normal file to discord.file object to send it
Wdym lmao
Not in on_ready
!d discord.ext.commands.Command.signatutr
? Huh?
!d discord.ext.commands.Command.signature
property signature: str```
Returns a POSIX-like signature useful for help command output.
This?
Spelling wrogn
i wanna send images
discord.errors.InvalidArgument: file parameter must be File
file = discord.File(...)
await ctx.send(file=file)
this is the error*
TypeError: object Guild can't be used in 'await' expression
!d discord.File
class discord.File(fp, filename=None, *, spoiler=False)```
A parameter object used for [`abc.Messageable.send()`](https://discordpy.readthedocs.io/en/master/api.html#discord.abc.Messageable.send "discord.abc.Messageable.send") for sending file objects.
Note
File objects are single use and are not meant to be reused in multiple [`abc.Messageable.send()`](https://discordpy.readthedocs.io/en/master/api.html#discord.abc.Messageable.send "discord.abc.Messageable.send")s.
I thought you can just do open() normally
i did exactly that lmao
Remove the await
!local-file
Thanks to discord.py, sending local files as embed images is simple. You have to create an instance of discord.File class:
# When you know the file exact path, you can pass it.
file = discord.File("/this/is/path/to/my/file.png", filename="file.png")
# When you have the file-like object, then you can pass this instead path.
with open("/this/is/path/to/my/file.png", "rb") as f:
file = discord.File(f)
When using the file-like object, you have to open it in rb mode. Also, in this case, passing filename to it is not necessary.
Please note that filename can't contain underscores. This is a Discord limitation.
discord.Embed instances have a set_image method which can be used to set an attachment as an image:
embed = discord.Embed()
# Set other fields
embed.set_image(url="attachment://file.png") # Filename here must be exactly same as attachment filename.
After this, you can send an embed with an attachment to Discord:
await channel.send(file=file, embed=embed)
This example uses discord.TextChannel for sending, but any instance of discord.abc.Messageable can be used for sending.
See this
I though open() would do fine
No
🤷♂️
Oh
ahhh my bad i didnt set mode correctly
that works but now it just prints the bot's name
What do u wanna print then
Ah wait
@bot.event
async def on_ready():
guild = bot.get_guild(909170415337869333)
members = guild.members
for member in members:
print(member.name)
!intentd
Using intents in discord.py
Intents are a feature of Discord that tells the gateway exactly which events to send your bot. By default, discord.py has all intents enabled, except for the Members and Presences intents, which are needed for events such as on_member and to get members' statuses.
To enable one of these intents, you need to first go to the Discord developer portal, then to the bot page of your bot's application. Scroll down to the Privileged Gateway Intents section, then enable the intents that you need.
Next, in your bot you need to set the intents you want to connect with in the bot's constructor using the intents keyword argument, like this:
from discord import Intents
from discord.ext import commands
intents = Intents.default()
intents.members = True
bot = commands.Bot(command_prefix="!", intents=intents)
For more info about using intents, see the discord.py docs on intents, and for general information about them, see the Discord developer documentation on intents.
U need members intent
client = discord.Client()
intents = discord.Intents.all()
bot = Bot(command_prefix="", intents=intents)
I did this tho
So you want the name of everyone on the server?
yes
Why Bot and Client both tho
Why tf is your command prefix empty
cuz I don't need it
Why did you define both client and bot? You should do only one.
Ok
Then do not initialize your Bot class at all.
my bad I coppied the intents thing from another dude and forgot to remove it
Here's the difference between Client and Bot.
Cool
Copied. Huh.
that doesn't change anything tho
I coppied 2 lines for the intents...
Ima change my bot then 😭😭
I can’t find the soy sauce
I can just get the Lao gan ma
so.. how do I fix this?
intents = discord.Intents.all()
bot = Bot(command_prefix="", intents=intents)
@bot.event
async def on_ready():
guild = bot.get_guild(id)
members = guild.members
for member in members:
print(member.name)
it just prints me my bot's name
Cz only u both are there in the guild?
no
I doubt that
Im pretty new to discord.py and would like to get the ids of all the people in the discord server that the bot is used in.
Thanks,
Aarav
I think this will help
Have you got member intents enabled?
🤷♂️
A command seems more ideal
That’s true
Damn
Excuse me while I eat breakfast
is there a good wrapper that works for accessing the http api directly? i remember that you could do it with discord.py but i don't quite know what the current state of that is (for oauth2)
!pypi disnake
is this just a fork of dpy, but still updated?
Fork
It's a decent well maintained fork
says the developer
I mean most of the people here like it
sounds decent i guess
@slate swan hi
hey
👋
you can't anymore
😭😭
we cannot get the verified bot dev badge anymore
You're cool.
is there a way to fetch https://discord.com/developers/docs/topics/oauth2#get-current-authorization-information with disnake?
can't seem to find the method in HttpClient
you can literally do whatever you could with discord.py in disnake
oh wait i can just abuse http.Route and it should work
Wahhhh
soo i have this command which updates the status in how many servers the bot is in, is it possible to make the command update the status automatically when its been added in a new server
@bot.command()
async def status(ctx):
await bot.change_presence(activity=discord.Game(name=" s!help in " + str(len(bot.guilds)) + " Servers."))```
!d discord.on_guild_join
discord.on_guild_join(guild)```
Called when a [`Guild`](https://discordpy.readthedocs.io/en/master/api.html#discord.Guild "discord.Guild") is either created by the [`Client`](https://discordpy.readthedocs.io/en/master/api.html#discord.Client "discord.Client") or when the [`Client`](https://discordpy.readthedocs.io/en/master/api.html#discord.Client "discord.Client") joins a guild.
This requires [`Intents.guilds`](https://discordpy.readthedocs.io/en/master/api.html#discord.Intents.guilds "discord.Intents.guilds") to be enabled.
there is a on_guild_join event
nvm
How can I reply a set of random text when the bot is mentioned? In python?
do you mean when a message is sent that only mentions the bot or a message that contains your bot mention?
!d random.choice
random.choice(seq)```
Return a random element from the non-empty sequence *seq*. If *seq* is empty, raises [`IndexError`](https://docs.python.org/3/library/exceptions.html#IndexError "IndexError").
like dis?
@bot.event
async def on_message(discord_guild_join):
await bot.change_presence(activity=discord.Game(name=" s!help in " + str(len(bot.guilds)) + " Servers."))```
discord.on_guild_join(guild)```
Called when a [`Guild`](https://discordpy.readthedocs.io/en/master/api.html#discord.Guild "discord.Guild") is either created by the [`Client`](https://discordpy.readthedocs.io/en/master/api.html#discord.Client "discord.Client") or when the [`Client`](https://discordpy.readthedocs.io/en/master/api.html#discord.Client "discord.Client") joins a guild.
This requires [`Intents.guilds`](https://discordpy.readthedocs.io/en/master/api.html#discord.Intents.guilds "discord.Intents.guilds") to be enabled.
is your bot big by the way?
Yea
thats the default help command
That is the default behaviour
!d discord.ext.commands.DefaultHelpCommand
class discord.ext.commands.DefaultHelpCommand(*args, **kwargs)```
The implementation of the default help command.
This inherits from [`HelpCommand`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.HelpCommand "discord.ext.commands.HelpCommand").
It extends it with the following attributes.
!custom-help
Custom help commands in discord.py
To learn more about how to create custom help commands in discord.py by subclassing the help command, please see this tutorial by Stella#2000
you can make your own by doing bot.remove_command("help")
No
help_command=None is there for a reason
both work :P
right now I'm making a bot that shows the stats for my gd private server, and this is what I have made so far ```py
@client.command()
async def leaderboard(ctx):
await ctx.send('What leaderboard do you want to see? Star or CP?')
@client.command()
async def levels(ctx):
await ctx.send('Please say the level ID.')```
@maiden fable you made an API right?
Mhm
what exactly does it do?
Can you elaborate on what you want please? What stats?
AI Chat (That is what HunAI, my bot, uses)
how'd you make it?
!pypi flask
Just a raw API
Is it difficult?
is it public?
Making the API was damn easy
Nah, it is private cz anyone can literally DDOS it since it doesn't have any authentication or something haha
The leaderboard, the players and the levels
except I don't have the players command yet
what is hosting the api?
It would literally be a piece of cake for u @spring flax
and the github repo is private?
something has to run the code right?
😄
also, if i want to make something lets say for a game there are guns and each gun has stats, what's the best approach?
ah, replit for now, gonna change over to something else soon
Well let's get a help channel for these talks, shall we? This chat isn't really related to this sorta talks haha
That doesn't work for me though...
code
It will remove the help command
ok
🤷♂️ depending if you called it client or bot
for me it's client
np thx
Then client.remove_command()
Ok then b it it is remove_command()
are you setting that in the Client's constructor?
fardddddd
Won’t work
You’d have to have your pc on 24/7
Cheaper to buy raspberry pi
Or just use linode lmao
Like @unkempt canyon here
Oh it works!
my bot works only me online, my bot its "me".
Ok now I have to make my own help command and change the style of text
What
i create bot on pyw and but on regedit startup
all times when my pc start
Or create flask
flask?
HOW CAN I MAKE A BOT JOIN A VOICE CHANNEL
Like create a website and host it on there
uhn no
Search it up, there are useful resources online
how to create a discord bot
in pycharm
If you go inactive is closes
with soundcloud
🤦
wdym
Find tutorials online lmao
I think there is a module for signing into stuff
I forgor the name 💀
Hey @hazy agate! I noticed you posted a seemingly valid Discord API token in your message and have removed your message. This means that your token has been compromised. Please change your token immediately at: https://discordapp.com/developers/applications/me
Feel free to re-post it with the token removed. If you believe this was a mistake, please let us know!
Don’t include the token lmao
send code again
😂😂
on dm
No don’t
ok
Don’t reveal your bot token
yes i know
rd
import random
import time
import asyncio
TOKEN = "NO!"
client = discord.Client()
@client.event
async def on_message(message):
if message.author == client.user:
return
if message.content.startswith("!Ping"):
await message.channel.send("Pong!")
if message.content.startswith("!Idiot"):
await message.channel.send("No u idiot!")
if message.content.startswith("!Hi"):
await message.channel.send("*Hello!*")
if message.content.startswith("!SUS"):
await message.channel.send("Ayo stop my brain is going dumb!")
if message.content.startswith("!Hri"):
await message.channel.send("=Dumb!")
if message.content.startswith("!>"):
await message.channel.send("Wat u mean bro!!")
@client.event
async def on_ready():
print("Bot is Ready :)")
client.run(TOKEN)
Now I want to make an embed for the text
ignore the commands
!code
Here's how to format Python code on Discord:
```py
print('Hello world!')
```
These are backticks, not quotes. Check this out if you can't find the backtick key.
Embeds
async def check_user(ctx,user):
with open("logins.json","r") as f:
logins = json.load(f)
if not str(user.id) in logins:
msg = await ctx.send(f"{user.mention}Make an account or log in.")
return msg
else:
User1 = logins[str(user.id)]
return User1
@client.command()
@commands.cooldown(1,30,commands.BucketType.user)
async def work(ctx):
await check_user(ctx,ctx.author)
``` It doesent send the message
bro
Ye thats what I want to do
!d discord.Embed *
class discord.Embed(*, colour=Embed.Empty, color=Embed.Empty, title=Embed.Empty, type='rich', url=Embed.Empty, description=Embed.Empty, timestamp=None)```
Represents a Discord embed.
len(x) Returns the total size of the embed. Useful for checking if it’s within the 6000 character limit.
bool(b) Returns whether the embed has any data set.
New in version 2.0.
Certain properties return an `EmbedProxy`, a type that acts similar to a regular [`dict`](https://docs.python.org/3/library/stdtypes.html#dict "(in Python v3.9)") except using dotted access, e.g. `embed.author.icon_url`. If the attribute is invalid or empty, then a special sentinel value is returned, [`Embed.Empty`](https://discordpy.readthedocs.io/en/master/api.html#discord.Embed.Empty "discord.Embed.Empty").
For ease of use, all parameters that expect a [`str`](https://docs.python.org/3/library/stdtypes.html#str "(in Python v3.9)") are implicitly casted to [`str`](https://docs.python.org/3/library/stdtypes.html#str "(in Python v3.9)") for you.
I HATE THIS BOTS !d COMMAND
*python
yea
What
await connect(*, timeout=60.0, reconnect=True, cls=<class 'discord.voice_client.VoiceClient'>)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Connects to voice and creates a [`VoiceClient`](https://discordpy.readthedocs.io/en/master/api.html#discord.VoiceClient "discord.VoiceClient") to establish your connection to the voice server.
This requires [`Intents.voice_states`](https://discordpy.readthedocs.io/en/master/api.html#discord.Intents.voice_states "discord.Intents.voice_states").
!d discord.Guild.get_channel can be used
get_channel(channel_id, /)```
Returns a channel with the given ID.
Note
This does *not* search for threads.
hi i need help its urgent
ig that works as well
Don’t ask to ask
And we need your question cz its urgent
i want to delte all channels with same name using discord.py
!d discord.TextChannel.delete
await delete(*, reason=None)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Deletes the channel.
You must have [`manage_channels`](https://discordpy.readthedocs.io/en/master/api.html#discord.Permissions.manage_channels "discord.Permissions.manage_channels") permission to use this.
You have to have admin privileges
......?
yeah
there are 1200 channels with same name i want to delete all
ayobro how can
@hazy agate
await connect(*, timeout=60.0, reconnect=True, cls=<class 'discord.voice_client.VoiceClient'>)
only this
for cnl in guild.text_channels:
if cnl.name == name:
await cnl.delete()
then
Nonono
wthen?
hmm
We’re not spoonfeeding you code, you’ll have to find out in the docs or some resource
can u send like full code
am new for it
Idk what this code even is
Can anyone help?
got a link on database, need to set as bot avatar
Code:
if (str(ctx.guild.id)) in self.pic:
pic = self.pic[f"{ctx.guild.id}"]
with open(pic, 'rb') as file:
await self.bot.user.edit(avatar = await file.read())
Error:
FileNotFoundError: [Errno 2] No such file or directory: 'https://cdn.discordapp.com/attachments/865581332737294336/914107357485756446/unknown.png'
await connect(*, timeout=60.0, reconnect=True, cls=<class 'discord.voice_client.VoiceClient'>)
Python or discord py
I'm really confused
async def check_user(ctx,user):
with open("logins.json","r") as f:
logins = json.load(f)
if not str(user.id) in logins:
msg = await ctx.send(f"{user.mention}Make an account or log in.")
return msg
else:
User1 = logins[str(user.id)]
return User1
@client.command()
@commands.cooldown(1,30,commands.BucketType.user)
async def work(ctx):
await check_user(ctx,ctx.author)```It doesent send a message
Because you never told it to
could be it is running the else block?
Unless you used the check_user
return await ctx.send doesent work
You have to send msg
@deep sorrel
Hey @hazy agate!
Uh-oh! It looks like your message got zapped by our spam filter. We currently don't allow .txt attachments, so here are some tips to help you travel safely:
• If you attempted to send a message longer than 2000 characters, try shortening your message to fit within the character limit or use a pasting service (see below)
• If you tried to show someone your code, you can use codeblocks
(run !code-blocks in #bot-commands for more information) or use a pasting service like:
Dude
My account token is ||never gonna give you up, never gonna let down||
Stop
msg = f"{user.mention}Make an account or log in." return await ctx.send(msg)
Best Token 😋
No return
ayo i think this is the most developed bot
Remove return
A bit
!source
Don’t ping the admins
You did
😂
He is a member, he just has admin privileges
Don’t ping him for python help
i need mny bot to join vc
With what?
vcs
🤷♂️
What
xebruh
😂😂 what are you doing
nohing
I don't know what this coding is supposed to do py client.discord.Embed(*, colour=Embed.Empty, color=Embed.Empty, title=Embed.Empty, type='rich', url=Embed.Empty, description=Embed.Empty, timestamp=None)
Btw I use client for coding
just tell me what do i need to do that my bot joins my vc pls tell
@maiden fable
Bruh you’re not supposed to copy and paste stuff
thx
What
@commands.command(name="deletem")
@commands.has_permissions(manage_channels=True)
async def deletem(self, ctx, cnl = name):
for cnl in guild.text_channels:
if cnl.name == name:
await cnl.delete
``` w
wahts wrong?
What’s the error
i want to delete channels with same name
bruhh
unidentified name guild
Did you pass all the required arguments?
this is for one channel
i want to delte multiple channels with same name
NukeBOT
bye i am going to sleeeeep
yeah that destroyeed my server , now i want anti nuke
i want to delete 1200 channels with same name
text channels
Ok
“Fight fire with fire. Use the same bot (or your own bot) to then delete all of the channels.
It's possible, with a bot, to loop through all channels in a server and check the name of the channel. If the name of the channel matches a certain criteria, you can then delete it.
I personally like Discord4J to make bots, but since your friend already has a bot, I believe you should ask him/her to make a command to implement a new command for cleaning up those channels.
Alternatively, you can delete them all manually. That'd be a lot of clicking though, but depending on you and your friend's knowledge of bot development, that may just be simpler and less frustrating.”
I found that online
wth
Just loop through the text channels
send code
Using the startswith()
I’m not going to spoon feed you
just a little code
…ok
then i will get it
Isnt there a way to get a users input without wait_for
I remember seeing a third party lib for it once here i think
I dont know where to find it
can someone join my server to test my game? i need to see if i works for other people
for guild in bot.guilds:
for channel in guild.text_channels:
if cnl.name == name:
await cnl.delete
Make a test account
oh true
There is only wait_for()
Except for i know the person who helped the person who said the message had a cyan username
Those names are for those people who boost this server
It’s wait_for(“message”, check=check, timeout=60) but you have to make your own check function
And there are many.
Could be the person was @visual island?
Guess im going to loop through all of their messages
Nope
Either it, or Scoopy are the only ones who are most active here
no
Not icy definitely, she doesnt have cyan username
It could have been icy
It’s not
Ah shit
;-; before it had
;_;
The role keeps getting added and removed
I like nesting
I changed user
How can i put 2 views in one message?
?
@commands.command(name='delete-channel', help='delete a channel with the specified name')
async def delete_channel(ctx, channel_name):
if channel_name is not None:
while True:
existing_channel = discord.utils.get(ctx.guild.channels, name=channel_name)
await existing_channel.delete()
else:
await ctx.send(f'No channel named, "{channel_name}", was found')
error: object has no attribute guild
Ima bit busy, so I am not available
@balmy goblet wait, are you using cogs?
yes
instead of using discord.utils.get to get the channel object, just typehint channel argument with discord.TextChannel
async def delete_channel(self, ctx, channel : discord.TextChannel)
Damn i really cant find it
you need self as a first parameter for cogs
I know there was even documentation for it
can i dm u?
I just cant find it on google nor here
for what?
i need help
i used nuked command
and it created multiple text channels with same name
now i need to delet all those same name text_channels
A way to get a users input other than wait_for
Unless im going crazy made up i saw it
i want to delte 1200 text_channels with same names
i used nuke command and it created 1200 channels
first of all, ratelimits.
But i even remember seeing someone with a cyan nickname telling someone something when they replied to the person asking for help with the thing with "why would you even use that"
they all have same names
and uhmm
@commands.command(name='delete-channel', help='delete a channel with the specified name')
async def delete_channel(ctx, channel_name):
if channel_name is not None:
while True:
existing_channel = discord.utils.get(ctx.guild.channels, name=channel_name)
await existing_channel.delete()
else:
await ctx.send(f'No channel named, "{channel_name}", was found')
@balmy goblet man you'll just have to loop through all guild channels and check its name and if its equal to what you want delete it
@slate swan
#command decorator
#parameters
for channel in ctx.guild.channels:
if channel.name == "a channel name":
await channel.delete()```
This is what would be suggested if you want to use it on a few channels but for 1200, there's ratelimits
That seems like some kind of raiding?
@commands.command(name='delete-channel', help='delete a channel with the specified name')
async def delete_channel(self, ctx, channel_name):
for channel in ctx.guild.channels:
if channel.name == "a channel name":
await channel.delete()
@spring flax
no idea, anyways he shouldn't be using that for that many channels. And he used a command to make 1200 channels with the same name which is why he wants to delete them
Jeez
@balmy goblet is this your server?
yes
!d discord.utils.get || if they want a specific channel to be deleted
you own it?
discord.utils.get(iterable, **attrs)```
A helper that returns the first element in the iterable that meets all the traits passed in `attrs`. This is an alternative for [`find()`](https://discordpy.readthedocs.io/en/master/api.html#discord.utils.find "discord.utils.find").
When multiple attributes are specified, they are checked using logical AND, not logical OR. Meaning they have to meet every attribute passed in and not one of them.
To have a nested attribute search (i.e. search by `x.y`) then pass in `x__y` as the keyword argument.
If nothing is found that matches the attributes passed, then `None` is returned.
Examples
Basic usage...
Just typehint channel and it will return to a channel object.
don't do that
That's getting just one channel
read what he wants
also you dont get rate limited iterating through guilds
yes
you do when trying to delete 1200 channels
@commands.command(name='delete-channel', help='delete a channel with the specified name')
async def delchannel(self, ctx, channel:discord.TextChannel):
await channel.delete()
that's not what he wants
i want multiple channel with same name to deleted
:0
@dapper cobalt 2 channels with the same name doesn't mean its the same channel
Oh
Well then you missed context lol
Grammar matters.
Someone dm me the message if they find it or something similiar
Reading context does too
@balmy goblet how many people are in the server?
@spring flax
you dont have to keep pinging me?
You can pass parameters with the required arguments.
its my friends' server, but i have all the perms
how many members though?
why u asking that??
around 50
Not that
okay i suggest deleting this server you're talking about
Then there's no other way, yet.
hate that as well
?
without the template*
So delete the entire server..?
but that template will contain all the duplicated channels
yeah well
yeah updated message
@supple thorn You might want to wait for that. It might roll out next week. https://devsnek.notion.site/devsnek/Modal-aka-Form-Interactions-e839b3dd8c214eb08f950764a8328e36
thats not a solution
Wow how to make it
@commands.command(name='delete-channel', help='delete a channel with the specified name')
async def delete_channel(self, ctx, channel_name):
for channel in ctx.guild.channels:
if channel.name == "a channel name":
await channel.delete()
``` @spring flax
When you do a database of users to save the money and more, what is the best parameter to assign that variables in the database?
How to make eval command?
Ping to awnser
better than deleting 1200 channels and discord seeing it and deleting your bot as well as your discord account
You can have a look at this repository. https://github.com/ScopesCodez/discordpy-eval-command
A functional multi-lines eval command made in discord.py - GitHub - ScopesCodez/discordpy-eval-command: A functional multi-lines eval command made in discord.py
Uww Tnx!
the id of the user changes?
Don't check for the author's ID, instead, use the @commands.is_owner() decorator.
!d discord.ext.commands.Bot.guilds returns a list of the bot's guilds. Each guild represents a discord.Guild object.
property guilds: List[discord.guild.Guild]```
The guilds that the connected client is a member of.
!d discord.Guild
class discord.Guild```
Represents a Discord guild.
This is referred to as a “server” in the official Discord UI.
x == y Checks if two guilds are equal.
x != y Checks if two guilds are not equal.
hash(x) Returns the guild’s hash.
str(x) Returns the guild’s name.
You're the only owner of the bot, right?
Then use that decorator.
Also, do not generate invites too quickly. It'll ratelimit your bot.
Yes.
Tf did i saw then
PEOPLE WHERE THE PLACE IS FOR BRAZILIANS
@dapper cobalt what goes in @command.is_owner(here)
DAMN IT I GOT RATE LIMITS 😦
Nothing.
is_owner() missing 1 required positional argument: 'use line 255, in <module>r'
What did you see?
It's @commands. I assume you missed that 's'.
oh ok
!d discord.ext.commands.is_owner
@discord.ext.commands.is_owner()```
A [`check()`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.check "discord.ext.commands.check") that checks if the person invoking this command is the owner of the bot.
This is powered by [`Bot.is_owner()`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.Bot.is_owner "discord.ext.commands.Bot.is_owner").
This check raises a special exception, [`NotOwner`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.NotOwner "discord.ext.commands.NotOwner") that is derived from [`CheckFailure`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.CheckFailure "discord.ext.commands.CheckFailure").
@dapper cobalt btw, do you know how i can put 2 views in one message?
that is, a button and dropdown
Which library are you using?
Hello this might seem like a dumb question but I am trying to store like number in my database to have it be sorted but I can't make a for loop or a while loop or it'll send a bad request error, is there a function or something I can use to have numbers one by one in-order from like 1-10 stored?
disnake
Alright thanks for the help
Pass components=[view1, view2] in your send() function.
!d discord.ext.commands.Bot.guilds @slate swan
property guilds: List[discord.guild.Guild]```
The guilds that the connected client is a member of.
disnake.ext.commands.errors.CommandInvokeError: Command raised an exception: TypeError: send_message() got an unexpected keyword argument 'components' huh
How would you make a command like !invite 1 that you would generate a 1 invite link
!d discord.ext.commands.Bot.create_invite
!d discord.Guild.create_invite @junior verge
bruh
can you change your discord id?
no
ok
!d discord.TextChannel.create_invite
await create_invite(*, reason=None, max_age=0, max_uses=0, temporary=False, unique=True, target_type=None, target_user=None, target_application_id=None)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Creates an instant invite from a text or voice channel.
You must have the [`create_instant_invite`](https://discordpy.readthedocs.io/en/master/api.html#discord.Permissions.create_instant_invite "discord.Permissions.create_instant_invite") permission to do this.
oh okay here
what do you want it to do?
the number of guilds the bot is in?
how many servers is it in?
how do I make a discord bot which gets trigger when a user says something after using a command such as
!test
bot: make a print command of "hello world"
user:
print("hello world")
bot: you are a coder
!d discord.ext.commands.Bot.wait_for
wait_for(event, *, check=None, timeout=None)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Waits for a WebSocket event to be dispatched.
This could be used to wait for a user to reply to a message, or to react to a message, or to edit a message in a self-contained way.
The `timeout` parameter is passed onto [`asyncio.wait_for()`](https://docs.python.org/3/library/asyncio-task.html#asyncio.wait_for "(in Python v3.9)"). By default, it does not timeout. Note that this does propagate the [`asyncio.TimeoutError`](https://docs.python.org/3/library/asyncio-exceptions.html#asyncio.TimeoutError "(in Python v3.9)") for you in case of timeout and is provided for ease of use.
In case the event returns multiple arguments, a [`tuple`](https://docs.python.org/3/library/stdtypes.html#tuple "(in Python v3.9)") containing those arguments is returned instead. Please check the [documentation](https://discordpy.readthedocs.io/en/master/api.html#discord-api-events) for a list of events and their parameters.
This function returns the **first event that meets the requirements**...
!d discord.abc.GuildChannel.create_invite
await create_invite(*, reason=None, max_age=0, max_uses=0, temporary=False, unique=True, target_type=None, target_user=None, target_application_id=None)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Creates an instant invite from a text or voice channel.
You must have the [`create_instant_invite`](https://discordpy.readthedocs.io/en/master/api.html#discord.Permissions.create_instant_invite "discord.Permissions.create_instant_invite") permission to do this.
Ye I call icy it hehe

can anybody help me ?

I dont know
🤦♂️ i am dumb af
Hahaha
i am getting this error now 
discord.ext.commands.errors.NoEntryPointError: Extension 'cogs.utils.setup.setup' has no 'setup' function.
🤦♂️ ohhh......
i am used to use client instead of bot a lot
thanks!!!
Hahaha it's all cool
same error
please help someone
code:
@client.command()
async def captcha(ctx):
user = (ctx.author.id)
await ctx.send(f'Aby się zweryfikować patrz dm')
await ctx.send(f'Jeżeli wiadomość nie przychodzi zgłoś się do Dewelopera')
embed = Embed(title = 'Captcha', color=998514)
embed.description = f'aby się zweryfikować napisz co tu jest napisane'
embed.set_image(url="captchafiles/captcha1.png")
embed.set_footer(icon_url=ctx.author.avatar_url, text=f"{ctx.author.name}#{ctx.author.discriminator}")
await user.send(embed)
Error:
Ignoring exception in command captcha:
Traceback (most recent call last):
File "C:\Users\Szymon\Desktop\MauBot\venv\lib\site-packages\discord\ext\commands\core.py", line 85, in wrapped
ret = await coro(*args, **kwargs)
File "C:\Users\Szymon\Desktop\MauBot\main.py", line 97, in captcha
await user.send(embed)
AttributeError: 'int' object has no attribute 'send'
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "C:\Users\Szymon\Desktop\MauBot\venv\lib\site-packages\discord\ext\commands\bot.py", line 939, in invoke
await ctx.command.invoke(ctx)
File "C:\Users\Szymon\Desktop\MauBot\venv\lib\site-packages\discord\ext\commands\core.py", line 863, in invoke
await injected(*ctx.args, **ctx.kwargs)
File "C:\Users\Szymon\Desktop\MauBot\venv\lib\site-packages\discord\ext\commands\core.py", line 94, in wrapped
raise CommandInvokeError(exc) from exc
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: AttributeError: 'int' object has no attribute 'send'
message = await client.wait_for("message", check=check2, timeout=30) apparently I have to await the wait_for() but I already did ;_; what do I do
user is an int
convert user to str
no
user = str(ctx.author.id)
ok
What's the error
RuntimeWarning: coroutine 'wait_for' was never awaited
self._context.run(self._callback, *self._args)
RuntimeWarning: Enable tracemalloc to get the object allocation traceback
Show code
ok
I awaited it
but it still shows up with an error
U sure u don't have wait_for somewhere else?
still doesn't work
Ignoring exception in command captcha:
Traceback (most recent call last):
File "C:\Users\Szymon\Desktop\MauBot\venv\lib\site-packages\discord\ext\commands\core.py", line 85, in wrapped
ret = await coro(*args, **kwargs)
File "C:\Users\Szymon\Desktop\MauBot\main.py", line 97, in captcha
await user.send(embed)
AttributeError: 'str' object has no attribute 'send'
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "C:\Users\Szymon\Desktop\MauBot\venv\lib\site-packages\discord\ext\commands\bot.py", line 939, in invoke
await ctx.command.invoke(ctx)
File "C:\Users\Szymon\Desktop\MauBot\venv\lib\site-packages\discord\ext\commands\core.py", line 863, in invoke
await injected(*ctx.args, **ctx.kwargs)
File "C:\Users\Szymon\Desktop\MauBot\venv\lib\site-packages\discord\ext\commands\core.py", line 94, in wrapped
raise CommandInvokeError(exc) from exc
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: AttributeError: 'str' object has no attribute 'send'
damn, you're right
With traceback please
!d discord.Client.get_user
get_user(id, /)```
Returns a user with the given ID.
!d discord.User.send
await send(content=None, *, tts=None, embed=None, embeds=None, file=None, files=None, stickers=None, delete_after=None, nonce=None, allowed_mentions=None, reference=None, mention_author=None, view=None)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Sends a message to the destination with the content given.
The content must be a type that can convert to a string through `str(content)`. If the content is set to `None` (the default), then the `embed` parameter must be provided.
To upload a single file, the `file` parameter should be used with a single [`File`](https://discordpy.readthedocs.io/en/master/api.html#discord.File "discord.File") object. To upload multiple files, the `files` parameter should be used with a [`list`](https://docs.python.org/3/library/stdtypes.html#list "(in Python v3.9)") of [`File`](https://discordpy.readthedocs.io/en/master/api.html#discord.File "discord.File") objects. **Specifying both parameters will lead to an exception**.
To upload a single embed, the `embed` parameter should be used with a single [`Embed`](https://discordpy.readthedocs.io/en/master/api.html#discord.Embed "discord.Embed") object. To upload multiple embeds, the `embeds` parameter should be used with a [`list`](https://docs.python.org/3/library/stdtypes.html#list "(in Python v3.9)") of [`Embed`](https://discordpy.readthedocs.io/en/master/api.html#discord.Embed "discord.Embed") objects. **Specifying both parameters will lead to an exception**.
ok
discord.ext.commands.errors.NoEntryPointError: Extension 'cogs.utils.setup.setup' has no 'setup' function.
Ah this error
Ah the function name should be setup and nothing else
i have a command with the same name, wouldnt there be a conflict ?
full code
https://pastebin.com/EJrnApfa
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
It's inside the class and ain't accessible outside the class scope
oh ok, i will try again
what's the error
wait
Ignoring exception in command captcha:
Traceback (most recent call last):
File "C:\Users\Szymon\Desktop\MauBot\venv\lib\site-packages\discord\ext\commands\core.py", line 85, in wrapped
ret = await coro(*args, **kwargs)
File "C:\Users\Szymon\Desktop\MauBot\main.py", line 89, in captcha
user = get_user(id)
NameError: name 'get_user' is not defined
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "C:\Users\Szymon\Desktop\MauBot\venv\lib\site-packages\discord\ext\commands\bot.py", line 939, in invoke
await ctx.command.invoke(ctx)
File "C:\Users\Szymon\Desktop\MauBot\venv\lib\site-packages\discord\ext\commands\core.py", line 863, in invoke
await injected(*ctx.args, **ctx.kwargs)
File "C:\Users\Szymon\Desktop\MauBot\venv\lib\site-packages\discord\ext\commands\core.py", line 94, in wrapped
raise CommandInvokeError(exc) from exc
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: NameError: name 'get_user' is not defined
changed code:
@client.command()
async def captcha(ctx):
user = get_user(id)
await ctx.send(f'Aby się zweryfikować patrz dm')
await ctx.send(f'Jeżeli wiadomość nie przychodzi zgłoś się do Dewelopera')
embed = Embed(title = 'Captcha', color=998514)
embed.description = f'aby się zweryfikować napisz co tu jest napisane'
embed.set_image(url="captchafiles/captcha1.png")
embed.set_footer(icon_url=ctx.author.avatar_url, text=f"{ctx.author.name}#{ctx.author.discriminator}")
await user.send(embed)
getting this error and python stopped working
discord.ext.commands.errors.ExtensionFailed: Extension 'cogs.utils.setup.setup' raised an error:
the new updated code https://paste.pythondiscord.com/sewavomosi.py
@velvet tinsel
What's the error
ohh what i was getting RecursionError: maximum recursion depth exceeded
Ah can u tell the traceback?
you did get_user()
what is get_user()
client.get_user()?
.
That error comes when u r calling the function inside the function, like
def main():
while True:
main()
A bad example but u get the idea
ohhh wait i get my mistake
you did that?
yes
it working now thanks @maiden fable
(:
@velvet tinsel
ok]
you didnt
you only did get_user()
you have to do client.get_user()
@client.command()
async def captcha(ctx):
user = client.get_user(id)
await ctx.send(f'Aby się zweryfikować patrz dm')
await ctx.send(f'Jeżeli wiadomość nie przychodzi zgłoś się do Dewelopera')
embed = Embed(title = 'Captcha', color=998514)
embed.description = f'aby się zweryfikować napisz co tu jest napisane'
embed.set_image(url="captchafiles/captcha1.png")
embed.set_footer(icon_url=ctx.author.avatar_url, text=f"{ctx.author.name}#{ctx.author.discriminator}")
await user.send(embed)
Ignoring exception in command captcha:
Traceback (most recent call last):
File "C:\Users\Szymon\Desktop\MauBot\venv\lib\site-packages\discord\ext\commands\core.py", line 85, in wrapped
ret = await coro(*args, **kwargs)
File "C:\Users\Szymon\Desktop\MauBot\main.py", line 97, in captcha
await user.send(embed)
AttributeError: 'str' object has no attribute 'send'
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "C:\Users\Szymon\Desktop\MauBot\venv\lib\site-packages\discord\ext\commands\bot.py", line 939, in invoke
await ctx.command.invoke(ctx)
File "C:\Users\Szymon\Desktop\MauBot\venv\lib\site-packages\discord\ext\commands\core.py", line 863, in invoke
await injected(*ctx.args, **ctx.kwargs)
File "C:\Users\Szymon\Desktop\MauBot\venv\lib\site-packages\discord\ext\commands\core.py", line 94, in wrapped
raise CommandInvokeError(exc) from exc
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: AttributeError: 'str' object has no attribute 'send'
wtf is id
you have to do ctx.author.id
or do id = ctx.author.id
oh ok
Won't work
Why not do await ctx.author.send tho 😐
@client.command()
async def captcha(ctx):
id = (ctx.author.id)
user = client.get_user(id)
await ctx.send(f'Aby się zweryfikować patrz dm')
await ctx.send(f'Jeżeli wiadomość nie przychodzi zgłoś się do Dewelopera')
embed = Embed(title = 'Captcha', color=998514)
embed.description = f'aby się zweryfikować napisz co tu jest napisane'
embed.set_image(url="captchafiles/captcha1.png")
embed.set_footer(icon_url=ctx.author.avatar_url, text=f"{ctx.author.name}#{ctx.author.discriminator}")
await user.send(embed)
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
pls help someone
any ... errors?
yes
Ignoring exception in command captcha:
Traceback (most recent call last):
File "C:\Users\Szymon\Desktop\MauBot\venv\lib\site-packages\discord\ext\commands\core.py", line 85, in wrapped
ret = await coro(*args, **kwargs)
File "C:\Users\Szymon\Desktop\MauBot\main.py", line 98, in captcha
await user.send(embed)
AttributeError: 'NoneType' object has no attribute 'send'
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "C:\Users\Szymon\Desktop\MauBot\venv\lib\site-packages\discord\ext\commands\bot.py", line 939, in invoke
await ctx.command.invoke(ctx)
File "C:\Users\Szymon\Desktop\MauBot\venv\lib\site-packages\discord\ext\commands\core.py", line 863, in invoke
await injected(*ctx.args, **ctx.kwargs)
File "C:\Users\Szymon\Desktop\MauBot\venv\lib\site-packages\discord\ext\commands\core.py", line 94, in wrapped
raise CommandInvokeError(exc) from exc
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: AttributeError: 'NoneType' object has no attribute 'send'
I am not sure if this is supposed to be here.
Anyways. So I wanna run my bot with pm2 and I dont know how I can?
This is the command I wanna use with pm2: pipenv run bot
Any help is appreciated!
https://paste.pythondiscord.com/ecelorimoh.py
the bot isnt sending anything to the channel that is been setuped, no error
you passed a tuple to the client.get_user(id). But also, you can just do await ctx.author.send(...) and remove the ```py
id = (ctx.author.id)
user = client.get_user(id)
how do I mention a user id in the output?
!d discord.User.mention
property mention: str```
Returns a string that allows you to mention the given user.
the function is on_message and it seems I cannot use ctx
are you sure that result is not None?
yes, i have checked the using the db browser
!d discord.on_message | on_message takes discord.Message. If you want the user, you do author = message.author
discord.on_message(message)```
Called when a [`Message`](https://discordpy.readthedocs.io/en/master/api.html#discord.Message "discord.Message") is created and sent.
This requires [`Intents.messages`](https://discordpy.readthedocs.io/en/master/api.html#discord.Intents.messages "discord.Intents.messages") to be enabled.
Warning
Your bot’s own messages and private messages are sent through this event. This can lead cases of ‘recursion’ depending on how your bot was programmed. If you want the bot to not reply to itself, consider checking the user IDs. Note that [`Bot`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.Bot "discord.ext.commands.Bot") does not have this problem.
to debug, try print(result)
ok
Why it resets back to 1?
Its a tuple
the channel id isnt being registered in the db
Thanks to discord.py, sending local files as embed images is simple. You have to create an instance of discord.File class:
# When you know the file exact path, you can pass it.
file = discord.File("/this/is/path/to/my/file.png", filename="file.png")
# When you have the file-like object, then you can pass this instead path.
with open("/this/is/path/to/my/file.png", "rb") as f:
file = discord.File(f)
When using the file-like object, you have to open it in rb mode. Also, in this case, passing filename to it is not necessary.
Please note that filename can't contain underscores. This is a Discord limitation.
discord.Embed instances have a set_image method which can be used to set an attachment as an image:
embed = discord.Embed()
# Set other fields
embed.set_image(url="attachment://file.png") # Filename here must be exactly same as attachment filename.
After this, you can send an embed with an attachment to Discord:
await channel.send(file=file, embed=embed)
This example uses discord.TextChannel for sending, but any instance of discord.abc.Messageable can be used for sending.
ok but how to select other folder
help
what to do if on_message ate all the commands?
@manic wing
There seems to be a weird error in #help-lemon
I cant seem to be able to solve it
its closed
Damn
how do i check if the bot has been reply pinged?
i want it to respond to only @ mentions not the replies
why this doesn't work?
Code:
@client.command()
async def captcha(ctx):
await ctx.send(f'Aby się zweryfikować patrz dm')
await ctx.send(f'Jeżeli wiadomość nie przychodzi zgłoś się do Dewelopera')
embed = Embed(title = 'Captcha', color=998514)
file = File("/captchafiles/captcha1.png", filename="captcha1.png")
embed.description = f'aby się zweryfikować napisz co tu jest napisane'
embed.set_image(url = "attachment://captcha1.png")
embed.set_footer(icon_url=ctx.author.avatar_url, text=f"{ctx.author.name}#{ctx.author.discriminator}")
await ctx.author.send(embed=embed, file=file)
what is the error?
use on_message event and then use: if bot.user.mentioned_in(message): do stuff here
im doing that already. the problem is that it responds to reply pings as well
i dont think theres a way that you can avoid reply pings
`
Ignoring exception in command captcha:
Traceback (most recent call last):
File "C:\Users\Szymon\Desktop\MauBot\venv\lib\site-packages\discord\ext\commands\core.py", line 85, in wrapped
ret = await coro(*args, **kwargs)
File "C:\Users\Szymon\Desktop\MauBot\main.py", line 92, in captcha
file = File("/captchafiles/captcha1.png", filename="captcha1.png")
NameError: name 'File' is not defined
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "C:\Users\Szymon\Desktop\MauBot\venv\lib\site-packages\discord\ext\commands\bot.py", line 939, in invoke
await ctx.command.invoke(ctx)
File "C:\Users\Szymon\Desktop\MauBot\venv\lib\site-packages\discord\ext\commands\core.py", line 863, in invoke
await injected(*ctx.args, **ctx.kwargs)
File "C:\Users\Szymon\Desktop\MauBot\venv\lib\site-packages\discord\ext\commands\core.py", line 94, in wrapped
raise CommandInvokeError(exc) from exc
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: NameError: name 'File' is not defined
you arent importing i think
Wtf is file
😂
What are you trying to do
maybe you meant discord.File
@pliant gulch what was the original lefi readme.md? it used asyncio.create_loop or smthin
i need that, cus im tryna host a fastapi alongside the bot
asyncio.create_task?
uh
uh
whats the difference because client.start & client.run
there is a way but its on discord.py docs
when i use it this error prints
Ignoring exception in command captcha:
Traceback (most recent call last):
File "C:\Users\Szymon\Desktop\MauBot\venv\lib\site-packages\discord\ext\commands\core.py", line 85, in wrapped
ret = await coro(*args, **kwargs)
File "C:\Users\Szymon\Desktop\MauBot\main.py", line 92, in captcha
file = discord.File("/captchafiles/captcha1.png", filename="captcha1.png")
NameError: name 'discord' is not defined
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "C:\Users\Szymon\Desktop\MauBot\venv\lib\site-packages\discord\ext\commands\bot.py", line 939, in invoke
await ctx.command.invoke(ctx)
File "C:\Users\Szymon\Desktop\MauBot\venv\lib\site-packages\discord\ext\commands\core.py", line 863, in invoke
await injected(*ctx.args, **ctx.kwargs)
File "C:\Users\Szymon\Desktop\MauBot\venv\lib\site-packages\discord\ext\commands\core.py", line 94, in wrapped
raise CommandInvokeError(exc) from exc
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: NameError: name 'discord' is not defined
nvm, I dont think there is, there is only for the guild banner
try importing discord 
!d discord.Member.avatar.url
why it show 'Context' object has no attribute 'user'
!d discord.Member.banner
property banner```
Equivalent to [`User.banner`](https://discordpy.readthedocs.io/en/master/api.html#discord.User.banner "discord.User.banner")
but how
do you mean ctx.author?
idk it cant show the full error
wait i tried smtg
import discord
you did ctx.user.avatar_url
its ctx.author
what “other”?
like other people that user mentioned
like ?whois @brave flint
then member: discord.Member
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
can someone tell me why this didnt work
this is the error code
Ignoring exception in view <view timeout=180.0 children=1> for item <Button style=<ButtonStyle.secondary: 2> url=None disabled=False label='🎁 Claim' emoji=None row=None>:
Traceback (most recent call last):
File "C:\Users\USER\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\discord\ui\view.py", line 359, in _scheduled_task
await item.callback(interaction)
File "c:\Users\USER\Desktop\coding shit\projecttester.py", line 16, in counter
label = int(button.label)
ValueError: invalid literal for int() with base 10: '🎁 Claim'
the label is “Claim”
youve tried to int it
You can't convert that to int
oh
U did int("🎁 Claim")
You can't
await inter.response.send()
alr ty
send_message*
and how do i make the bot mention the person who pressed it?
Why does count reset to 1?
Caeden being good
pressed what
the button
what lib are you using
I think it’s something to do with ctx.author, I remember reading something about it 
But I forgor
!d discord.Interaction.user
The user or member that sent the interaction.
can someone help me
has a .mention attribute
!file-images
import discord
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
i imported discord but it still doesn't work
use from discord import Embed, File
and delete the discord. from discord.File
also delete the import discord, you bcs you literally imported discord twice
Ok I will pip uninstall life
LMAO
I FUCKING FOUND IT
2 hours of scrolling through tens of thousands of messages
what is it
!d discord.Member.banner.url
No documentation found for the requested symbol.
i use 1.7 so idk
@slate swan you use 2.0?
-_-
when tf that came out
lol
Find it
idk any other way to do it other than waiting for the on_message event
latest is v2.0 yes.
do what?
@slate swan have you tried member.banner.url?
banner is a property is wont check for its return value and then its attribute
!d discord.Asset.url
property url: str```
Returns the underlying URL of the asset.
should work
i couldnt, what is it
No documentation found for the requested symbol.
okay i wasn't asking if the docs on it were available, i asked have you tried it in the code
Member.banner returns discord.Asset which does have an attribute named url. the reason this bot couldn't show it is because, it basically scraps RTD
it will not check for return type of an attribute (banner) and then fetch the details of that object
is there a way like making a discord bot run a py file with command
example:
someonetype : /start
discord bot : "start another python file"
Slash commands?
why cant the file be a function instead
🤷♂️
if you really want to do that, one easy way would be to just import the py file
inside the command
is there a way like making a discord bot run a py file with command :
Ok
@bot.event
async def on_ready():
guild = bot.get_guild(id)
for member in guild.members:
print(member.name)
can someone help me fix this code? it just prints the bot's name
i dont know how to do a discord bot
What's that
Then find some resources online
what you're asking is basic knowledge of python
Didn’t you ask that already…?
yes and I haven't fixed it yet
oh yeah im wondering whats that thing too
Just print member ig
either that kid is lying or my entire life

intents = discord.Intents.all()
bot = Bot(command_prefix="", intents=intents)
@bot.event
async def on_ready():
guild = bot.get_guild(id)
for member in guild.members:
print(member)
I already have...
!intent
how do i anwser a User message so the user is pinged?
this is the full code I already have
!d discord.User.mention
property mention: str```
Returns a string that allows you to mention the given user.
user.mention
ok
but .all enables all of them no?
it does
Nope
have you enabled them in the portal?
I've got a question, I need to get a list from all members from all servers where the bot is online(I'm using discord.py rewrite), Right now I have this code-snipped:
@bot.command()
async def membe...
I mean this guy set it to default
then what is it
Goddamnit have you enabled it in dev portal? Myxi said
where do i define this?
ok
I run it on my acc
Dev portal
okay selfbotting

doesnt work
Idk, what are you trying to do
so there is not dev portal..
Have you installed it?
pip install discord-py-slash-command
Pip install
yes
make the bot replie to the message so the user gets pinged
There is 😂😂
but its showing me error
https://discord.com/developers/applications here's the dev portal.
Integrate your service with Discord — whether it's a bot or a game or whatever your wildest imagination can come up with.
you're asking in the wrong place, breaking TOS of discord is against the rules of this server and should lead to ban
Oh ok
my bad I didn't know it's against tos
pip ins:1478kekwfbi:
It obviously is against the rules
y obviously? it's like a bot, but if it is I'll just stop
you should ask in dpy support as thats mayas lib
No
what about that?
Having a self bot you can spam everyone
await ctx.reply(kwargs same as send)
cant import discord_slash
you just asked this, you got about 3 answers?
VS code?
visual studio code
You probably have the wrong name
did you run pip install <package>? if yes, restart vsc
I didn’t use vsc for about 3 months
ok
fixed
wdym by broken?
am nob
Well I have millions of updates to perform
good!, restart vsc when ever you install new package
And I screwed up my run button
discord gave you actual bot user accounts to automate your stuff, if you cant use that for your work and still use your own account it is against the TOS
I installed and uninstalled run code
👌
so.. I have bunch of regexes to prevent antispam (I took these from @unkempt canyon if anyone wonders) but I need to somehow use them as well. How could I implement invite filter? ```py
import re
INVITE_RE = re.compile(
r"(discord([.,]|dot)gg|" # Could be discord.gg/
r"discord([.,]|dot)com(/|slash)invite|" # or discord.com/invite/
r"discordapp([.,]|dot)com(/|slash)invite|" # or discordapp.com/invite/
r"discord([.,]|dot)me|" # or discord.me
r"discord([.,]|dot)li|" # or discord.li
r"discord([.,]|dot)io|" # or discord.io.
r"((?<!\w)([.,]|dot))gg" # or .gg/
r")([/]|slash)" # / or 'slash'
r"(?P<invite>[a-zA-Z0-9-]+)", # the invite code itself
flags=re.IGNORECASE
)
…..
Antispam as in stop people from spamming or spamming invites
ye I know?
yeah ok so add an on_message event
yep that exists
ok so what are you asking
you seem like you know what to do
if your asking about basic help on regexes then this isnt the place i would assume
oh ye, you are right 😅 I probably ask some where else as it is not actually related to dpy. Sorry
if you took that from the source why not see how it works there too
that's the code, this bot is made of, if it works there, it is working
maybe you're confused on how it works
anyway this is not the right place to ask about using regex or
I know, I'm trying to find the answer in dev-contrib but the variables seems to be pydis site variables
Guys I had a bot like NQN. NQN and my bot both check if a webhook exist when the command is executed, if not exist, then create one for the channel. But the problem is my bot gets rate limited but nqn bot which is in more servers does not get rate limited. Any idea why??
Where r u hosting your bot
Larger verified bots don’t get ratelimited as hard. Also sharding
not the case but they have to send an extra request to discord support for increasing their ratelimits
Is there any way to convert list strings to int?
Example:
list = [liststring1, liststring2, liststring3]
and it would print to 1, 2, 3
await ctx.send("`What do you want to do?`\n`1. Play games`\n`2.google`\n`3.send an enail`\n`4. exit`")
def check2(msg):
return msg.author == ctx.author and msg.channel == ctx.channel
def check(msg):
return msg.author == ctx.author and msg.channel == ctx.channel and \
msg.content.lower() in ["1", "2", "3", "4"]
try:
msg = await client.wait_for("message", check=check, timeout=30)
if msg.content == "1":
from random import randint as r
number = r(1, 100)
message = await client.wait_for("message", check=check2, timeout=30)
apparently, it responds with nothing.
it's not related to discord bots, and just type in 1, 2, 3
What if instead of liststring it would be user's id
then just put the ids in
but it will display the id not the number "1"
repl
oh
I mean you asked for ID
how i can run a py file with discord
like
if i type :/start
a python file will run
i already answered your question while ago
ye it didnt work
I dont really know the reason
oh the indents look ugly
how to import it
how to create a channel at the most bottom of the server
suppose the filename is main.py,
you import it by doing,
import main
ohh ok
the file must be in the script directory
async def avatar(ctx , member : discord.Member = None):
if member == None:
member = ctx.author
memberAvatar = member.avatar_url
avaEmbed = discord.Embed(title = f"{member.name}'s avatar")
avaEmbed.set_image(url = memberAvatar)
await ctx.send(membed = avaEmbed) ```
why is it not working plz?
error ?
no need
member.avatar.url
nope
yes
await ctx.send(membed = avaEmbed)
they did membed when they should have done embed
yeah
pls 😭
the indents look awful I know
I did a lot of nesting
File "C:\Users\bluet\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\ext\commands\core.py", line 85, in wrapped
ret = await coro(*args, **kwargs)
File "c:\Users\bluet\Documents\python\ozone_bot.py", line 43, in avatar
await ctx.send(membed = avaEmbed)
TypeError: Messageable.send() got an unexpected keyword argument 'membed'
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "C:\Users\bluet\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\ext\commands\bot.py", line 939, in invoke
await ctx.command.invoke(ctx)
File "C:\Users\bluet\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\ext\commands\core.py", line 863, in invoke
await injected(*ctx.args, **ctx.kwargs)
File "C:\Users\bluet\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\ext\commands\core.py", line 94, in wrapped
raise CommandInvokeError(exc) from exc
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: TypeError: Messageable.send() got an unexpected keyword argument 'membed' ```
inappropriate username
embed*
1.7.3 is broken
how can i make my bot join vc LL
you did membed as well
I thought I answered you 3 hours ago
LOL
thx
but can u tell again
await ctx.send("`What do you want to do?`\n`1. Play games`\n`2.google`\n`3.send an enail`\n`4. exit`")
def check2(msg):
return msg.author == ctx.author and msg.channel == ctx.channel
def check(msg):
return msg.author == ctx.author and msg.channel == ctx.channel and \
msg.content.lower() in ["1", "2", "3", "4"]
try:
msg = await client.wait_for("message", check=check, timeout=30)
if msg.content == "1":
from random import randint as r
number = r(1, 100)
message = await client.wait_for("message", check=check2, timeout=30)
Goddamnit Myxi here you go
alright
wat
online resources are good
u didn't answer me
but i cant find how to do it in google or youtube
that's the entire code?
Google > websites or Google > YouTube
Do you want me to send the full code? It's huge.
full code of the command
I CANT FIND IN YT
...Stack OverFlow?
how to create a channel at the most bottom of the server?
using discord py?
yeah ofc
uh well creating a channel in the bottommost category would work
i dont want it to be in a category
Do you have categories in your discord server?
https://stackoverflow.com/questions/68773004/how-can-i-create-channel-just-below-a-specific-channel-discord-py
I don't know, best I could find
add else and see if the conditionals are working or not
ty
i mean in your code
