#discord-bots
1 messages · Page 897 of 1
oh ok, I just did a try and except
Big regexes are written by people a lot smarter than I who know what they're doing
should I keep the try or do the else?
We call this LBYL vs EAFP
what
Look before you leap, LBYL, if/else before doing something
Easier to ask for forgiveness than permission, EAFP, try/except, do something, if something happens, oops, do something else
In this case it doesn't matter all that much
But it's something to think about other times you run into a similar issue
What you have right now is EAFP, assume the message has a link, and find the group. If an error happens (message doesn't have a link) then catch the error. Other approach would be first match a string, then check if you have any matches. if you do, then find what the match actually was. If you don't, then do something else
!e
async def nitro(self,ctx) :
embed=discord.Embed(title='You have been gifted a subscription',description="You have been gifted **Discord Nitro** for **3 months**\nExpires in **24 hours**\nClaim before Expiration\n**[Disclaimer](https://www.google.com/UniqueCord&DiscordBot=UniqueCord)**",color=Colour.dark_red())
embed.set_image(url="https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcRfkUVViOwesXss5S9jGpNWNAKpkAt7FkyEfcnOTE5ZK5vSdYonJMGLUIz7QCnUor2VSaM&usqp=CAU")
s=str(ctx.author)
k=s[:(len(s)-5)]
embed.timestamp = datetime.datetime.utcnow()
embed.set_author(name=f"Congratulations! {k}",icon_url=ctx.author.avatar.url)
embed.set_thumbnail(url="https://repository-images.githubusercontent.com/336227331/08ca6fc4-80b3-482e-ba9d-0e13b1fc3288")
embed.set_footer(text=f'\u200bRequested by {k}',icon_url=ctx.author.avatar.url)
await ctx.reply(embed=embed,view=self.nitr(ctx),mention_author=False)```
@lofty dagger :x: Your eval job has completed with return code 1.
001 | Traceback (most recent call last):
002 | File "<string>", line 1, in <module>
003 | NameError: name 'commands' is not defined
What are you trying to do with that code?
ctx.send(...) returns the message the bot sent
nah easier solution
await ctx.send(..., delete_after=10)
would delete after 10 seconds
Can save a bit of space and lines that way
- keep it readable so I don't see why you wouldn't
SelfBot 👁️ 👁️
🤔
Confused as to why the bot uses input, kind of sus
And it doesn't work with discord.py anyways
It still doesn't work for discord.py in commands
Or at least it would freeze your bot
🤔
An exe bot?
Python probably isn't the best language if you want to compile your bot to an executable
As in the code runs when you open the .exe?
I'm confused
Just pyinstaller it 🤷♂️
Are you using pyinstaller?
Making an EXE bot that uses input everytime you run it in order to setup is pretty suspect imo, only useful for selfbots, your message before you edited your message it also mentions SelfBot directly
Regular bot's would've used a config file
Ehhhh pyinstaller
Who said that
The dude who told you make the exe file
nah just curious
Sounds pretty weird someone would ask you to do that
Your old message shows the same inputs you were using before, you're still talking about the same code 🤔
Especially with an interpreted language
no escaping when you got andy and robin interrogating you

Robin is good cop and andy is bad cop
I cba to look through your old messages, but just saying, sus as hell when you have input and something to do with bans, also suspect even more when you edited your message after being told it had SelfBot ¯_(ツ)_/¯
should probably write it in rust or C/C++ and compile it to exe that way but alr
don't use that word as an insult please
you do you ¯_(ツ)_/¯
Pyinstaller does its job alright i guess
You'll probably want to run input() before you run bot.run()
doing it anywhere else would probably block your code
hmm I guess that works
As long as it's not in any commands or anything
Missing a closing )
And a colon ^
that too
OH LOL
you did?
!d discord.Message.add_reaction
await add_reaction(emoji, /)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Add a reaction to the message.
The emoji may be a unicode emoji or a custom guild [`Emoji`](https://discordpy.readthedocs.io/en/master/api.html#discord.Emoji "discord.Emoji").
You must have the [`read_message_history`](https://discordpy.readthedocs.io/en/master/api.html#discord.Permissions.read_message_history "discord.Permissions.read_message_history") permission to use this. If nobody else has reacted to the message using this emoji, the [`add_reactions`](https://discordpy.readthedocs.io/en/master/api.html#discord.Permissions.add_reactions "discord.Permissions.add_reactions") permission is required.
Changed in version 2.0: `emoji` parameter is now positional-only.
Changed in version 2.0: This function no-longer raises `InvalidArgument` instead raising [`TypeError`](https://docs.python.org/3/library/exceptions.html#TypeError "(in Python v3.10)").
m = await ctx.send(...)
await m.add_reaction(...)
!d add_reaction
No documentation found for the requested symbol.
bruh what
wake up wake up r danny bot is better than you
bro atleast search the docs
!d docs
!d discord.ext.commands.Context.send
await send(content=None, *, tts=False, embed=None, embeds=None, file=None, files=None, stickers=None, delete_after=None, nonce=None, allowed_mentions=None, reference=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.10)") 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.10)") of [`Embed`](https://discordpy.readthedocs.io/en/master/api.html#discord.Embed "discord.Embed") objects. **Specifying both parameters will lead to an exception**.
!d discord.Message.add_reaction
await add_reaction(emoji, /)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Add a reaction to the message.
The emoji may be a unicode emoji or a custom guild [`Emoji`](https://discordpy.readthedocs.io/en/master/api.html#discord.Emoji "discord.Emoji").
You must have the [`read_message_history`](https://discordpy.readthedocs.io/en/master/api.html#discord.Permissions.read_message_history "discord.Permissions.read_message_history") permission to use this. If nobody else has reacted to the message using this emoji, the [`add_reactions`](https://discordpy.readthedocs.io/en/master/api.html#discord.Permissions.add_reactions "discord.Permissions.add_reactions") permission is required.
Changed in version 2.0: `emoji` parameter is now positional-only.
Changed in version 2.0: This function no-longer raises `InvalidArgument` instead raising [`TypeError`](https://docs.python.org/3/library/exceptions.html#TypeError "(in Python v3.10)").
this bot has 40 packages lmao
fair enough
await (await ctx.send(...)).add_reaction(...)
you can use unicode lol
\✅
\❌
just copy paste them
\emoji to make them unicode
well it wasnt closed?
but why
It needs to be in a string
You know there are docs for more than just discord.py?
await m.add_reaction('✅')
works out
You need to provide the full path
!d discord.Message.add_reaction
await add_reaction(emoji, /)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Add a reaction to the message.
The emoji may be a unicode emoji or a custom guild [`Emoji`](https://discordpy.readthedocs.io/en/master/api.html#discord.Emoji "discord.Emoji").
You must have the [`read_message_history`](https://discordpy.readthedocs.io/en/master/api.html#discord.Permissions.read_message_history "discord.Permissions.read_message_history") permission to use this. If nobody else has reacted to the message using this emoji, the [`add_reactions`](https://discordpy.readthedocs.io/en/master/api.html#discord.Permissions.add_reactions "discord.Permissions.add_reactions") permission is required.
Changed in version 2.0: `emoji` parameter is now positional-only.
Changed in version 2.0: This function no-longer raises `InvalidArgument` instead raising [`TypeError`](https://docs.python.org/3/library/exceptions.html#TypeError "(in Python v3.10)").
anyone know how to make a list of people in a role command like -members Admin i cant find anyone neither a video of how to do it
I use a large spreadsheet for work, and I would like to learn how to code with python. So why not learn and make my life easier at the same time.
The only issue I have is I have no idea what is even possible in my case. The excel file I use is retail pricing on a category of goods, it has multiple spreadsheets, each spreadsheet is a different region, and each region has 5-7 stores, and each store has 8-25 items, and I use this to track pricing.
I would like to automate the editing that is done and a tool to automate creating a separate spreadsheet to compare similar products.
VBA, Vlookup, & Power query are maybe possible, but I have yet to find a way. Mostly because of inconsistent rows and columns & the amount of data that is pinned to a product.
Any advice is helpful!
what
this is the discord bots channel
what is the raw unicode for ✅
\✅
ok
Sorry dude, This seem to be the only place with active people. just need some help
Hmm
did it work?
I am trying
mhm
code and error?
It works just doesn't say anything
@client.command()
@commands.has_role(950040612625842186)
async def add_money(ctx, user: discord.Member, amount=None):
if amount == None:
await ctx.reply("**__INVALID AMOUNT__**, Please use `ayo add_money [user] [amount]`")
return
else:
users = await get_bank_data()
users[str(user.id)]["wallet"] += amount
with open("mainbank.json",'w') as f:
json.dump(users,f)
await ctx.reply(f"Successfully added {amount} to {user.name}'s wallet")```
No errors.
Hmmm
argument naming and use is and no need for the return if theres no more code and why json as a db?
Let me use the good o'l print trick
amount is probably an str, you need to convert it to an int or just typehint it
Idk how to use DB
pretty easy i.e sqlite
Okay wait
Help me maybe?
sure
Ok DM me, Btw It is still 9Am, I shouldn't be working at the time so let me eat something and Ill message you
sqlite 
- learn sql first https://sqlbolt.com/lesson/
- use aiosqlite
- if you want to check data just use the data browser
btw i dont do dm help...
SQLBolt provides a set of interactive lessons and exercises to help you learn SQL
!pypi aiosqlite
Oh Fu-
Ok fine
if you need anything else ping me
Return is there cause of Github Co-Pilot
did the command work though?
Literally He wrote the whole code
Well- It was earlier
huh
Got a problem now-
ah lol
smh
and ash what is this? nice argument naming
Lol
Wait, SHI TSU
int: float is what youre doing
A DOGGO-
I just helped them with their problem, I dont like co fusing people unnecessarily like you and gazes
Lmao
lol youre confusing allot
She did not
Idk if its a she or he tbh
a db is what you need lol
This problem made me work at 9 am
Well, Okay I guess
By the way can you help me with Heroku, I asked so many people for help but they don't help
1 guy decided to help me but he stole my code
dont use heroku lol
What do I use then?
i ment i dont use heroku but i ment that as well wtf
for discord bot hosting*
im speaking with my brain only
Can you help doggo
what is he using it for then?
1 question does aiosqlite have the same syntax as sqlite
my point is not to use it if youre gonna host a bot
Discord bot hosting duh
shut up
yes for the queries its all sql but on methods theyre all mostly coros
Then what do I use
AFK
a vps lol
Is aiosqlite a built in library
no
pip install aiosqlite
what, heroku is good for web apps
and you said
Dont use heroku
dont use heroku in his case.
She meant smth else, Stop fighting
What do I use then?!
yes that
No need to expose ;-;
I alr know you're a girl

how do u know
Are u pfpist
Kinda of sort of
lmao
Her behaviour got me
what about my behaviour
I dont see a behaviour
!rule 7 okimii is an uwu girl, now move to another channel
7. Keep discussions relevant to the channel topic. Each channel's description tells you the topic.
Literally that told me you are a girl
Ok lets talk coding
What's going on here
Nothing we got distracted
guys error
if interaction.user != self.ctx.author:
AttributeError: 'helpView' object has no attribute 'ctx'
``` and this code
```py
class helpView(View):
@nextcord.ui.button(label="Page 1", style=nextcord.ButtonStyle.blurple)
async def page1(self, button, interaction):
await interaction.response.edit_message(embed=hembed)
@nextcord.ui.button(label="Page 2", style=nextcord.ButtonStyle.blurple)
async def page2(self, button, interaction):
await interaction.response.edit_message(embed=hembed2)
@nextcord.ui.button(label="Page 3", style=nextcord.ButtonStyle.blurple)
async def page3(self, button, interaction):
await interaction.response.edit_message(embed=hembed3)
@nextcord.ui.button(label="Page 4", style=nextcord.ButtonStyle.blurple)
async def page4(self, button, interaction):
await interaction.response.edit_message(embed=hembed4)
async def interaction_check(self, interaction) -> bool:
if interaction.user != self.ctx.author:
await interaction.response.send_message("bro, as the Green Goblin says, To each his own. If you want to have a look, type ?help!", ephemeral= True)
return False
else:
return True
oh nothing
someone help
youll need to pass the author to the class and have a instance variable then you can use that
View classes arent automatically given ctx, so you need to write a custom constructor that accepts ctx as an argument
^
how?
await ctx.send("lol", view=ClassName(ctx)) you just pass it in the initiate
ohok
missing parenthesis
🗿
For the money transfer command
or am i
Like it doesn't update the baks
yes you would need to change the methods
nice edit kid
mad?
that was not funny...
Its a she ;-;
/?
Eh ok
oh ye
Ok new method
Oh wait
I am so stupid
I am transferring the money to someone who doesn't have an account

where to be exact?
wdym?
like in the command or in the class
on the command where youre sending the view
Erm can you open an account by joining the server tempreroly
Cause server ded xd
sure dm
await ctx.send(embed=hembed, view=view(ctx))
TypeError: 'helpView' object is not callable
``` @slate swan
?????
whats init?
I'd suggest you first learn basic OOP, would be helpful in making a discord bot
youre supposed to call the class lol
would this work?
def _init_(self, ctx):
super().__init__(timeout=10)
i did
this my code
@bot.command(aliases=["HELP","Help"])
async def help(ctx):
view = helpView()
await ctx.send(embed=hembed, view=view(ctx))
needs to be double underscores and you want to store that ctx
oh ok
TypeError: init() missing 1 required positional argument: 'ctx
as for your command you're essentially writing helpView()(ctx) which doesn't make sense
TypeError: __init__() missing 1 required positional argument: 'ctx
the first pair of parentheses should take ctx, and the second pair shouldn't exist
since helpView is the class yes
oh ok
error
if interaction.user != self.ctx.author:
AttributeError: 'helpView' object has no attribute 'ctx'
@hushed galleon
you want to store that ctx
?
that means assigning it to self as an attribute
self.ctx = ctx
this is all OOP stuff
like should i put this variable into the class or outside
well if you put it outside, then you'd have no idea who the context is for when two people use the help command
id suggest corey schafer's playlist on object oriented programming and a bit of practice so its easier to understand
https://www.youtube.com/playlist?list=PL-osiE80TeTsqhIuOqKhwlXsIBIdSeYtc
this link is part of the python discord !resources too
hmmm ok
!resources
The Resources page on our website contains a list of hand-selected learning resources that we regularly recommend to both beginners and experts.
Hey everybody. When will slash commands be forced onto python bots?
embed.add_field(name="Server owner",value=f"**{guild.owner.name}**",inline=True)
AttributeError: 'NoneType' object has no attribute 'name'```
what's your full code
the guild doesnt have an owner
Just a bunch of lawlessness
Chaos and anarchy
lol
For bots in > 75 guilds, yes
what about my generic bot in 1 guild?
you only need message intents when your bot is getting verified, unverified bots will continue to work the same
Member intents
!intents
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.
WARNING: This is a development server. Do not use it in a production deployment.
Use a production WSGI server instead.
That's nothing related to discord.py
Replit thing.
!d discord.Member
class discord.Member```
Represents a Discord member to a [`Guild`](https://discordpy.readthedocs.io/en/master/api.html#discord.Guild "discord.Guild").
This implements a lot of the functionality of [`User`](https://discordpy.readthedocs.io/en/master/api.html#discord.User "discord.User").
x == y Checks if two members are equal. Note that this works with [`User`](https://discordpy.readthedocs.io/en/master/api.html#discord.User "discord.User") instances too.
x != y Checks if two members are not equal. Note that this works with [`User`](https://discordpy.readthedocs.io/en/master/api.html#discord.User "discord.User") instances too.
hash(x) Returns the member’s hash.
str(x) Returns the member’s name with the discriminator.
flask thing*
Hello so I have a txt of loads of user ids that I want to have acess to bot commands what’s best way of doing it
how do I fix this Im so confused
Ok thanks
Guys how do I make an event when a member joins with the default avatar
@client.event
async def on_message(ctx):
if ctx.content.lowercase() == "4l, 4c":
await ctx.channel.send("ok")
await client.process_commands(ctx)
I want bot to reply in lower case
!d discord.Message.reply
await reply(content=None, **kwargs)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
A shortcut method to [`abc.Messageable.send()`](https://discordpy.readthedocs.io/en/master/api.html#discord.abc.Messageable.send "discord.abc.Messageable.send") to reply to the [`Message`](https://discordpy.readthedocs.io/en/master/api.html#discord.Message "discord.Message").
New in version 1.6.
Changed in version 2.0: This function no-longer raises `InvalidArgument` instead raising [`ValueError`](https://docs.python.org/3/library/exceptions.html#ValueError "(in Python v3.10)") or [`TypeError`](https://docs.python.org/3/library/exceptions.html#TypeError "(in Python v3.10)") in various cases.
No
As in I want bot to read in lowercase will the current code work
Also I have put 2 message contents but they aren’t working
should be str.lower()
in your case, ctx.content.lower()
!d help
help([object])```
Invoke the built-in help system. (This function is intended for interactive use.) If no argument is given, the interactive help system starts on the interpreter console. If the argument is a string, then the string is looked up as the name of a module, function, class, method, keyword, or documentation topic, and a help page is printed on the console. If the argument is any other kind of object, a help page on the object is generated.
Note that if a slash(/) appears in the parameter list of a function when invoking [`help()`](https://docs.python.org/3/library/functions.html#help "help"), it means that the parameters prior to the slash are positional-only. For more info, see [the FAQ entry on positional-only parameters](https://docs.python.org/3/faq/programming.html#faq-positional-only-arguments).
This function is added to the built-in namespace by the [`site`](https://docs.python.org/3/library/site.html#module-site "site: Module responsible for site-specific configuration.") module.
are you talking about like a embed
like this
So when someone joins the bot checks if the member has a default pfp or a normal pfp
?
are you talking about the server profile and the main profile
Not the server the user
@naive fiber has default pfp
tip for the guy who is dumb but still want to code python?
Yes.
!resources
The Resources page on our website contains a list of hand-selected learning resources that we regularly recommend to both beginners and experts.
What about multiple message content will (“ok, lol”) work
Bruh
anyone know how to make a command to send people messages
Ctx.send
you use in then
await send(content=None, *, tts=False, embed=None, embeds=None, file=None, files=None, stickers=None, delete_after=None, nonce=None, allowed_mentions=None, reference=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.10)") 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.10)") of [`Embed`](https://discordpy.readthedocs.io/en/master/api.html#discord.Embed "discord.Embed") objects. **Specifying both parameters will lead to an exception**.
also why is this not working
@client.command(name="shutdown") async def shutdown(ctx): await ctx.send("Shutting Down....") db.commit() client.scheduler.shutdown() await client.logout()
it keep saying no attribute
if ctx.content.lower() == "4l, 4c":``` currently what I have
You don’t need (name=“shutdown”)
Since you already defined it on 2nd line
ok
db.db has no attribute to commit
so how do I make the error go away
How do you make it where you use a command and the bot dm you message cause Im thinking using await discord.user.send(' ')
you have to create a dm with member first
!d discord.User.create_dm
await create_dm()```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Creates a [`DMChannel`](https://discordpy.readthedocs.io/en/master/api.html#discord.DMChannel "discord.DMChannel") with this user.
This should be rarely called, as this is done transparently for most people.
client.send_message works too
What seems to be error
there's a error in this code
@bot.event
async def on_message(message):
await message2.delete()
if 'hi' in message.content:
time. sleep(0.5)
await message.delete()
message2 = await message.channel.send('hello')
can anyone help me to fix it
the error says await is outside function
there's some weird indent
Your indentation is bad
Use asyncio.sleep
wdym?
oh I didn't read properly, thought there was a member parameter and the dm needs to be created with them...
You don’t need to open Dm send_message opens Dm and sends
No. u can simply just .send()
That sends in channel
I think they want it so you do command it dms the author
No? member.send
O mb
for that a dm needs to be created first
member also has a send attribute as cirno said
o
do u not understand, no. .send() automatically creates one
That’s what I said
oh, I never tried it I think
It’s ok
Author.send works too I think
if ctx.content.lower() == "4l":```
I want it so if 4L is in any sentence it sends not just on its own
Use the python in statement
if "your string" in message.content:
...
Ok
@slate swan LMFAO it flooded the server with same response
How do I execute command after 1 response XD
@client.event
async def on_message(ctx):
if "4l" in ctx.content.lower():
await ctx.channel.send(f"hello {ctx.author.mention}")
await client.process_commands(ctx)```
It spams help
Hi, I have a really bad internet connection rn but uhh my bot doesn't load the icon url.
It should load said icon url but it's a black square
).set_footer(
text = "Made by Player1041 with <3",
icon_url = "https://imgur.com/a/JA7SnCH"
)
Whats with the ).
Does it load the text
The ).set_footer?
Yeah
creditsEmbed = disnake.Embed(
title = "Disarray - A Project by Player1041",
description = "Disarray is a personal project created by Player1041.",
colour = disnake.Colour.random()
).add_field(
name = "Libraries",
value = f"""Main Bot Library: [Disnake](https://github.com/DisnakeDev/disnake)"""
).set_footer(
text = "Made by Player1041 with <3",
icon_url = "https://imgur.com/a/JA7SnCH"
)
Assuming you mean the ).set_footer()
So the image is the only thing not working?
Y u using imgur instead of default
Instead of discord?
Is it allowed to use music beat files instead of using youtube apis or is it agains tos?
It’s allowed I think
You can use music files
this[0:len(this)] = [''.join(this[0:len[this]])] why 'builtin_function_or_method' object is not subscriptable :V
!e
chr(99)
@fossil cosmos :warning: Your eval job has completed with return code 0.
[No output]
!e
ord(99)
@fossil cosmos :x: Your eval job has completed with return code 1.
001 | Traceback (most recent call last):
002 | File "<string>", line 1, in <module>
003 | TypeError: ord() expected string of length 1, but int found
#bot-commands
!e print("Hahaha")
@wicked lily :white_check_mark: Your eval job has completed with return code 0.
Hahaha
!e print("Ha aha")
@wicked lily :white_check_mark: Your eval job has completed with return code 0.
Ha aha
why is it mentioning like this ?
@cunning ice could you try using that command again
i used
{member.mention}
and its showing same :(
ok just a sec
could you show the rest of the code
It is not member.mention()
so ?
What is member
and i specified
member = discord.Member
you didn't assign member
Thats why
i assigned
It should be message.author.mention
that is why
Also use
not like this ?
Commands
why not try discord.Member.mention()?
because it is not function?
ok
I literally already told the answer
yes
yes what
!d discord.Member.mention
property mention```
Returns a string that allows you to mention the member.
Why do you keep trying giving out wrong answers
xd
all kinda same
@cunning ice did it work
e
no
ok
ok just a sec pls
no he/she is mentioning the author
it's the author
len[this]
what is it
ctx.author.mention, or if u want use mention:discord.Member and mention.mention
length of a list
yes?
that doesn't work
and you have len[this]
the or you said
oooh
because you haven't ctx
but it would be better
to use commands instead of on message
umm i am sorry idk anything about ctx commands
with that you can much easier work with single commands
🗿
wait, is he use message.startswith or message content
cause make all code in one func is trash
This conversation
yeah
jesus christ, THAT IS THE MOST SUCK THING (ofc after replit) IN A BOT
.
what have u done, WHAT HAVE U DONE
The fuck
wut :v
as someone said :?
what even is happening here
The second one wouldn't give them what they want
Confusing shit
smh
idk :V not read their question lol, but the right one just message.author.mention
my braincells are hurting
🎊 congrats
I have been ignored from the beginning
While 2 other people throw ideas at the question
why don't you people just give the answer related to the question and not go out of the way 
I have
yo this worked tysm !
hey guys
how to make command so it will make a private channel?
ywc!
🗿
You somehow got the credit
breh, hes litteraly says my answer right
!d discord.Guild.create_text_channel
await create_text_channel(name, *, reason=None, category=None, position=..., topic=..., slowmode_delay=..., nsfw=..., overwrites=...)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Creates a [`TextChannel`](https://discordpy.readthedocs.io/en/master/api.html#discord.TextChannel "discord.TextChannel") for the guild.
Note that you need the [`manage_channels`](https://discordpy.readthedocs.io/en/master/api.html#discord.Permissions.manage_channels "discord.Permissions.manage_channels") permission to create the channel.
The `overwrites` parameter can be used to create a ‘secret’ channel upon creation. This parameter expects a [`dict`](https://docs.python.org/3/library/stdtypes.html#dict "(in Python v3.10)") of overwrites with the target (either a [`Member`](https://discordpy.readthedocs.io/en/master/api.html#discord.Member "discord.Member") or a [`Role`](https://discordpy.readthedocs.io/en/master/api.html#discord.Role "discord.Role")) as the key and a [`PermissionOverwrite`](https://discordpy.readthedocs.io/en/master/api.html#discord.PermissionOverwrite "discord.PermissionOverwrite") as the value.
Note
Creating a channel of a specified position will not update the position of other channels to follow suit. A follow-up call to [`edit()`](https://discordpy.readthedocs.io/en/master/api.html#discord.TextChannel.edit "discord.TextChannel.edit") will be required to update the position of the channel in the channel list...
and add overwrites
oh oof, sorry ||@cunning ice give 'em a credit too||
ohh sorry tysm too !!!
actually me pinging one so its tq for everyone whotried
why https://www.toptal.com/developers/hastebin/banajecoka.csharp when i try 1k it return 0 :V
Hastebin is a free web-based pastebin service for storing and sharing text and code snippets with anyone. Get started now.
guys help
someone motivate me to work on bot pls
sell it
@client.event
async def on_message(ctx):
if "4l" in ctx.content.lower():
for i in range(1):
await ctx.channel.send(f"hello {ctx.author.mention} i sell 4L/cs search alexlol2fast on tiktok 4c 1€ 4L 5€")
await client.process_commands(ctx) ```
TELL THIS MF TO STOP SPAMMING CHANNELS
Motivate
that's why dont on_message
What should I use instead
commands
ctx comand lol
also if from this, dont content.lower or check if the sender is not bot
add if message.author != bot.user: or if (message.author.bot): or if(message.author.id === client.user.id)
on_message doesn't have context as an argument, it has message
I'm aware
ok pep8 officer
@client.event
async def on_message(message):
if "4l" in message.content.lower():
for i in range(1):
await message.channel.send(f"hello {ctx.author.mention}")
await client.process_commands(message) ```
@final iron better?
and why you need for i in range(1) here?
hes think that loop bcuz that
Also yr indent
Also you forgot to change ctx to message
Gonna send the command twice
In the f-string
O yea thx
What
they think that by loop(1) will affect the spam-thing
🗿
Don't do this
bro
It will get you ratelimited
Friday joke
ratelimits and the code is horrible
300 iq
What can I say
:v
If you want context use the Bot.get_context method
@client.event
async def on_message(ctx):
# So our bot doesn't reply to itself
if ctx.author.id == client.user.id:
return
if "4ls" in ctx.content.lower():
await ctx.channel.send(f"hello {ctx.author.mention}")
await client.process_commands(ctx)``` when i use 2 of these commands it stops working any tips
Why is it still ctx
bc ctx works for me
it would still work
Bad naming convention
🗿
on_message needs a Message, not a Context
yep
sus
unindent the process_commands methos
message context lmao
~~async def on_message(context: discord.Message)~~🗿
why would I be banned 
See now you're getting fun of
This is why
🗿
could that be reason y i cant make mutiple commands
yes
kk
probably, also add return's to the send methods
Cant make?
it only processes the message if it is 4ls
that means it just pretends to not check any other message
only 1 command when i try add similar command it doesnt work
@slate swan ayo did u fix the problem ?
@client.event
async def on_message(ctx):
# So our bot doesn't reply to itself
if ctx.author.id == client.user.id:
return
if "4ls" in ctx.content.lower():
await ctx.channel.send(f"hello {ctx.author.mention})
await client.process_commands(ctx)
@client.command()
async def lol(ctx):
await ctx.reply("lol22")``` the second command and first break when i add it
you know you are missing a "
use listen do you dont need to process the command
you can make multiple commands though
Is there a way to check multiple discord servers i'm in for keywords in messages being sent, and then give those values to a discord bot i only have in my own server?
I imagine its pretty easy to do a bot that just checks keywords for a server that it's in, but could i check for the keywords with my own script and then give those values to a bot thats only in my own server
this is mainly just to have something to do and figure out on my own but i first want to know if its even possible
so basically if anyone says a certain keyword in any of the servers i choose, a bot in my own server will tell me that that word was mentioned and where
Help me
yes, override your bots on_message event and check if the guild ID is the guild ID you wanna check (or check if the guild ID is in an iterable of sort if you wanna check for multiple guilds), then check the message content then if the message content matches a keyword you can send the values to your server
i would imagine you could use a database to acomplish this
thanks ill keep this in mind
bruh my bot poo poo
@client.event
async def on_message(ctx):
# bot reply none
if ctx.author.id == client.user.id:
return
if "4ls" in ctx.content.lower():
await ctx.channel.send(f"hello {ctx.author.mention}")
@client.command()
async def lol(ctx):
await ctx.send("lol22")```
There is that syntax error aaaa
Idk how to fix it
u need any help?
Help meee
yes 2nd command wont work
where is the syntax error
i only see one command tho
theres no error in console wdym
check again
anyone got any examples for using dpy's webhooks? I've found this https://discordpy.readthedocs.io/en/latest/api.html?highlight=webhook#discord.AsyncWebhookAdapter, Is thi the correct way to use it?```py
services.py
# Inside my AutoShardedClient subclass
self.session = aiohttp.ClientSession(loop=self.loop)
# main.py
embed = discord.Embed(title=f"Shard {shard} Ready", colour=discord.Colour.green(),
timestamp=datetime.datetime.utcnow(),)
weby = discord.AsyncWebhookAdapter(client.session)
request = await weby.request(verb, url=webhook_url, payload=embed, multipart=None, *, files=None, reason=None)```
yeah im right there's only 1 command
Use ctx.channel.send('lol22')
okimii meant using the @bot.listen() decorator instead of .event
❌
i personally use this
It had happened after I took screenshot
show error w ss
Ok
Yeah
The stupid issue was
That i putted print line inside a for loop
And one of message doesn't contain embeds at all
ohh 💀 nice work tho ! keep on goin
on the other hand i finally made my dc bot able to send out emails
works like a charm 😻
💀 😭
w
there's an example on how to use it in the docs, under the init for Webhook
Thank
U too dude (•√•)
preferably you avoid manipulating the adapter itself
👏 🙏
Cool
yeah I tried that (and it mostly worked) but for some reason I couldn't get timestamps in my embeds and some colours wouldn't display correctly from a hex value and wouldn't show at all using discord.Colour.xyzeven ttho (at least from what I could see in d.py's code) the discord.Colour.xyz is supposed to return a hex value
you know, only a function can return values
and you have to call a function
@slate swan
Im working on a selfbot on my discord acc
Then i dont have to check things manually 😂
hope you know how to
what is that argument naming? the event doesnt even take Context
copy paste spotted
it takes a message obj so why the name
whats a selfbot exactly ? xd
i used ctx as variable pretty much 
Uhh.excuse me,I was needing help
or thats just the name of ur bot
do you understand python, and what are you trying to do?
where can i get help for use and install python?
something that makes u a bot
By what i have heard
Its a code that is active on ur account
Like a bot on a user account
I know python but there is that syntax error
Need help for that
oh ? wait thats possible
yea
discord-webhook runs independently from discord.py, they're written by different people so cross compatibility of classes is unlikely
tf ?
what are you trying to do?
that is possible, but against tos
is a selfbot hard to make ?
an automated user account
Use a file and play it on a vc
ah, i see now, well makes some sense ig
no its like discord bot
meh
what do you want to do with the client variable
just active on ur account not a bot account
yeah ik, was hoping for the best tho
we cant help you with that tho
i seeee, rlly interesting tbh
yes
Idk
The thing that is clear is im soo noob with python
until you get banned :))
but i can see it being used really violently, like, in a dangerous way
dont try
Wdym I copy pasted it from google
', 'queue', 'que'])
async def play(ctx):
guild = ctx.guild@bot.command(aliases=['paly', 'queue', 'que'])
async def play(ctx):
guild = ctx.guild
voice_client
voice_client: discord.VoiceClient = discord.utils.get(bot.voice_clients, guild=guild)
audio_source = discord.FFmpegPCMAudio('vuvuzela.mp3')
if not voice_client.is_playing():
voice_client.play(audio_source, after=None)
i hope you are familier with the nitro scams, those are done by selfbots
it can i use one tbh not maliciously just for fun
now we know, dont copypaste, just learn python
do you mean the examples in the webhokk\_innit_.py file or in the webhook\webhook.py file? I'm not seeing any examples in the latter
that makes sense now that i think about it
google out of everything u picked
What,is that the point of getting help??
Better if you stop helping me
fine :)
Wdym lol.help me
Pls help in debugging it
if u wanna make a car ur not gonna google how to make one
what is even happening bruh
not the source code, the actual documentation
lol
Just help me in the debug!!!!!!
can i tell u the bot im making isnt a bot
not maliciously
@slate swan help me in this error pls
Debug this code
@bot.command(aliases=['paly', 'queue', 'que'])
async def play(ctx):
guild = ctx.guild
voice_client: discord.VoiceClient = discord.utils.get(bot.voice_clients, guild=guild)
audio_source = discord.FFmpegPCMAudio('vuvuzela.mp3')
if not voice_client.is_playing():
voice_client.play(audio_source, after=None)client: discord.VoiceClient = discord.utils.get(bot.voice_clients, guild=guild)
audio_source = discord.FFmpegPCMAudio('vuvuzela.mp3')
if not voice_client.is_playing():
voice_client.play(audio_source, after=None)
bruh ur joking
dont care if its not malicious you stand by discords tos or you dont use the app that easy
ive been using them for months without knowing 💀
could you link me, I seem to be issues finding it
man why do u announce it to the whole server anyone can report u now for admitting of using a selfbot 💀 u might as well consider urself banned now lmao
like actually stop with this bs
Btw how can i check if a array is empty? Since the first cell is 0
i logged into a bot wdym
just use len lol or check the bool
I tried,couldnt do it 
it kinda is
Check the image
o na
@bot.command()
async def huntpet(ctx):
name = ctx.author.id
p = await database.check_prestige(name)
if p >= 1:
if name == 828182019841327115:
z = True
else:
z = random.randint(1, 21) == 11
if z:
z = random.choices(pet_type, weights = pet_probability)
q = pet_type_name[z]
s = random.randint(0, len(q))
get = random.choice(q[s])
await database.add_pet(name, 1, get)
await ctx.send(f"congrats! u caught a [an] {get}!")
else:
await ctx.send("u need at least prestige 1 to access this command :V")```
pet_type_name={
"common":["blue cat"],
"attack":["pet skeleton", "pet spider", "pet zombie"]
}
pet_type=["common", "attack"]
pet_probability=[10, 3]``` is there i did something wrong?
bro its a basic syntax error
he used google what do you expect
keep your opinions to yourself
May I know how
terminal
No,I do
no need to say to someone to stop coding because theyre a beginner?
._. ok, what;s happening here
fr everyone starts somewhere
Yeah
idc i do know it is but you dont say that to someone period.
dude
where r u copy paste from
google he said
YIGNHNIYJQWNDKQMENKHUIOJEFJHWEKFNIWEKFHWEFWEFWEFFWEEWF what kind of thing is that? d yu kno index
@flat solstice i sent it right under the message
No,There are many tutorial and the word says that
every pro was once a beginner
if ur gonna copy and paste atleast use stack overflow
yes but u r a beginner that copy paste from a advanced lib and think that u can do it bcuz u copy pasta
Hmm
oh, musta missed it 
im being honest we all did it 💀
i started dpy without even knowing python and did i end bad? no
we all did it
Mobile
are you everyone?
ok maybe too far but u get my point
i can ping all generals here besides me theyll tell you the same.
lul
Same here
tap the return button then
Be right back
dpy is an advance library yes but you dont say stop coding try to actually help and suggest them a tutorial on oop etc.
Brb,Ima giev link
its like choosing your difficulty, if you are willing to tackle a large library then feel free
just know what you signed up for
exactly but you dont say to someone stop coding yk you actually help them
fr showing someone will get them somewhere telling them thet cant do it they quit
im not?
help ;-;
exact link?
then you should think about your actions before criticizing a beginner
Google doesnt let me see on mobile
people like you deserve to go far in life
@bot.command(aliases=['paly', 'queue', 'que'])
async def play(ctx):
guild = ctx.guild
voice_client: discord.VoiceClient = discord.utils.get(bot.voice_clients, guild=guild)
audio_source = discord.FFmpegPCMAudio('vuvuzela.mp3')
if not voice_client.is_playing():
voice_client.play(audio_source, after=None)
can u guys stop debating over a guy that forgor to press enter :V
This place
hes mobile so return
same thing
not enter
Actually Tablet

I started d.py with a very basic understanding of python, didn't understand a lot of it (and subsequently pissed off a lot of ppl in the d.py server) so went away and did a codecademy course on python and then came back to dpy with a better understanding of python. there's still stuff I don't know or mix up especially in dpy as I often confuse builtin functions, classes and attributes
i got TypeError: unhashable type: 'list'
👏
well its all mainly oop we all start from somewhere
i skidded loads of codes tried reading getting understanding and watched yt
Guys,so what to do basically(im on tablet)
press enter bruh
press enter/return
advertizing
Ok,let me check
ive tried making 3 bots now and it never gives me a token, the first time i ever click on the bot page i get this. i can't have viewed it when i just made the bot and its the first time i've checked the page. + my backup codes dont work so i cant reset
:v
i hate the update
lol
not very good advice when you say to someone to stop coding because they dont know enough its just not right.
👏 ples help
fact
what
chax
chax
scroll up
just say chax :blame:
token reset auto
still isnt correct more like you should learn oop so you can tackle dpy better etc
ConnectionRefusedError: [WinError 1225] The remote computer refused the network connection
i dont know what that even means
why
aye helpers, i need answer
bcuz The remote computer refused the network connection
everyone takes a different approach to things just understand that
advice isnt telling someone to quit 💀
👏 judge a fish by its ability to climb a tree, when they failed, ask them to stay in land, good
dont judge a book by its cover
ok
Shit not again
can someone help ;-;
i give up,
keep it family freindly thanks
:v actually-
is there specific age for coding?
join discord = 13+
I must indent it?
true point actually
u got to much space there
fair
Indentation
Indentation is leading whitespace (spaces and tabs) at the beginning of a line of code. In the case of Python, they are used to determine the grouping of statements.
Spaces should be preferred over tabs. To be clear, this is in reference to the character itself, not the keys on a keyboard. Your editor/IDE should be configured to insert spaces when the TAB key is pressed. The amount of spaces should be a multiple of 4, except optionally in the case of continuation lines.
Example
def foo():
bar = 'baz' # indented one level
if bar == 'baz':
print('ham') # indented two levels
return bar # indented one level
The first line is not indented. The next two lines are indented to be inside of the function definition. They will only run when the function is called. The fourth line is indented to be inside the if statement, and will only run if the if statement evaluates to True. The fifth and last line is like the 2nd and 3rd and will always run when the function is called. It effectively closes the if statement above as no more lines can be inside the if statement below that line.
Indentation is used after:
1. Compound statements (eg. if, while, for, try, with, def, class, and their counterparts)
2. Continuation lines
More Info
1. Indentation style guide
2. Tabs or Spaces?
3. Official docs on indentation
Oh ok,let me fix and run it
k
you do know others dont think the same way as you right?
oh yes the 'wonders' of YT discord bot so called Tutorials. Out of the hundreds if not thousands of discord bot tutorials on YT I have only found 3 or 4 channels that (in my opinion) are actually good. Also there's loads of 'tutoials' who don't say which language they are for so you can find yourself watching a vid of JS bots even tho you searched for python discord bots
:praisethesun: qdfhkwqejfjwefwjkleflkwefwe
am i the only lazy one who indents by back spacing line to line above and press enter
just copy and paste it : )
hes nitro booster btw :V if u bad at 'em they'll probably unboost this server
not u, @drowsy thunder
same
uhh
"same"
no i mean same i aint boosting
then wtf are those things lol
so what
I didnt boost this server
define guild
idk 🤷♂️
guild = ???
yeah that's defiantly good advice, I just like to actually have a purpose for something that I code and most into code projects are good at teaching concepts but ultimately (in my opinion) don't have a purpose once you finish that tutorial or course so I find those kinds of tutorials difficult to stick with
define guild then?
._. guild
yes, basic python
thats not define
what is going on here :S
i think he means guild = guild is
👏 help
Then what
ik
nvm
if im not mistake u just copy server id and guild = sereverid @drowsy thunder
.
👁👄👁️
Then may I get a public version?
aaa,better if I die
indentation is the bane of my coding life, the amount of times I've had to rewrite something bc of a indentation error which I just couldn't find. take this function (t's inside a class) for example, if I have the self.start at the bottom of all the commented out sections then I get a ident error and I can't see whypy async def start_bot(self): await self.start(token) #await self.connect_redis() #await self.connect_postgres() #await self.connect_prometheus() #for extension in self.config.initial_extensions: #try: #self.load_extension(extension) #except Exception: #log.error(f"Failed to load extension {extension}.", file=sys.stderr) #log.error(traceback.print_exc())
@drowsy thunder just do this on your server and click copy id
Ok then
Be right back
members
you should have something like guild = client.get_guild(267624335836053506)
how do i make my bot auto delete a msg in a specific channel?
that works too
ik but it has to target specific channels
wut
get_channel(channel_id, /)```
Returns a channel with the given ID.
Note
This does *not* search for threads.
Changed in version 2.0: `channel_id` parameter is now positional-only.
yes if someone says a word thats not allowed in those channels, the bot detects it then deletes it in that channel but not in other channels
alright, will giv it a try
thx it worked
now i can proceed to write the rest of the code
hey i have made command btw still getting no commands found whyyyy
code?
show command
Ss
code
So I've been following this https://discordpy.readthedocs.io/en/latest/api.html#discord.Webhook on getting a webhook to work but I seem to be getting a import errorpy Traceback (most recent call last): File "C:\Users\Teagan\Documents\Coding\Zupie\bot\main.py", line 12, in <module> from discord import Activity, app_commands, Webhook, AsyncWebhookAdapter ImportError: cannot import name 'AsyncWebhookAdapter' from 'discord' (C:\Users\Teagan\Documents\Coding\Zupie\env\lib\site-packages\discord\__init__.py)
@client.command(name = 'ss')
async def ss(ctx, site):
embed=discord.Embed(colour = discord.Colour.orange(), timestamp=ctx.message.created_at)
embed.set_image(url=(f"https://image.thum.io/get/width/1920/crop/675/maxAge/1/noanimate/{site}"))
await ctx.send(embed=embed)```
Ignoring exception in command None:
discord.ext.commands.errors.CommandNotFound: Command "ss" is not found
firstoff (name = "ss") isnt needed
Hey @light violet!
You either uploaded a .txt file or entered a message that was too long. Please use our paste bin instead.
Hey @light violet!
You either uploaded a .txt file or entered a message that was too long. Please use our paste bin instead.
they remove that in dpy 2.0 iirc
client = commands.Bot(command_prefix=commands.when_mentioned_or(">"), case_insensitive=True, intents=intents)
client.remove_command("help")
client.add_cog(Antinuke(client))
client.run(token,reconnect=True)
@client.event
async def on_ready():
print("I'm in")
print(client.user)
@client.event
async def on_command_error(ctx, error):#
if isinstance(error, commands.MissingPermissions):
embed=discord.Embed(description=f'{ctx.author.mention} You are missing **{"".join(error.missing_perms)}** permissions to run this command')
await ctx.send(embed=embed)
elif isinstance(error, commands.CommandOnCooldown):
embed1=discord.Embed(description=f'{ctx.author.mention} You are on cooldown.Try again in {round(error.retry_after)} s')
await ctx.send(embed=embed1)
elif isinstance(error, commands.CommandNotFound):
embed2=discord.Embed(description=f'{ctx.author.mention} Invalid command, do >help to see commands')
await ctx.send(embed=embed2)
elif isinstance(error, commands.CommandOnCooldown):
embed3=discord.Embed(description=f"{ctx.author.mention} It seems that i am missing the **{''.join(error.missing_perms)}** ")
await ctx.send(embed=embed3)
@client.command(name = 'ss')
async def ss(ctx, site):
embed=discord.Embed(colour = discord.Colour.orange(), timestamp=ctx.message.created_at)
embed.set_image(url=(f"https://image.thum.io/get/width/1920/crop/675/maxAge/1/noanimate/{site}"))
await ctx.send(embed=embed)
this is my code
!paste use pastebin plez
Pasting large amounts of code
If your code is too long to fit in a codeblock in discord, you can paste your code here:
https://paste.pythondiscord.com/
After pasting your code, save it by clicking the floppy disk icon in the top right, or by typing ctrl + S. After doing that, the URL should change. Copy the URL and post it here so others can see it.
well, you are using the run method and making the commands and events after that
oo got it
run creates an endless loop
Oh, what's the new way to do it?
STOP USE PASTEBIN SMH
no?
idk that much 
......?
disnake
hes spamming code when bot says use pastbin
not spamming
not knowing and spamming are different
nvm, I dont wanna start a fight lmao
same
v2
LOL
not knowing and spamming are different
paste long code
.....?
spamming :v
hes paste long code without pastebin :v litteraly spamming

lol
alright, sir
top tier
LOL
errors: im tired of this shit im out
is emblem getting error or what? what is the pink thing
boosting
Off-topic channel: #ot2-never-nester’s-nightmare
Please read our off-topic etiquette before participating in conversations.
🗿 no
it changes for how long u boost for
u says not boosting this server :v but why the emblem shows up
other servers
wait it shows here :V how
since 7 april bruhh
yes
- he says not boost this server
- where nitro boost role
!rule 7 cof cof
7. Keep discussions relevant to the channel topic. Each channel's description tells you the topic.
idk if theres role
no :V
lazy :D gimme motivation to move
how do u get bot-owner name?
same
not possible
just input your name
d you dk ur name :V
aight
:P
well, if in future, you change your name, you can always use the id and get your details
i can set it as in attr right?
wdym
me = bot.get_member(my_uwu_id)
name = me.name
👍🏻


