#discord-bots
1 messages · Page 772 of 1
Which language do u speak?
Turkish
man
Check if the voice client if none using conditionals
I mean, yea... There's numerous ways
Oops, sorry I don't know Turkish was worth a try tho
Mind DMing me your question in Turkish or something?
google tranlsate, cof cof
Actually he's from Pak but unrelated
Wait what? @unkempt canyon got a stroke
!d disnake.Client works tho
class disnake.Client(*, asyncio_debug=False, loop=None, **options)```
Represents a client connection that connects to Discord. This class is used to interact with the Discord WebSocket and API.
A number of options can be passed to the [`Client`](https://docs.disnake.dev/en/latest/api.html#disnake.Client "disnake.Client").
Weird 🤷♂️
how do I fix my copy paste, it only works if I copy smth in pycharm not ouside of it
???
yazacağım kodda 3 tane değişken kullanmak istiyorum ama yapamıyorum
Not a discord bot issue lol
where would i find all the events in disnake? like async def on_ready() and async def on_message, like those?
async def cmd(ctx, arg1, arg2, arg3):
. . .
Capital e
Welp
!d disnake.on_ready there's an event reference section
disnake.on_ready()```
Called when the client is done preparing the data received from Discord. Usually after login is successful and the [`Client.guilds`](https://docs.disnake.dev/en/latest/api.html#disnake.Client.guilds "disnake.Client.guilds") and co. are filled up.
Warning
This function is not guaranteed to be the first event called. Likewise, this function is **not** guaranteed to only be called once. This library implements reconnection logic and thus will end up calling this event whenever a RESUME request fails.
Just click on the event reference section on the left
Welp
Is there sub commands for slash commands in Nextcord?
I got this error?
" raise CommandInvokeError(exc) from exc
disnake.ext.commands.errors.CommandInvokeError: Command raised an exception: AttributeError: 'Member' object has no attribute 'avatar_url'"
If so, could someone link me to it, I can't find it.
member.avatar.url
yeah , but the bot also works when I use random expressions . Example !bot (command) azddgjhsgsgd
Cz it will. You gotta use if statements yourself to see for a particular input
can I throw you the codes
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.
So with what do u need help in it?
the calculator works in any case , i just want it to work with the !calc command . !calc aqjfwefwe in this case, let it not work
Ah, so you want to see if anyone doesn't input anything random?
Hey..!!
Wait, why do u even have another arg? @summer halo
You are using buttons for calculator anyways
Hi
anyone here experienced with database postgresql?
#databases is a better channel
!d disnake.TextChannel.delete_messages
await delete_messages(messages)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Deletes a list of messages. This is similar to [`Message.delete()`](https://docs.disnake.dev/en/latest/api.html#disnake.Message.delete "disnake.Message.delete") except it bulk deletes multiple messages.
As a special case, if the number of messages is 0, then nothing is done. If the number of messages is 1 then single message delete is done. If it’s more than two, then bulk delete is used.
You cannot bulk delete more than 100 messages or messages that are older than 14 days old.
You must have the [`manage_messages`](https://docs.disnake.dev/en/latest/api.html#disnake.Permissions.manage_messages "disnake.Permissions.manage_messages") permission to use this.
yeah but nobody responds
I got summoned 19080000ms latency.
Lots
you're dutch right?
could u help me for some time in dms? Its 1 small problem
yh but he doesnt really understand me
You are overwriting the warning.
yh ik, but I dont get how to not overwrite it
You should just use INSERT INTO then count all the warnings using SQL
I got a system to count the amount of warns, but how do I make it insert in the right place (next to the pinged members id)
SELECT count(*) FROM warning WHERE user_id = 897789854472106004
whats count?
count all rows
Returns the amount of values found
but I added that on my warn command
dm gel kanka
that doesnt fix the overwrites or does it?
Could you please show the command?
@bot.command()
async def warn(ctx, member: discord.Member = None, reason= None):
try:
await db.execute('''INSERT INTO warnings (member) VALUES ($1)''',member.id)
except:
pass
await db.execute(
'''UPDATE warnings set reasons= $1 WHERE member = $2''',reason+',', member.id)
await db.execute('''UPDATE warnings SET warns = warns + 1 WHERE member = $1''', member.id)```
the 7th line updates warn count
But I want a list of reasons
I also think we should go to #databases
To me it looks like you are manually updating the counter.
yh I do
your implementation is not OK, you shouldn't have a counter of warnings
you can just get the amount of matches with a specific WHERE clause, which does this for you
you don't have to "manually" do this
ok
so, as mentioned in the other guild
have a table with warnings
this has a userID guildID and reason
This belongs in #databases
very true
I said the same thing but yea you are correct
Ignorance is the priority 
Facts
Lol
Lol
The file is corrupted
It welcomes double.
0 Bytes
like us
Can't help without code tbh
Facts
Bruh
wait where
I'm asking...
I don't-
Weird then...
This is the new command I added
Hmm weird... Try restarting the bot
how do i send a message like this
discord.Embed
It's an embed color
I found a problem, but not sure whats wrong. Like it's being hosted on 2 shits
Weird , but it exists
First on the local pc, where second
!d discord.Embed.color
No documentation found for the requested symbol.
The colour code of the embed. Aliased to color as well. This can be set during initialisation.
Same thing
Its same on PC, as I disconeccted from the Pycharm a 10 mins ago.
Ah okay
Then search for Python
reset your token and it gets killed already
If I remember correct
I mean sure
not a problem lol ill do it
is there a way to open a commandline when i start the bot, and everything i type gets sent to the channel by the bot ?
Yea, but he has two python instances which are sucking resources
the running instances must close if there's an error right?
And resetting the token would just kill the bot
!d asyncio.create_subprocess_shell
coroutine asyncio.create_subprocess_shell(cmd, stdin=None, stdout=None, stderr=None, limit=None, **kwds)```
Run the *cmd* shell command.
The *limit* argument sets the buffer limit for [`StreamReader`](https://docs.python.org/3/library/asyncio-stream.html#asyncio.StreamReader "asyncio.StreamReader") wrappers for `Process.stdout` and `Process.stderr` (if [`subprocess.PIPE`](https://docs.python.org/3/library/subprocess.html#subprocess.PIPE "subprocess.PIPE") is passed to *stdout* and *stderr* arguments).
Return a [`Process`](https://docs.python.org/3/library/asyncio-subprocess.html#asyncio.asyncio.subprocess.Process "asyncio.asyncio.subprocess.Process") instance.
See the documentation of [`loop.subprocess_shell()`](https://docs.python.org/3/library/asyncio-eventloop.html#asyncio.loop.subprocess_shell "asyncio.loop.subprocess_shell") for other parameters.
Important
It is the application’s responsibility to ensure that all whitespace and special characters are quoted appropriately to avoid [shell injection](https://en.wikipedia.org/wiki/Shell_injection#Shell_injection) vulnerabilities. The [`shlex.quote()`](https://docs.python.org/3/library/shlex.html#shlex.quote "shlex.quote") function can be used to properly escape whitespace and special shell characters in strings that are going to be used to construct shell commands.
I guess??? I mean, it doesn't use exit(), so I guess Python still keeps running?
under a command/method
how do i then send it to a certain channel ?
!d discord.TextChannel.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**.
!d discord.Client.get_channel
get_channel(id, /)```
Returns a channel or thread with the given ID.
the problem is i have to use an await
i mean how do i trigger the send inside a command or an event
knowing it has to be a while loop accepting input
await bot.get_channel(...).send(...)
the user is entering input at random times in another shell thread
how do i connect them
DON'T allow users to execute shell commands
ah man it doesnt have to be a shell
that just screams bad
Then???
The Don't?
yes
It was meant to be
lol
while True:
message = input("enter your message")
i want to send this message in the channel
no
input 😐
yes
Bro, what u even doing
input isnt async and tht goes to YOUR terminal
!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**...
am i dreaming
i am just using discord as a medium
{"695229647021015240": {"messages": 17465}, "6183414919322706506": {"messages": 201}
I have a json file like this and now I want to get the messages amount of all users
So just print out every message amount but idk how to do it
anyone knows how to do it?
That doesn't scream bad ngl
not at all
json[id]["messages"]
Yea
lol
i mean do you guys have an answer ?
ok thx
Idk about u, but I'm
I am speechless
lol
@slate swan can help u better at this point
pinch you feel it
I don't feel anything
wakeup😰
¯_(ツ)_/¯
@pine verge
what are you doing here 
open a separate window to allow a user to enter input and send it to a certain channel after starting the bot
why not use the wait_for coro?
good question
i just started reading the docs today, not familiar with discordpy yet
it just makes the bot wait for an event which you can use "message"
Okimii providing free help?
yup
ikr
okay ill look into that
rewrite my bot for me 
even if the message is coming from a separate window not related to discord ?
i need to rewrite another bot wut😭
it will just be in the scripts runtime memory
not such window
Okay time for me to half die
this is not hacker school
this is a discord api wrapper
dont make me explain whats an api cuz i can😉
I need to rewrite all my bots lol, i feel like my code gets more boring day by day
wanna see my old code?????????
its not working
tb?
lmao
@slate swan can help u better
i mean ig
I'm in the state of being half dead rn
😔
I can give code if needed
Would definitely be bette than maine , sure
I just want to print every single message "amount" of the members
@slate swan :white_check_mark: Your eval job has completed with return code 0.
2
@bot.command()
async def giveaway(ctx):
j = input("giveaway reward/title:\n")
u = input("whats the hosts name:\n")
r = input("any more info like contacting info:\n")
h = input("how much seconds for the giveaway to end(options:0s 1m 5m 30m 1h 24h ):\n")
if h == "1m":
await asyncio.sleep(60)
print("1 m delay has been set")
elif h == "5m":
await asyncio.sleep(300)
print("5m delay has been set")
elif h == "30m":
await asyncio.sleep(1800)
print("30m delay has been set")
elif h == "1h":
await asyncio.sleep(3600)
print("1h delay has been set")
elif h == "24h":
await asyncio.sleep(86400)
print("24h delay has been set")
else:
print("0s delay has been set")
embed = disnake.Embed(title=f"🎉{j}🎉",
description=f"the winner is:{random.choice(ctx.guild.members).mention}\nhosted by {u}\n {r}",
colour=0x3498db)
g = await bot.get_channel(905616933905387531).send(embed=embed)
print(f"{j} giveaway has been made")
you sure?
My first bot code:
client = discord.Client()
@client.event
async def on_message(message):
if message.content == "Spam":
while True:
await ctx.send("Spammy Spammy Spam")
client.run("||Never gonna give you up-||")
my commands now
@command(
aliases=[
"kickhammer",
"userkick",
"memberkick",
"banmember",
"banuser"
]
)
async def kick(
self,
ctx: Context,
member: Member,
*,
reason: str = "No Reason Provided"
) -> Optional[Message]:
if ctx.author.id == member.id:
return await ctx.send(
f"{ctx.author.mention} you cannot ban yourself"
)
await ctx.send(
f"Would you like to kick {member.mention}",
view=KickConfirmation(
ctx.author,
member,
reason
)
)
```
😩
hunter🚪⬅️
Ik I'm half dead rn
😭
¯_(ツ)_/¯
Lot better than mine
Bet you abused pep8
what the fuck
and im getting hated for following the max line limit😔
its 72 ok😔
you don't need to change lines for the kwargs until they exceed a limit
I think i got PTSD looking at this
see im getting hated for following the line limit rule😔
I won't blame you , it looks fancy first
But it's bad afterall

it has to be done tho
it has to be done to follow pep8 sad😔
Me who edited my linter's line limit to like 200: 😐
I use ```bash
$python -m black .
Ik I'm weird ¯_(ツ)_/¯
My initial code is always ugly
i need to follow pep8 guys it hurts and my code looks weird but it has to be done😔
Don't tell me this is how you did the "1000 lines" bot
the wut
some people count lines lol
ew i dont
guys
i need opinions
@sleep_and_retry
@limits(
calls=900,
period=900
)
def get_tweet(
self,
id: int
) -> str:
"""
Gets a tweet by ID.
Parameters
----------
id: :class: `int`
"""
if not isinstance(id, int):
raise Exception(f"id must be an int, not a {type(id).__name__}")
try:
resp = requests.get(
f"https://api.twitter.com/2/tweets?ids={id}",
headers=self.header
)
data = json.loads(resp.text)
return data
except Exception as errorcode:
raise errorcode
what do you think about this?

Hmmmmmmmmm
that was for discord heximals
You talking about me, right?
lol
🚪⬅️
😭
any opinions i need them
One-liners 😬
😠
Yea
say
||Don't write discord bots||
||Use IDLE||
king right here
What do you guys think about ```py
@GatewayClient.on(rin.Event.MESSAGE_CREATE, ...)
async def callback(...) -> None: ...
VS
@rin.Event.MESSAGE_CREATE(...)
async def callback(...) -> None: ...
First one
first for sure
Ofc
any reason
first looks seggsy
I mean, using rin.Event.MESSAGE_CREATE feels a little bit weird ngl...
My reasoning behind that is because It allows a type-safe wait_for
BTW in the first deco, what does ... signify? We can specify multiple events or smth?
E.g rin.Event.MESSAGE_CREATE.wait(...) would return a type of Message
Ah
Extra args you can pass
Still... first one is better ngl
Eg check=lambda *_: True
Damn
mhmmm
You gonna spoil developers istg
fr
I prefer the second one
But this also allows me to have a dispatch without any internal memory holder
Korta, why
Why not both Oh
Because I have a CacheableMeta class in my wrapper, E.g rin.User.cache works
So that means I don't need to append listener data to self.dispatch.listeners
why not make another one🧠
I mean GatewayClient is unnecessary , if second does it alreadt
Instead I can append listener data to rin.Event.READY.listeners
Okay, I'm seriously half dead rn so I don't understand shit rn. Imma instead just head out cya
👁️ 👁️
bye bye
🥜
Implement redis cache
❌ 🧢
Why would I implement a redis cache into the wrapper
i should use redis
That should be up to the user to decide
or maybe not but if you have inbuilt support for redis cache, that would be cool
It's easy enough to extend my cache
asyncio_ensure_future = asyncio.async # Python < 3.5
^
SyntaxError: invalid syntax```
Let's see the code
ok
heres the code: ```py
import asyncio
import http
Replace with BaseEventLoop.create_task when dropping Python < 3.4.2.
try: # pragma: no cover
asyncio_ensure_future = asyncio.ensure_future # Python ≥ 3.5
except AttributeError: # pragma: no cover
asyncio_ensure_future = asyncio.async # Python < 3.5
try: # pragma: no cover
# Python ≥ 3.5
SWITCHING_PROTOCOLS = http.HTTPStatus.SWITCHING_PROTOCOLS
OK = http.HTTPStatus.OK
BAD_REQUEST = http.HTTPStatus.BAD_REQUEST
UNAUTHORIZED = http.HTTPStatus.UNAUTHORIZED
FORBIDDEN = http.HTTPStatus.FORBIDDEN
INTERNAL_SERVER_ERROR = http.HTTPStatus.INTERNAL_SERVER_ERROR
SERVICE_UNAVAILABLE = http.HTTPStatus.SERVICE_UNAVAILABLE
except AttributeError: # pragma: no cover
# Python < 3.5
class SWITCHING_PROTOCOLS:
value = 101
phrase = "Switching Protocols"
class OK:
value = 200
phrase = "OK"
class BAD_REQUEST:
value = 400
phrase = "Bad Request"
class UNAUTHORIZED:
value = 401
phrase = "Unauthorized"
class FORBIDDEN:
value = 403
phrase = "Forbidden"
class INTERNAL_SERVER_ERROR:
value = 500
phrase = "Internal Server Error"
class SERVICE_UNAVAILABLE:
value = 503
phrase = "Service Unavailable"
or mine?
this really isnt related to this channel
Use an API wrapper
!pypi disnake
thank you
hey how do i get all the data that comes after the command like if i do /test asdasgf it would say asdasgf
Holy crap 😧
i tried b = ctx.message.content then b.split("/code ") but did not work
Add another argument
That's splitting a string
What is your prefix
/
['', '02b480dfec114c30bfaaac1f89fca503'] its sending that i only want the 02b part
!d str.split
str.split(sep=None, maxsplit=- 1)```
Return a list of the words in the string, using *sep* as the delimiter string. If *maxsplit* is given, at most *maxsplit* splits are done (thus, the list will have at most `maxsplit+1` elements). If *maxsplit* is not specified or `-1`, then there is no limit on the number of splits (all possible splits are made).
If *sep* is given, consecutive delimiters are not grouped together and are deemed to delimit empty strings (for example, `'1,,2'.split(',')` returns `['1', '', '2']`). The *sep* argument may consist of multiple characters (for example, `'1<>2<>3'.split('<>')` returns `['1', '2', '3']`). Splitting an empty string with a specified separator returns `['']`.
For example:
Well its a list so index it
!e
list_ = ["a", "b"]
print(list_[1])
@final iron :white_check_mark: Your eval job has completed with return code 0.
b
i tried said list index out of range
Send why you tried to do
Maybe data is not in the desired format

!e
b = ['', '02b480dfec114c30bfaaac1f89fca503']
print(b[2])
s```
@storm steppe :x: Your eval job has completed with return code 1.
001 | Traceback (most recent call last):
002 | File "<string>", line 2, in <module>
003 | IndexError: list index out of range
Remember, the index always starts at 0 not 1

Great

Well done
This chat uses too much pika

What’s good

?
So I currently have a command that sends a menu and when it is used deletes the message. It's working but I don't like how the code looks. Is there anyway I can shorten the code?
Heroku errors:
2022-01-23T20:15:18.559130+00:00 heroku[worker.1]: Starting process with command `python bot.py`
2022-01-23T20:15:20.322723+00:00 heroku[worker.1]: Stopping all processes with SIGTERM
2022-01-23T20:15:19.266847+00:00 heroku[worker.1]: State changed from starting to up
2022-01-23T20:15:19.352944+00:00 heroku[worker.1]: Idling
2022-01-23T20:15:20.575307+00:00 heroku[worker.1]: Process exited with status 0
2022-01-23T20:15:19.412294+00:00 heroku[worker.1]: State changed from up to down
2022-01-23T20:15:19.466582+00:00 heroku[worker.1]: Idling because quota is exhausted
What kind of mistake?
how do i make databases with python?
Check out the pins of #databases
hello ```py
from discord.ext import commands, tasks
from discord import Member
from discord.ext.commands import Bot, has_guild_permissions, is_owner
import random
import asyncio
from keep_alive import keep_alive
import requests as rq
class Moderation(commands.Cog):
def init(self, client):
self.client = client
@commands.command()
async def gban(ctx, user: discord.User):
for guild in bot.guilds:
await guild.ban(user)
def setup(client):
client.add_cog(Moderation(client))``` im getting error TabError: inconsistent use of tabs and spaces in indentation but im pretty sure its all correct.
Error says all.
You have exceeded the free Heroku usage per month :)
Wait until next month to be able to launch your bot again, and expect the same to happen again.
Take a look at the Heroku section and why not to use it.
class Moderation(commands.Cog):
def __init__(self, client):
self.client = client
@commands.command()
async def gban(self, ctx, user: discord.User):
for guild in bot.guilds:
await guild.ban(user)
def setup(client):
client.add_cog(Moderation(client))```
error code:
```Traceback (most recent call last):
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\ext\commands\bot.py", line 606, in _load_from_module_spec
spec.loader.exec_module(lib)
File "<frozen importlib._bootstrap_external>", line 879, in exec_module
File "<frozen importlib._bootstrap_external>", line 1017, in get_code
File "<frozen importlib._bootstrap_external>", line 947, in source_to_code
File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
File "C:\Users\Administrator\Desktop\Bots\iRP bot\cogs\Moderation.py", line 13
@commands.command()
TabError: inconsistent use of tabs and spaces in indentation
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "C:\Users\Administrator\Desktop\Bots\iRP bot\main.py", line 37, in <module>
client.load_extension(f'cogs.{filename[:-3]}')
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\ext\commands\bot.py", line 678, in load_extension
self._load_from_module_spec(spec, name)
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\ext\commands\bot.py", line 609, in _load_from_module_spec
raise errors.ExtensionFailed(key, e) from e
discord.ext.commands.errors.ExtensionFailed: Extension 'cogs.Moderation' raised an error: TabError: inconsistent use of tabs and spaces in indentation (Moderation.py, line 13)```
Error says all.
You're sometimes using tabs for indentation and sometimes you use spaces.
Only use spaces or tabs. Not sometimes one sometimes the other one.
You shouldn't ask us everything 🙂
bump
import discord
from discord.ext import commands, tasks
from discord import Member
from discord.ext.commands import Bot, has_guild_permissions, is_owner
import random
import asyncio
from keep_alive import keep_alive
import requests as rq
intents = discord.Intents().all()
class Moderation(commands.Cog):
def __init__(self, client):
self.client = client
@commands.command()
async def gban(self, ctx, user: discord.User):
for guild in self.guilds:
await guild.ban(user)
def setup(client):
client.add_cog(Moderation(client))```
Error:
```Ignoring exception in command gban:
Traceback (most recent call last):
File "C:\Users\Administrator\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\Administrator\Desktop\Bots\iRP bot\cogs\Moderation.py", line 17, in gban
for guild in self.guilds:
AttributeError: 'Moderation' object has no attribute 'guilds'
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "C:\Users\Administrator\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\Administrator\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\Administrator\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: AttributeError: 'Moderation' object has no attribute 'guilds'```
self.guilds?
Don't you mean
!d discord.ext.commands.Bot.guilds
property guilds: List[discord.guild.Guild]```
The guilds that the connected client is a member of.
Is there a more elegant way to get user input than wait_for?
i tried making a banner command.. and the banner won't display as gif.. does anyone know why?
Also, where should my classes be in my code since I'm going to have a ton of them because of menus and buttons
Should they all be at the top?
You hate to see it
I know
It's just that it took 2 minutes to respond for some reason
and then it's an error
just subclass ctx so it automatically sends embeds as an embed
I didn't understand oop until I took upon myself learning C++
More as a challenge than to actually do something
Everyone talking about it as the ultimate super hard language but idk
I don't really think that's the case
Subclassing is oop right
well everything is an object
I have a feeling this is far from pythonic
learn how to automatic your help command
If you force everything into an object it's gonna overcomplicate stuff
also use disnake
ill help you automate your help command if you use disnake 😋
yeah just ctrl + r everything to disnake
because disnake is superior in every way
i gtg to to sleep, so ill add you as friend and tomorrow lol
better docs, maintainers, code standard, etc
does it have slash command support
course
Bro the nextcord docs are so fucking bad
and the mods of their discord are inept asf
someone joined just to be racist and say something about "___s burning" and they spend 5 minutes arguing over warn or ban instead of doing shit
and they have some shitty paste tool and banned codeblocks because they don't color correctly on mobile
ill def switch to disnake
most people in this channel use disnake
its not ran by children like nextcord and pycord
hey. ihave this event but it gives this error ```python
channel = self.client.get_channel(int(config['supportcha']))
await channel2.set_permissions(member, connect = True)
await channel2.set_permissions(guild.default_role, connect = False, view_channel = False)
await member.move_to(channel2)
Traceback (most recent call last):
File "D:\coding_things\pythonV2\lib\site-packages\nextcord\client.py", line 415, in _run_event
await coro(*args, **kwargs)
File "C:\Users\Δημήτρης Κολιόπουλος\Desktop\moma\events\support.py", line 58, in on_voice_state_update
await member.move_to(channel2)
File "D:\coding_things\pythonV2\lib\site-packages\nextcord\member.py", line 859, in move_to
await self.edit(voice_channel=channel, reason=reason)
File "D:\coding_things\pythonV2\lib\site-packages\nextcord\member.py", line 803, in edit
data = await http.edit_member(guild_id, self.id, reason=reason, **payload)
File "D:\coding_things\pythonV2\lib\site-packages\nextcord\http.py", line 337, in request
raise HTTPException(response, data)
nextcord.errors.HTTPException: 400 Bad Request (error code: 10003): Unknown Channel
doesn't the error say it all?

Lol was your last project c# console application lmao
he got drunk
React actually
couldnt find the channel as the error says and the status code says
How many things will I need to change if I migrate from pycord to disnake?
No idea since pycord changed a lot of internals.
Best is to just replace all pycord with disnake and then run it.
Fair. Maybe I will try it out.
how do i remove a user from vc?
move_to()
Also why is disnake better than pycord? (Besides "not being maintained by children)
if you pass None, it'll kick them
https://github.com/FrancescaLEGIT/Agumarine any ideas what can i add or something
It's pretty technical, but they changed some stuff that's pretty awful.
Such as?
Not using json as a db
!p move_to()
Converting to "int" failed for parameter "pep_number".
They are supporting json files, weird additions to aiohttp, pretty bad paginator.
!pep <pep_number>
Can also use: get_pep, p
Fetches information about a PEP and sends it to the channel.
wait what
!d discord.Member.move_to prob
await move_to(channel, *, reason=None)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Moves a member to a new voice channel (they must be connected first).
You must have the [`move_members`](https://discordpy.readthedocs.io/en/master/api.html#discord.Permissions.move_members "discord.Permissions.move_members") permission to use this.
This raises the same exceptions as [`edit()`](https://discordpy.readthedocs.io/en/master/api.html#discord.Member.edit "discord.Member.edit").
Changed in version 1.1: Can now pass `None` to kick a member from voice.
eyy :3
You get the member first
get_member(user_id, /)```
Returns a member with the given ID.
No, read the embed.
oh shit yeah
get_member is a method of guild
ok
We don't help with that here due to violation of YouTube's Terms of Service.
Ok
you're probably looking for yt_dl
I just told him it violates ToS and you give him suggestions?
I guess it's a music bot, that's all I read
So?
No you adress the object not the class that makes the object
this is so confusing lmao
member = guild.get_member(1289128)
await member.move_to(None)
wait but didnt the embed say discord.Guild stuff
That is because that's the location of the method yeah
@mighty dust
guild.get_member(1289128) this returns discord.Member
Then define that as member and then await member.move_to(None)
so this is actually discord.Member.move_to
evening panda
👋
i need ideas what i can add to my bot cuz i dont have any ideas
Lol ummm, I'm making a discord bot and I'd love for you to tell me something that a discord bot may help you with in your usual discord experience weather as a normal member of a discord server, a moderator or even a server owner. I'll make sure to add every interesting feature that you might recommend lol
ok
so what commands do u have
definetly configuration
that does not require a dashboard
Follow pep8, add cogs, remove json, subclass help command and make your code more readable
u can add commands like help userinfo dog cat ban mute kick warn clear etc or other else if u dont have
Looking for something unique that a normal bot does not have
im making it in the esyiest way
for me
but bad practices
Easiest way is not always a good way
I'll look into that one, it's really easier for configuration without a dashboard
Everything already exists.
^
^
ye im trying to do that with my discord bot
Something bots like Dyno, turtle, dank memer and other popular bots don't have
Right not the discord bot space is not the best
^
Just use a database to store your configurations as you do for other user related stuff
i do
Why did you import random 3 times lol
i have a sqlite db, but gonna change to postgres
So many unused imports
Why not lol
pycharm having a stroke.
Bad practice
water gaze always so serious

Lol that's a lot of inputs even though they're all useful
😢
Wtf is platform used for @final iron
idfk its not my code
!d platform
Source code: Lib/platform.py
Note
Specific platforms listed alphabetically, with Linux included in the Unix section.
It's @slate swan's code
Ah it returns info about the current machine.
!pypi psutil
Imagine using C++: 🤡
Meh platform is build-in
c#
What is platform used for lol I'm kinda new
platform — Access to underlying platform’s identifying data
Definitely understood...
From my understanding it gets information about the system
Not sure though. What was shown above was not my code
That's pretty useless ngl
Meh
Useless for you
It can get some interesting information
Log4J is op in all types of situations, I love Log4J (Java)
but has security issues as shown by the incident
"some" issues
that
Very grand understatement
That's why I like it lol
vulnerability
Imagine you're playing Minecraft and just a random Rickroll shows up
Doesn't really work like that

Yea ik someone had to type some shit in chat idk
bro destroyed everyones childhood in 1 sentence
can i somehow get all users names "name" and send all of them with their id's
The user’s username.
The user’s unique ID.
Uhh why?
Discord.py is full af with functions
you should see hikari
I want to get all of them
and pincer
What that?
I know but why since it is a tad inappropriate.
can i do that or no?
just get to the point
I love coding in brainfuck, not that I'm good at it, just because it makes me look superior
[+++++-----+]
Those mortals really underestimate brainfuck
Then no, if you can't answer why.
Long story like i need to solve some puzzle or something and need to do that it is kinda like cicada if u know what cicada is
import choice one and second from random import choice
+++++ +++[- >++++ ++++< ]>+++ ++++. <++++ +[->+ ++++< ]>+++ ++.<+ ++[->
+++<] >++++ ++.<+ +++++ +++[- >---- ----- <]>-- -.<++ +++++ ++[-> +++++
++++< ]>+.< +++[- >---< ]>--- -.+++ +++.+ +++++ +++.< +++++ ++++[ ->---
----- -<]>- --.<+ +++++ ++[-> +++++ +++<] >++++ +++++ +++++ .+..< +++[-
---< ]>--- -.<
why are u gae?
So you are looking for patterns inside user id's?
im not gay or lesbian or lgbt
You are gæ
@placid escarp
nope
Then who is gae
Guy's please keep it appropriate.
i just add this nick cuz i like this nick name
gert back on topic
Why you got the LGBT color
like (!allusers <username>) bot sends all user with this name and their #tags: int
Ok get back to discord bots
cuz its looks cool in the nick names
in the current guild?
ctx
all over the discord
Yeah can you not see how this is pretty inappropriate command?
you want to make this?
Ion understand how TF this works
I don't think thats possible
whew
It is but it's pretty sus
surely not, since a bot can only see from guilds he's in
False
he can use get_user, ok, but that won't get him the name unless he knows the ID
then tell me "how"?
But he can get the I'd using discord.User.id
Surely can find something
think about it the other way
if he needs to get a user by name, he first needs to get a list of all users in discord
only way of doing this is by just getting all users one by one with ID (by just iterating through it ig)
!d discord.abc.User.mention
property mention: str```
Returns a string that allows you to mention the given user.
idk?
that why i said idk
@slim ibex test purpose
i mean cat aip
You can't analyze the contents of a ping to get a tag since damn
you can convert a mention into a member / user object tho
pls
Lemme try
@slate swan
TheCatApi // Developer Experience
Get your API Key from - https://TheCatAPI.com
Here you'll find the API reference & Code examples for:
1. Searc...
That should help
that's the exact same as @slate swan so you can already guess what dpy does with this
Yea
a user mention is just <@!id>
anyone of any age can code
im almost 16 years old
I don't thing 9- is appropriate for coding
i use nextcord
Yea we are idk not that hard
It's not dead, its just not maintained. It's still perfectly useable
Don't discuss that here.
Ok sorry
april..
I don't see why not
discord.py still works fine.
oh yeah i had it in school when i was 7 lol
Still about 2 months until april. It takes less than 5 minutes to transition to a well made fork
but scratch is not really coding
ehh
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.
Traceback (most recent call last):
File "/home/container/.local/lib/python3.8/site-packages/discord/ext/commands/core.py", line 85, in wrapped
ret = await coro(*args, **kwargs)
File "bot.py", line 317, in kot
cat = json_data['message']
KeyError: 'message'
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/home/container/.local/lib/python3.8/site-packages/discord/ext/commands/bot.py", line 939, in invoke
await ctx.command.invoke(ctx)
File "/home/container/.local/lib/python3.8/site-packages/discord/ext/commands/core.py", line 863, in invoke
await injected(*ctx.args, **ctx.kwargs)
File "/home/container/.local/lib/python3.8/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: KeyError: 'message'
how do i tell my bot to send a message then wait for someone to respond then take that data and respond again
when i use my cat command
client.wait_for_message or something like that
thanks
!d discord.Client.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.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.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**...
but i have the dog command and the dog command work without any errors
there is an issue with the key of message value
nah
Can we see the code any how your json file is formatted?
i can give a code
async def kot(ctx):
r = requests.get("https://aws.random.cat/meow")
json_data = r.json()
cat = json_data['message']
embed=discord.Embed(color=0xff0000)
embed.add_field(name ="1.", value="kotek", inline=False)
embed.set_image(url=cat)
await ctx.reply(embed=embed)``` my cat command
and this is my dog command that works normaly without errors @bot.command() async def pies(ctx): r = requests.get("https://dog.ceo/api/breeds/image/random") json_data = r.json() dog = json_data['message'] embed=discord.Embed(color=0xff0000) embed.add_field(name ="1.", value="piesek", inline=False) embed.set_image(url=dog) await ctx.reply(embed=embed)
There is no message key in the json data
It returns {'file': 'https://purr.objects-us-east-1.dream.io/i/20170219_154626.jpg'}
Well they're different api's
They're not going to return the exact same thing
!e
!eval [code]
Can also use: e
*Run Python code and get the results.
This command supports multiple lines of code, including code wrapped inside a formatted code block. Code can be re-evaluated by editing the original message within 10 seconds and clicking the reaction that subsequently appears.
We've done our best to make this sandboxed, but do let us know if you manage to find an issue with it!*
#bot-commands
ok so im gonna try something else i mean the same command but in the deferent way sorry for my english
Okay
ugh my hosting what i using for hosting my bot
i cant save what i add to the flie cuz
the hosting have error 503
i mean has
yes i can save file
boosting = []
for guild in member.mutual_guilds:
getmember = guild.get_member(member.id)
if getmember.premium_since:
boosting.append(guild.id)
if boosting == []:
return```im trying to depict which guild in this array was boosted first
when i print `boosting` this is the output
`[821722608767598663, 930914924262207519]`
how can i put the guilds/member objects themselves in a `list` instead of the `guild id`, then `sort()` the list with a `key` that returns the `premium_since`
ugh
boosting = sorted([guild.id for guild in member.mutual_guilds if guild.get_member(member.id).premium_since])
Spoonfeeding? Never heard of him.
any ideas
Traceback (most recent call last):
File "C:\Users\hoosi\AppData\Local\Programs\Python\Python39\lib\site-packages\discord\ext\commands\core.py", line 85, in wrapped
ret = await coro(*args, **kwargs)
File "c:\Users\hoosi\Desktop\ArrowBots\Archer\main.py", line 195, in hbnc
reqSetHomebaseName = requestText(session.post(links.profileRequest.format(account_id, "SetHomebaseName"), headers=homebaseHeaders, json={"homebaseName": hbname}))
File "C:\Users\hoosi\AppData\Local\Programs\Python\Python39\lib\site-packages\requests\sessions.py", line 578, in post
return self.request('POST', url, data=data, json=json, **kwargs)
File "C:\Users\hoosi\AppData\Local\Programs\Python\Python39\lib\site-packages\requests\sessions.py", line 516, in request
prep = self.prepare_request(req)
File "C:\Users\hoosi\AppData\Local\Programs\Python\Python39\lib\site-packages\requests\sessions.py", line 449, in prepare_request
p.prepare(
File "C:\Users\hoosi\AppData\Local\Programs\Python\Python39\lib\site-packages\requests\models.py", line 317, in prepare
self.prepare_body(data, files, json)
File "C:\Users\hoosi\AppData\Local\Programs\Python\Python39\lib\site-packages\requests\models.py", line 467, in prepare_body
body = complexjson.dumps(json)
File "C:\Users\hoosi\AppData\Local\Programs\Python\Python39\lib\json\__init__.py", line 231, in dumps
return _default_encoder.encode(obj)
File "C:\Users\hoosi\AppData\Local\Programs\Python\Python39\lib\json\encoder.py", line 199, in encode
chunks = self.iterencode(o, _one_shot=True)
File "C:\Users\hoosi\AppData\Local\Programs\Python\Python39\lib\json\encoder.py", line 257, in iterencode
return _iterencode(o, 0)
File "C:\Users\hoosi\AppData\Local\Programs\Python\Python39\lib\json\encoder.py", line 179, in default
raise TypeError(f'Object of type {o.__class__.__name__} '
TypeError: Object of type Message is not JSON serializable
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "C:\Users\hoosi\AppData\Local\Programs\Python\Python39\lib\site-packages\discord\ext\commands\bot.py", line 903, in invoke
await ctx.command.invoke(ctx)
File "C:\Users\hoosi\AppData\Local\Programs\Python\Python39\lib\site-packages\discord\ext\commands\core.py", line 859, in invoke
await injected(*ctx.args, **ctx.kwargs)
File "C:\Users\hoosi\AppData\Local\Programs\Python\Python39\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: Object of type Message is not JSON serializable```
Means that you did not put anything inside the json file.
put [] in it
Seems to me like they are trying to make a message object a key
Or something along those lines
Hey guys! I'm using d.py and it seems as though TextChannel.purge() is blocking on some chats. I'm trying to delete all messages that match a check from a chat. I'm not sure if it just takes way too long or not, has anyone experienced the same/have any fixes?
A yeah that was that error.
i stopped meking this cat command
Yeah it's just taking really, really long.
await ctx.message.delete()
code = ctx.message.content
b = code.split("/hbnc ")
reqToken = requestText(session.post(links.getToken, headers={"Authorization": "basic discord token", "Content-Type": "application/x-www-form-urlencoded"}, data={"grant_type": "authorization_code", "token_type": "eg1", "code": b[1]}))
access_token, account_id, displayName = reqToken["access_token"], reqToken["account_id"], reqToken["displayName"]
await ctx.send('Please Respond with what you want the homebase name to be')
check = lambda m: m.author == ctx.author
try:
hbname = await client.wait_for('message', check=check, timeout=30)
except asyncio.TimeoutError:
await ctx.send('Homebase Name Change cancelled, timed out.')
pass
homebaseHeaders = {"Authorization": f"bearer {b[1]}", "Content-Type": "application/json"}
reqGetHomebaseName = requestText(session.post(links.profileRequest.format(account_id, "QueryProfile"), headers=homebaseHeaders, data="{}"))
reqSetHomebaseName = requestText(session.post(links.profileRequest.format(account_id, "SetHomebaseName"), headers=homebaseHeaders, json={"homebaseName": hbname}))
oldHomebaseName, newHomebaseName = [reqGetHomebaseName['profileChanges'][0]['profile']['stats']['attributes']['homebase_name'], reqSetHomebaseName['profileChanges'][0]['profile']['stats']['attributes']['homebase_name']]
embed=discord.Embed(title="Succsess!", color=discord.Color.green())
embed.add_field(name="__{oldHomebaseName}__ :arrow: {newHomebaseName}", value="Homebase name changed to {newHomebaseName}!", inline=True)
embed.set_footer(text="Homebase Name Change | /hbnc")
await ctx.send(embed=embed)
im getting error TypeError: Object of type Message is not JSON serializable
err your token
wdym
You leaked your APIs token
You leaked your token
crap
😘
il reset its only in my own sercer
do u see err tho
You're passing a Message object into... somewhere... where it's trying to be written into JSON.
Wherever that is if you can find it, just do Message.content.
async def cat(ctx):
async with aiohttp.ClientSession() as session:
request = await session.get('https://some-random-api.ml/img/cat')
dogjson = await request.json()
request2 = await session.get('https://some-random-api.ml/facts/cat')
factjson = await request2.json()``` bot dosent sent imagine of cat and facts
I can't find it for the life of me
reqSetHomebaseName = requestText(session.post(links.profileRequest.format(account_id, "SetHomebaseName"), headers=homebaseHeaders, json={"homebaseName": hbname}))
bname = await client.wait_for('message', check=check, timeout=30) this?
im new to coding and i keep getting this error, while everytime i run it i get ''pycharm crashed unexpectedly'' but it never closes, i have no clue whats going on lmao
? its for a discord bot
This is your IDE not a Discord bot
oh
Besides they are more experienced than us regarding that topic.
https://github.com/an-dyy/Rin/releases/tag/v0.1.1 this is so pog
idk why
indeed pog
Yes, what is your opinion on which is better? @GatewayClient.on(rin.Events.READY) or @rin.Events.READY()
I'm writing some manuals for the wrapper soon so I wanted to know which to prioritise
Well that's the class itself, actual impl would be @client.on(...)
mmmm no clue lol
I've been to lazy to add actual models
I've been doing the skeleton for the wrapper this whole time
lol
can samebody help
You forgot to send the image
oldHomebaseName, newHomebaseName = [reqGetHomebaseName['profileChanges'][0]['profile']['stats']['attributes']['homebase_name'], reqSetHomebaseName['profileChanges'][0]['profile']['stats']['attributes']['homebase_name']]
KeyError: 'profileChanges'
oh
You would need I think: await ctx.send(dogjson + factjson)
If I'm right
ok
bot.run("mytoken ")
^
SyntaxError: invalid syntax```
That line shouldn't be indented
Hi, I'm trying to use Mangadex API and I got this error. Help me please
so what i should i do
Unindent it
move from __future__ import absolute_import above the codes
but how
By deleting the tabs/spaces
I didn't import it
Do you know what is indent? lol
oh didnt read it properly, not sure that shouldnt be an error, maybe try uninstalling the package and reinstalling
Oh ok
let me try
ok
Why not just go through the bare api?
I already went there
But they just told me to import
I don't even know what is that error
whats mangadex
mhmm

did you made that wrapper?
Ughh I'm trying to use it
ic
u think he'd be asking for help if he was the creator of the wrapper
cuz i just implemented rate limits in my wrapper lol

¯_(ツ)_/¯
im trying to make a discord bot
btw I need help, don't mind at the file directory lol
it's my first time
Then?
im making a ping pong command i understand a lil bit like if message.content.startswith('!ping') await message.channel.send('pong!')
Don't make "commands" that way
what
What
Hmm message.startwith can be a good choice but if you are going to build some big projects you shouldn't use that
ok sorry it's just my first time
A tutorial on how to use discord.py to create your own Discord bot in Python, written to fix the flaws of many other popular tutorials.
Check out this tutorial
It shouldn't be used at all
https://discordpy.readthedocs.io/en/stable/ you can use this
Because there is only 1 prefix if you use like there
use it?
Ughh read it.. it's the documentation
What?
mb
nvm
When you use the actual commands extension you define the prefix
Yes
But like, when you use the startwith one
There is no reason to be making "commands" with message.content.startswith
auto respond
What?
LMAO
wdym
What is auto respond
It can be easily understand like when you say Hi in the chat the bot will automatically response you like "Hi, wsp"
Just like Mimu
Then its not a command
I didn't say it's a command

btw help please 😭
You replied to my message which said "There is no reason to be making "commands" with message.content.startswith"
Saying auto respond
Oh didn't see that, mb
You replied to it...
Like what
Do you just reply to random messages?
my guy came here to get some help about his random mangadex wrapper, u out here makin his life more miserable 
LMAO
Lmao sosoemtimes
Doubt it
Is that the full traceback?
Lol
Actually, ask in #python-discussion
kinda
bruh im making discord bots so i need to ask here?
No. Read the channel description
For questions and discussions relating to Discord bot development with discord.py and other relevant Python libraries.
Other relevant
It's not a relevant library
hurtful
Most people have probably never heard of it
u should ask the lib dev or something
I don't understand why you don't just want to go through the api
Hi, I want to add a new feature to my Modmail bot.
- When the staff members do
!close 10mthe bot closes the ticket in 10 minutes. I got that already. But I want it to cancel the close when the user who opened the ticket message the Bot within the 10 minnutes. - When the staff members do
!close 10mthe bot dms the user who opened the ticket:
Hello! This ticket is scheduled to close automatically in 10 minutes and will be marked as resolved. However, you can send another message to cancel this if you still need something. Otherwise, thank you for reaching out to us!
You are more than welcome to re-open another ticket if you feel like you have another query related to Unicorn.
We appreciate your continued support!
Please ping when answering. can you send me the new code if you have it thx.
Hey @warped nebula!
It looks like you tried to attach a Python file - please use a code-pasting service such as https://paste.pythondiscord.com
Send the old code that you made
it doesn't let me send the file.
Read what the bot said
Then copy or upload to somewhere
k
ideone can be nice
Why are people so opposed to reading
...
It gives you a pasting service with syntax highlighting right here
I pasted it. How do I download it?
Copy the link
Click on this and copy the link
huh?
I thought you use cogs 
what that?
how tf you don't know
i dumb
Can you send only the part you need help with?
Sending everything really isnt useful
You're not going to get spoonfed code
I didn't mean code
What is line text
like what to put under what line
Thats called code...
o
!e
print("a")
@final iron :white_check_mark: Your eval job has completed with return code 0.
a
What I just wrote out is code
ok
I'm afraid spoon feeding isn't really what this server is about
If you need any help with thinking of how to add something or an error we can help
But most people aren't going to write up lines of code
ok, if u say so
what u want is wait_for() n timeout
Hey, for my pthon discord bot, i want to make it send colored text. If i import a color module like colorama, and add it with the bots following messages, would it appear as colored?
Check if the bot works?
Do you have an on_message event?
It's defaulted in that case
Ah
Do you have one or not?cause it can block commands from working
If it was in a cog there would be no issue lol
Change the event decorator to .listen() and it would be fine
huh?
help how to make an uhh bot command prefix
!d discord.ext.commands.Bot takes a command_prefix kwarg
class discord.ext.commands.Bot(command_prefix, help_command=<default-help-command>, description=None, **options)```
Represents a discord bot.
This class is a subclass of [`discord.Client`](https://discordpy.readthedocs.io/en/master/api.html#discord.Client "discord.Client") and as a result anything that you can do with a [`discord.Client`](https://discordpy.readthedocs.io/en/master/api.html#discord.Client "discord.Client") you can do with this bot.
This class also subclasses [`GroupMixin`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.GroupMixin "discord.ext.commands.GroupMixin") to provide the functionality to manage commands.
Like a setprefix command?
i don't think that's what he asked for
Well that's the only thing that's revalent with "bot command prefix"
even if they mean custom prefixes , the answer remains same.
with the way he worded it
I am getting this error when my bot tries to delete a message in a server
nextcord.ext.commands.errors.CommandInvokeError: Command raised an exception: Forbidden: 403 Forbidden (error code: 60003): Two factor is required for this operation
i'd imagine he wants to make a prefix on server basis
yeah
you will be needing some database setup for that , and a function which returns the prefix for the command_prefix kwarg
you bot cannot do any moderator actions if you don't have "your" 2fa on
Oh ok
lemme ask the owner of the application to verify
yo. im working on a discord bot, and rn the bot is being made to tell jokes. when a user says !joke i want the bot to say a joke. i have managed to make it say one joke, although i want it to say multiple with a single command, sort of like an RNG to get a joke, there will be 10 and i want a equal chance for each joke to run and make a joke run only once
anyone have any idea how i can manage to do this in my code?
!d discord.Guild.edit
await edit(*, reason=..., name=..., description=..., icon=..., banner=..., splash=..., discovery_splash=..., community=..., region=..., afk_channel=..., owner=..., ...)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Edits the guild.
You must have the [`manage_guild`](https://discordpy.readthedocs.io/en/master/api.html#discord.Permissions.manage_guild "discord.Permissions.manage_guild") permission to edit the guild.
Changed in version 1.4: The rules\_channel and public\_updates\_channel keyword-only parameters were added.
Changed in version 2.0: The discovery\_splash and community keyword-only parameters were added.
Changed in version 2.0: The newly updated guild is returned.
The icon kwarg ^^^
Thats a lot of kwargs
cause it tends to edit a complete server
i am trying to set it to None
like
if the icon is none and after is being changed .. to set it to none
python -u "/home/idontlikegames288/DIscord Project/discordbot.py"
/bin/sh: 1: python: not found
wot dis mean
new to this no bulli
Guild.edit(icon=None)
how to make slash commands
Well first, what lib are you going to use?
How would I make config commands to configure the welcome messages turn it off and other things per guild
can anyone help? i'm trying to add a probability feature to the bot
you need to have 2.0
yes
discord.__version__
print(discord.__version__)
weird that it raised that error
did you use any other libraries like discord_components or something?
for i in client.commands:
print(i)``` stops the bot's execution no error message
its weird if it happens , i dont see anything blocking there
Oh no not discord components
I am using it in on ready btw
it still shouldnt make a change since its not an API request or something related to discord
now?
!d discord.ext.commands.Command
class discord.ext.commands.Command(*args, **kwargs)```
A class that implements the protocol for a bot text command.
These are not created manually, instead they are created via the decorator or functional interface.
The name of the command.
does the bot send the message with the button?
you may try restarting the bot once or twice , and dont print the Cmmand object , print its name..
Tried but the bot don't move forward
is the bot not coming online? or is it just not responding
not responding to the for loop
also not printing a dummy text I placed after the loop





