#discord-bots
1 messages · Page 83 of 1
nice_cube
And you won't be getting conflicts in the future
so i literally cant uninstall and reinstall it
Smh those apple restrictions
have you tried disabling SIP
Okay let's just jailbreak it then. ||joke||
go into recovery mode and type crustil disable in terminal
it turns off protection
/Library/Developer/CommandLineTools/usr/bin/python3 -m pip install --upgrade pip
Defaulting to user installation because normal site-packages is not writeable
Collecting pip
Using cached pip-22.2.2-py3-none-any.whl (2.0 MB)
Installing collected packages: pip
WARNING: The scripts pip, pip3 and pip3.8 are installed in '/Users/bai/Library/Python/3.8/bin' which is not on PATH.
Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
NOTE: The current PATH contains path(s) starting with ~, which may not be expanded by all applications.
Successfully installed pip-22.2.2
ive just updated pip and i run the command again, no work
Do what @faint sapphire said and uninstall the pythons, then install the latest with path checkmark
i didnt say anything ;-;
This
nah...
i arent risking that...
Try this
pip3 install -U discord.py```
this works
mine is
welp, needed to so i can use usb antenna
MacOS comes with it preinstalled, and some applications rely on it
¯_(ツ)_/¯
got any command that i can use to upgrade it?
yo do u know how to get the team identifier of applications on mac?
i know the command to put in shell
How do i make an embed in whilst using slash commands?
I just wouldn’t touch that installation. You can use the python3 and pip3 commands to run using python 3
Well seems like some applications rely on it for no reason so leave it there and just use pip3 or even better venvs
No idea what that means, I don’t use macos
yeah right...
ah ok
Traceback (most recent call last):
File "/Users/bai/Documents/Personal Things/Do not delete/Only viewable by me/Aww Pika Discord Bot/aww pika beta discord bot.py", line 14, in <module>
@bot.tree.command(name="test", description="test slash command")
AttributeError: 'MyBot' object has no attribute 'tree'
from discord.ext import commands
class MyBot(commands.Bot):
def __init__(self) -> None:
super().__init__(command_prefix=">", intents=discord.Intents.default())
async def setup_hook(self) -> None:
await self.tree.sync()
bot = MyBot()
@bot.tree.command(name="test", description="test slash command")
async def test(interaction: discord.Interaction) -> None:
await interaction.response.send_message("true")
bot.run('my token here')```
still having this error
IDLE + PythonLauncher
Super nice
uhm.. so how to fix?
Nevertheless python builtin editor is good for beginners I would recommend using something like visual studio code or pycharm for convenience
Try running the script via the command line python3 your_script.py
it doesnt work on mac
u sure there isnt anything wrong with my script?
I don’t think this has anything to do with your editor. Like the error says, MyBot does not have the attribute ‘tree’
what does this error mean
Exactly what it says
You have discord.py installed for different interpreter
You need to run it with the same
You probably forgot the create the ‘tree’ attribute
wdym
I think app command trees require you create that attribute yourself
In dpy 2.0 it is a property isn't it
Gimme a second
!d discord.ext.commands.Bot.tree
property tree```
The command tree responsible for handling the application commands in this bot.
New in version 2.0.
This example shows defining the tree attribute
They are subclassing Client
nope
this is client, not Bot.
Yes in Bot it's already defined
no what i meant is that they have a terminal, but cant run python scripts..
yes.
You should be able to, with the python3 command
@wicked atlas he just runs the script with the python version the wrong dpy is installed in
maybe my macbook is too old... 😦
or maybe its that i updated to the latest version
im on macos montery...
@slate swan you might want to install at least visual studio code so we can avoid some hell and comfortably use venv, can you install it now
i have it already
Open your project there then
ok
When you do that, open a terminal inside vsc and use python3 -m venv venv
ok
Tell me when you're done
no work
it doesnt show anything
Ok wait a bit more
did you press enter
I'm not sure how to create a for loop, I just know the absolute basic:
nums = [1, 2, 3, 4, 5]
for n in nums:
print (n)
no 😭
Wtf
wait what
Isn't the terminal supposed to be a bit of colored
@slate swan anyway was the folder named venv created in your project
wdym?
In my vsc the first word is always yellow
no
Where are you executing this thing
Why my invoke command raised an error NoneType is not callable
Looks like its open in their user folder
@slate swan and you opened the folder in vsc not the file right?..
ohk, yeah
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/runpy.py", line 197, in _run_module_as_main
return _run_code(code, main_globals, None,
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/runpy.py", line 87, in _run_code
exec(code, run_globals)
File "/Users/bai/.vscode/extensions/ms-python.python-2022.14.0/pythonFiles/lib/python/debugpy/adapter/../../debugpy/launcher/../../debugpy/main.py", line 39, in <module>
cli.main()
File "/Users/bai/.vscode/extensions/ms-python.python-2022.14.0/pythonFiles/lib/python/debugpy/adapter/../../debugpy/launcher/../../debugpy/../debugpy/server/cli.py", line 430, in main
run()
File "/Users/bai/.vscode/extensions/ms-python.python-2022.14.0/pythonFiles/lib/python/debugpy/adapter/../../debugpy/launcher/../../debugpy/../debugpy/server/cli.py", line 284, in run_file
runpy.run_path(target, run_name="main")
File "/Users/bai/.vscode/extensions/ms-python.python-2022.14.0/pythonFiles/lib/python/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_runpy.py", line 321, in run_path
return _run_module_code(code, init_globals, run_name,
File "/Users/bai/.vscode/extensions/ms-python.python-2022.14.0/pythonFiles/lib/python/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_runpy.py", line 135, in _run_module_code
_run_code(code, mod_globals, init_globals,
File "/Users/bai/.vscode/extensions/ms-python.python-2022.14.0/pythonFiles/lib/python/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_runpy.py", line 124, in _run_code
exec(code, run_globals)
File "/Users/bai/Documents/Personal Things/Do not delete/Only viewable by me/Aww Pika Discord Bot/aww pika beta discord bot.py", line 14, in <module>
@bot.tree.command(name="test", description="test slash command")
AttributeError: 'MyBot' object has no attribute 'tree'
@ian-wu Aww Pika Discord Bot % python3 -m venv venv
@ian-wu Aww Pika Discord Bot %
@ian-wu Aww Pika Discord Bot % cd /Users/bai/Documents/Personal\ Things/Do\ not\ delete/Only\ viewable\ by\ me/Aww\ Pika\ Discord\ Bot ; /
usr/bin/env /usr/local/bin/python3 /Users/bai/.vscode/extensions/ms-python.python-2022.14.0/pythonFiles/lib/python/debugpy/adapter/../../de
bugpy/launcher 52857 -- /Users/bai/Documents/Personal\ Things/Do\ not\ delete/Only\ viewable\ by\ me/Aww\ Pika\ Discord\ Bot/aww\ pika\ bet
a\ discord\ bot.py
this error
The living hell
!code
Here's how to format Python code on Discord:
```py
print('Hello world!')
```
These are backticks, not quotes. Check this out if you can't find the backtick key.
You have at least 3 versions of python installed
wdym
I noticed 2.7, 3.7 and 3.9
what-
@slate swan just write py in the terminal
Your PATH is now messed up in terms of python
for the version and when u get '>>>' type exit()
can anyone help? 🙃
no, ig
from ..enums import AppCommandOptionType, AppCommandType, ChannelType, Locale
ModuleNotFoundError: No module named 'discord.enums'
your folder name is discord?
no
no
the lib
it means modified
it says master for me haha
also it's Git...
how do you do an embed in slash 😭
making an embed is the same
oh
you just don't have ctx anymore
ah alright i got it
How can i send something like "Test" if the user picks the #1 and "Test2" If he picks #2 and so on?
hey there
im writing a bot for stable diffusion
using that template on git
anyways i got a cog called sd
the module i use is called txt2img from the modules folder but when i try to import/call it from my cog
discord.app_commands.errors.CommandInvokeError: Command 'ddim' raised an exception: TypeError: 'module' object is not callable
well that flopped
Hey @dire grove!
It looks like you tried to attach a Python file - please use a code-pasting service such as https://paste.pythondiscord.com
!D discord.ext.tasks.loop
@discord.ext.tasks.loop(*, seconds=..., minutes=..., hours=..., time=..., count=None, reconnect=True)```
A decorator that schedules a task in the background for you with optional reconnect logic. The decorator returns a [`Loop`](https://discordpy.readthedocs.io/en/latest/ext/tasks/index.html#discord.ext.tasks.Loop "discord.ext.tasks.Loop").
ok ty
@discord.ext.tasks.loop(seconds=10)
AttributeError: module 'discord.ext' has no attribute 'tasks'
Import issue
now i get this
RuntimeError: no running event loop
sys:1: RuntimeWarning: coroutine 'Loop._loop' was never awaited
i'm trying to use discum for member scraping but it says module not found even tho i installed it from the discum repo
i also tried installing it with pip but same result
Why
Why not just iter over discord.Guild.members
Read the code you wrote very carefully
💀
I swear everyone in this channel are half trained gpt models
xD
im learning python, and not a pro brah
await ctx.send(error)
.?

So why the heck are you printing it?
So that if there is another error, It will raise it in the terminal
How do I force send_group_help on a command group's main command?
@quaint epoch
What are you trying to do?
error handling
if missing a role send error msg, else print error
And that doesn't work?
?
its supposed to print when there is another error
!code
Here's how to format Python code on Discord:
```py
print('Hello world!')
```
These are backticks, not quotes. Check this out if you can't find the backtick key.
Aha okay
Ex. If there is another error which aint specified, it'll print it
Try to send code in these code blocks 
dw bro is using images of my code
Sometimes the images are small or blurry, or you want to copy the code to see what's going on
Crystal Clear
In this case, yes
Not sure, but did you create that error message yourself?
erm wdym?
bro, print the type of the error and debug
its from a slash command, why would the error be from discord.ext.commands
🗿
!d discord.app_commands.MissingAnyRole
exception discord.app_commands.MissingAnyRole(missing_roles)```
An exception raised when the command invoker lacks any of the roles specified to run a command.
This inherits from [`CheckFailure`](https://discordpy.readthedocs.io/en/latest/interactions/api.html#discord.app_commands.CheckFailure "discord.app_commands.CheckFailure").
New in version 2.0.
find the disnake equivalent of that and use
no
i've used both, i see no difference inn disnake

How do you guys creating a command for discord.py?
- namespaces
- abstractions for recent endpoints
- new features
Because its a fork it doesnt mean its exactly the same?
hi, exceptions don't show up anymore in my terminal
I love how their's a note saying to pass the message_content intent into the bot initializer but they never show it in the outdated examples kek
lol
void
noid()
{
}
google ver better😏
!d discord.utils.format_dt
discord.utils.format_dt(dt, /, style=None)```
A helper function to format a [`datetime.datetime`](https://docs.python.org/3/library/datetime.html#datetime.datetime "(in Python v3.10)") for presentation within Discord.
This allows for a locale-independent way of presenting data using Discord specific Markdown...
The command works but discord shows me this? Theres no error in the console
From my experience, Discord does this when the bot doesn't send a Interaction Response back
An interaction is marked as "Failed", if not responded to.
i need help, i tried to run my bot after a long time, but the commands are no working
i get no errors
enable message_content intent in the dev portal and in your code
bruh no
!d discord.InteractionResponse.defer
await defer(*, ephemeral=False, thinking=False)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Defers the interaction response.
This is typically used when the interaction is acknowledged and a secondary action will be done later.
This is only supported with the following interaction types...
are there any bot growth servers or any servers i can add my bot to for member count? i have 45k rn
does anyone know why this keeps happening? my bot doesnt do anything like raid, it just does commands stuff
thats common for replit hosting
are there any ways to fix it? about a year ago when i made replit bots it was fine
some people say you can type kill 1 in the shell as a temporary fix
can someone help me with this?
!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 Members, Message Content, and Presences. These are needed for features such as on_member events, to get access to message content, 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.
note that message_content is one of those privileged intents so you want to enable that if you want your bot to properly read messages
thanks for telling me lol
Np xD
anotehr question, how do I put the message authors avatar in the set_author thing?
avatar returns an Asset
!d discord.Asset.url
property url```
Returns the underlying URL of the asset.
uh how do i fix that
^
do i do icon=message.author.avatar instead?
What?
embed.set_author(name=str(message.author), icon_url=message.author.avatar_url) thats the code thats not working
it says discord members dont have the attribute avatar_url
Its just message.author.avatar.url? reading given info is quite helpful for yourself you know
If you're a beginner i would recommend you look at this message ⬇️ #discord-bots message
Then he has no avatar
is there a way to put the avatar even if its a default
!d discord.Member.display_avatar
property display_avatar```
Returns the member’s display avatar.
For regular members this is just their avatar, but if they have a guild specific avatar then that is returned instead.
New in version 2.0.
oh tyty
I would recommend you dont use replit aswell, if you're trying to dodge future problems
idk anything else to use thats free
Localhost?
im not sure why this is not working unless there is another way to send the message that I am not seeing, it sends messages to the game with this message scheduler bot im using but not my custom discord bot even though it sees the message....
Here is my code:
if message.author.id == 1005924637147922546:
if message.content.startswith('Xerp:'):
if ComPrefix + 'test' in GameCommand:
await message.channel.send('Test Passed all Checks, Hello Admin')
return
if ComPrefix + 'test' in GameCommand:
await message.channel.send('Test Passed all Checks, Hello User')
return
hc = await cursor.execute(f"SELECT HCID FROM hc WHERE ID = ?", (interaction.guild.id,))
#use placeholders
hcid = (await cursor.fetchone())[0]
#im assuming you're using the async version of sqlite in which case you need to await and for both versions, the result would be a tuple so you'd need to choose the first value in the tuple
RuntimeError: Timeout context manager should be used inside a tas
Why do I get this error when trying to run both flask and discordpy, trying to run a discordpy func with bot.loop.create_task
I'm working with embeds and I'm trying to get something like this on discord.py, but I can't figure out how to make it so "tight". The example wasn't made on discord.py so I'm not too sure it's even possible
This is a field with a value with \n seperating each line
endl 😕
Can someone help me with this? Basically I am making a snake game on discord, and I plan to edit the message every 1.5 seconds, (the delay is changable)
My only problem is if I do:
while self.lost is False:
time.sleep(self.delay)
await self.move()
the problem is it halts the buttons
I tried threading but honestly it wont work for an async function
I tried using asyncio.run but it didn't work
so now I'm stuck.
# Protocol
async def protocol(self) -> None:
pass
# Update direction
async def update_direction(self, direction: str) -> None:
# Guardian statements
if self.check_direction(direction) is False:
return None
self.direction = direction
if self.started is False:
self.started = True
# Move
Those are the ones we have to worry about
I'm not sure what to do for protocol(the function that makes it move every 1.5 seconds)
!d asyncio.sleep
and update_direction is the one that should trigger protocol, again the error is that it will halt the buttons if I don't thread it.
coroutine asyncio.sleep(delay, result=None)```
Block for *delay* seconds.
If *result* is provided, it is returned to the caller when the coroutine completes.
`sleep()` always suspends the current task, allowing other tasks to run.
Setting the delay to 0 provides an optimized path to allow other tasks to run. This can be used by long-running functions to avoid blocking the event loop for the full duration of the function call.
Deprecated since version 3.8, removed in version 3.10: The `loop` parameter. This function has been implicitly getting the current running loop since 3.7. See [What’s New in 3.10’s Removed section](https://docs.python.org/3/whatsnew/3.10.html#whatsnew310-removed) for more information.
Example of coroutine displaying the current date every second for 5 seconds:
hm
Don't try to say you un-ironically use endl
IT WORKS, OH MY GOSH I WANT TO KISS YOU
The only problem is that the buttons do halt for the first 4 movements and then they work again, do you know how to fix it?
@discord.ui.button(label = 'Left', style = discord.ButtonStyle.blurple, custom_id = 'Left')
async def Left(self, interaction: discord.Interaction, button: discord.ui.Button):
game = OCCUPIED['OWNERS'].get(interaction.user.id, None)
if game is None:
return None
else:
if OCCUPIED['OWNERS'][interaction.user.id].instance.id == interaction.message.id:
await OCCUPIED['OWNERS'][interaction.user.id].update_direction('left')
await interaction.response.defer()
thats one function
How you know😏
🤨 📸
am i missing anything?
Elaborate, You can also use
if not condition:
...
As dict.get's default return value is always None so you dont need to specify it either and follow function naming by using snake_case!
Okay, I'll use snake case from now on 😦
Okay but this is my NEW problem, IT WORKS ALMOST PERFECTLY
Only in functions and variables though!
Okay!
When I click a button for the first time, what happens is that all the buttons are disabled for a few seconds, is there any reason why?
Like they dont respond or they actually get disabled?
I'm pretty sure that only happens when you defer the interaction 😅
oh
I add that because @primal token it says that it doesn't respond, but let me see if that is still the cas.e
still happens:
Ignoring exception in view <Button timeout=None children=4> for item <Button style=<ButtonStyle.primary: 1> url=None disabled=False label='Right' emoji=None row=None>
Can you send the entire traceback?
I will in 5 minutes, sorry I am eating
bon appetit
[2022-09-13 16:47:35] [ERROR ] discord.ui.view: Ignoring exception in view <Button timeout=None children=4> for item <Button style=<ButtonStyle.primary: 1> url=None disabled=False label='Right' emoji=None row=None> Traceback (most recent call last): File "C:\Users\toplo\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\discord\ui\view.py", line 425, in _scheduled_task await item.callback(interaction) File "c:\Users\toplo\OneDrive\Documents\GitHub\Arcade-5.0\main.py", line 90, in Right await OCCUPIED['OWNERS'][interaction.user.id].update_direction('right') File "c:\Users\toplo\OneDrive\Documents\GitHub\Arcade-5.0\main.py", line 222, in update_direction await self.protocol() File "c:\Users\toplo\OneDrive\Documents\GitHub\Arcade-5.0\main.py", line 208, in protocol await self.move() File "c:\Users\toplo\OneDrive\Documents\GitHub\Arcade-5.0\main.py", line 235, in move self.update_board() File "c:\Users\toplo\OneDrive\Documents\GitHub\Arcade-5.0\main.py", line 163, in update_board self.board[self.head[0]][self.head[1]] = '😳' IndexError: list assignment index out of range
the out of range is okay, i didnt add loss detection yet.
!e
print([][0])
@primal token :x: Your 3.11 eval job has completed with return code 1.
001 | Traceback (most recent call last):
002 | File "<string>", line 1, in <module>
003 | IndexError: list index out of range
I know but I still think that this error doesnt cause the buttons to disable, unless it does?
If the button doesnt respond the buttons cant be clicked so its probably the buttons getting deffered or the error which makes your bot go offline
So does anyone know. Is there a different way to send this message? #discord-bots message
Okay, do you know how i can fix it?
I know it's out of range...
let me add loss detection.
async def move(self) -> None:
y, x = self.DIRECTIONS.get(self.direction, (0, 0))
self.head = (self.head[0] + y, self.head[1] + x)
if self.head == self.apple:
self.body.insert(len(self.body) - 1, self.previous_head)
self.generate_apple()
self.body.insert(0, self.previous_head)
previous_body = self.body.pop()
self.board[previous_body[0]][previous_body[1]] = ':black_medium_square:'
self.previous_head = self.head
self.update_board()
await self.post(edit = True)
this is my move function.
I'ma take a break.
yoo guys whats up im getting a KeyError for my guild id, basically saying it’s invalid or something but its not?
Errors don't lie
i right clicked and copied id though
Revise your code, Python's interpreter doesn't lie! ~~IndexError: You're a loser 😔 ~~
wtv
keyerror from what? what's supposed to be storing these guild ids, where does it get these from (did you set these?), where did you get yours from, are they the same type
you really need to give more info than just that
i really have no idea what any of that means, i just bought the bot and neither me or the seller know how to fix.
Ignoring exception in on_connect
Traceback (most recent call last):
File "C:\Python310\lib\site-packages\discord\client.py", line 352, in _run_event
await coro(*args, **kwargs)
File "C:\Python310\lib\site-packages\discord\bot.py", line 793, in on_connect
await self.register_commands()
File "C:\Python310\lib\site-packages\discord\bot.py", line 338, in register_commands
to_update = update_guild_commands[guild_id]
KeyError: '1019415471696654436'```
thats what it says though
okay, wdym "your guild id"
server id
why are you using on_connect anyway
can you send your whole code
yea in dms
!paste
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.
is that ok?
why not here
cuz i bought it i dont want everyone to
ok sure ig
alright let me start my pc
can u add back
If you still haven’t noticed. that’s not his code, that’s an internal listener.
notice the location in the error
yeah i noticed when he sent it, just confusing how he says "my guild id"
anyways, @slate swan I cant help with forks of dpy
probably something to do with types, ids are ints
looks like youre passing strings
whats an internal listener?
and what is a fork of dpy
just internal code of Bot
and no shit i said i bought the bot
bruh
as in not part of your code, part of the library's code
so right now I have essentially just
if len(voice_state.channel.members) == 1:```
to detect if there's only 1 user (the bot) in a vc, problem is its disconnecting if **any** channel has 1 member, what would I use to detect only the channel the bot is in
that message wasn’t even for you. :/
oh so then there is no fix?
or like what do i do
Not exactly, More like a namespace that gets bounded to your bot and internally called
🤔
A fork is a repo that may derive main's or a forked branch's code. A dpy fork is just a fork/instance of the discord.py library with different abstractions depending on the endpoints we're talking about.
TL;DR A different irregular instance
oh ok, so what are my options here? i dont know anything about coding really and everyone ive asked doesnt know how to fix.
should i try to get a refund from the seller?
If you dont mind, we can also try and troubleshoot it, if it all doesnt work/go well or you make up your mind, you may refund the order.
So, how does that sound?
As I said it's to do with how the id is passed
Str vs int
You're passing it as a str
🍿
I don't know how pycord or whatevrt works but it should probably be an int
idk how to do that
if either of u know how, i’d be willing to pay u to do it?
Well, it looks like chrispy already has the solution so if he can, he can continue helping you with that matter, if not you can refer to me.
sounds good
can u guide me on how to change?
Not really seeing as you don't know much about coding
We are volunteers! No need. Also if your bot was made in pycord i would honestly refund the order and contact a volunteer that can do it well and for FREE!
I didnt quite saw it so i cant have an opinion on that matter, but how bad was it?
json as a db, blocking code, weird ass raw api requests for some reason???
i dont think he’d give me a refund tbh
Sad, But HTTP requests arent odd, but making HTTP requests to the discord REST API is weird as any fork that was probably being used has covered most endpoints and has the abstractions to convert the objects etc
What platform and how much was it if you dont mind me asking?
also not using aiohttp or some other async requests
and other weird stuff in general
it was $25, and from someone directly
😬
Thats sad, a waste of 25 dollars, as some volunteers here can make a decent bot for free
the thing is, im sure the bot is frowned upon
"decent", i wouldnt call all of them good
in terms of discord tos
If its not following TOS we can help with that but you still probably couldve found someone
i doubt people would make a whole bot for free, more just help with whatever problems you're having in the process
its a bot that sends boosts to a server from nitro tokens. idk if its allowed or not
Well, i'm not sure as some people have: "Bot dev😎" or "Can make you a good discord bot for free" in their bio/user description
if you know how to fix, could i pay u to do it?
Not sure what you refer to that
wdym
I'm not familiar with whatever fork you're using
I have given you very clear pointers though-
also i’d like to point out that im the only person experiencing this issue, other people use the same code but they dont have issues
so could it be something with my user or bot settings?
...
That whole code is garbage from what chrispy has said to me, so i wouldnt take the feedback of other people that dont know what the source code does/works
Can you at least try
I've said what I think the issue is
And I'm confident it's correct
Well go deal with source whoever made this for you then
I'd help if you were able to learn from this, but you don't even know python
im saying the code is something ppl buy from him and use on their own, so there is plenty of ppl that use it but im the only one with this issue
I understand, but my point still stands.
alright well thanks for the help guys
If you actually want to solve your issue and not let your money go to waste, please refer to this: #❓|how-to-get-help
i will ty
How do I stop my button from saying "Interaction failed"
class Button(discord.ui.View):
def __init__(self) -> None:
super().__init__(timeout = None)
# Left
@discord.ui.button(label = 'Left', style = discord.ButtonStyle.blurple, custom_id = 'Left')
async def Left(self, interaction: discord.Interaction, button: discord.ui.Button):
game = OCCUPIED['OWNERS'].get(interaction.user.id, None)
if game is None:
return None
else:
if OCCUPIED['OWNERS'][interaction.user.id].instance.id == interaction.message.id:
await OCCUPIED['OWNERS'][interaction.user.id].update_direction('left')
await interaction.response.defer()
# Up
@discord.ui.button(label = 'Up', style = discord.ButtonStyle.blurple, custom_id = 'Up')
async def Up(self, interaction: discord.Interaction, button: discord.ui.Button):
game = OCCUPIED['OWNERS'].get(interaction.user.id, None)
if game is None:
return None
else:
if OCCUPIED['OWNERS'][interaction.user.id].instance.id == interaction.message.id:
await OCCUPIED['OWNERS'][interaction.user.id].update_direction('up')
await interaction.response.defer()
# Down
@discord.ui.button(label = 'Down', style = discord.ButtonStyle.blurple, custom_id = 'Down')
async def Down(self, interaction: discord.Interaction, button: discord.ui.Button):
game = OCCUPIED['OWNERS'].get(interaction.user.id, None)
if game is None:
return None
else:
if OCCUPIED['OWNERS'][interaction.user.id].instance.id == interaction.message.id:
await OCCUPIED['OWNERS'][interaction.user.id].update_direction('down')
await interaction.response.defer()
When I click the button for the first time, it disables every button for like 3 seconds, says Interaction failed
But every button after that works perfectly. Is there any way to fix this?
read that wrong my b
Why did you delete? Oh.
its saying interaction failed because its not responding i believe
doesnt the defer tak ecar eof that?
i see that it might, i have yet to play with buttons x)
You only have 3 seconds to respond to the interaction, that could be the reason if you don't get any errors?
huh?
Your code could be taking more than 3 seconds from the button press to load to send a message
What doo you recommend i do about it?
Do you want to send a message?
Hm, I've never seen it work without sending a message... I would recommend you just send the message and make it ephmeral
But again, I've never tried without a message.
Hello
I've done as this asked, but I still get the TypeError: Client.__init__() missing 1 required keyword-only argument: 'intents' error.
Any ideas, please?
woudlnt that spam chat?
its a snake game
It may, let me test something really quick
Alright.
!intents
No offense but did you read my message?
Do you have an on_error? @slate swan
no.
@discord.ui.button(label='Eeek', style=discord.ButtonStyle.grey, custom_id='persistent_view:afhnjka')
async def eeek(self, interaction: discord.Interaction, button: discord.ui.Button):
print('pp')
await interaction.response.defer()``` Works fine for me
hm
It's most likely taking more than 3 seconds
Just read it, no offense but it seems you didnt read the one given as you never passed the Intents object
You can maybe try to put some print('#1') in the code to see where it breaks too
not the pp debug😭
i'm guessing this is what the issue is
Ahh, that makes sense
No, you might want to send a response if game is None
or something similar
you attractive handsome man.
sorry i just got this new tool, i love using it to teach
Please explain. I'll happily take a help channel for this.
👀
As it may get a bit too much for this channel.
Do what the code block shows! depending on what intents you're using!
intents=intents heh
what windows snipping tool kek
This is what I'm trying to say, i did what is in the bloody code block. 😭
You never passes it into the initializer thought 
Trying to follow this:
https://realpython.com/how-to-make-a-discord-bot-python/
And I came across the intents issue when trying to turn the bot on.
@sick birch does no twork 😦
no error.
nveermind it does error:
Traceback (most recent call last):
File "C:\Users\toplo\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\discord\ui\view.py", line 425, in _scheduled_task
await item.callback(interaction)
File "c:\Users\toplo\OneDrive\Documents\GitHub\Arcade-5.0\main.py", line 75, in Down
await interaction.response.defer()
File "C:\Users\toplo\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\discord\interactions.py", line 592, in defer
await adapter.create_interaction_response(
File "C:\Users\toplo\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\discord\webhook\async_.py", line 219, in request
raise NotFound(response, data)
discord.errors.NotFound: 404 Not Found (error code: 10062): Unknown interaction```
is it the await interaction.response.defer()
I need the defer
Its literally just...
ITS JUST THAT ONE FIRST BUTTON PRESS, after, the same button and every other button work
I dn't get it.
God kill me
discord.errors.NotFound: 404 Not Found (error code: 10062): Unknown interaction
I'ma brb.
GUYS I FOUND THE BUG
I FOUND THE BUG I FOUND THE BUG AFTER ADDUNG PRINTS, IT SEEMS LIKE THE FIRST BUTTON PRESS DOES NOT ACTUALLY TRIGGER ANYTHING
it only prints on the second time WHICH MEANS SOMETHING IS OFF
game = OCCUPIED['OWNERS'].get(interaction.user.id, None)
if game is None:
await interaction.response.send_message('You have no game instance constructed.', ephemeral = True)
else:
if OCCUPIED['OWNERS'][interaction.user.id].instance.id == interaction.message.id:
await OCCUPIED['OWNERS'][interaction.user.id].update_direction('left')
await interaction.response.defer()
print('pressed')
something here... I just don't know
specifically the bottom part below the else
if you've already done the first step of enabling the privileged intents you want in the developer portal, the last step is telling your code what intents it should ask for when it will later log into discord
Hi, managed to fix this issue but I ran into a different one, currently in a help channel, ty nonetheless <3
aight cool
what is wrong 😦
I could use your help in #help-falafel if you have the time, if not it's okay!
em.set_footer(icon_url = ctx.author.avatar_url, text=f"Requested by {ctx.author.name}")
AttributeError: 'Member' object has no attribute 'avatar_url'
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/discord/bot.py", line 1009, in invoke_application_command
await ctx.command.invoke(ctx)
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/discord/commands/core.py", line 359, in invoke
await injected(ctx)
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/discord/commands/core.py", line 135, in wrapped
raise ApplicationCommandInvokeError(exc) from exc
discord.errors.ApplicationCommandInvokeError: Application Command raised an exception: AttributeError: 'Member' object has no attribute 'avatar_url'
async def on_command_error(ctx, error):
if isinstance(error, commands.CommandOnCooldown):
em = discord.Embed(title=f"Hey, please slow it down!", description=f"Try again in {error.retry_after:.2f}s")
await ctx.respond(embed=em)
@bot.slash_command(name="randomgif", description="Gets a random GIF from Giphy!")
@commands.cooldown(1, 15, commands.BucketType.user)
async def giphy(ctx) -> None:
async with aiohttp.ClientSession() as cs:
async with cs.get(f"https://api.giphy.com/v1/gifs/random?api_key=api keyg=g") as r:
res = await r.json()
em = discord.Embed(title="Giphy Gif!")
em.set_image(url=res['data']['images']['original']['url'])
em.set_footer(icon_url = ctx.author.avatar_url, text=f"Requested by {ctx.author.name}")
await ctx.respond(embed=em)```
heres the code
it works when i use bot commands, but slash command no work
oh
pycord? 😭
k
b
nailed it
heh
Code:
File "c:\Users\xrkzl\OneDrive\Desktop\The ASS\main.py", line 32, in <module>
settings = json.load(open("settings.json", encoding="utf-8"))
File "C:\Program Files\Python310\lib\json\__init__.py", line 293, in load
return loads(fp.read(),
File "C:\Program Files\Python310\lib\json\__init__.py", line 346, in loads
return _default_decoder.decode(s)
File "C:\Program Files\Python310\lib\json\decoder.py", line 337, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "C:\Program Files\Python310\lib\json\decoder.py", line 353, in raw_decode
obj, end = self.scan_once(s, idx)
json.decoder.JSONDecodeError: Expecting property name enclosed in double quotes: line 2 column 34 (char 35)
ctx.author.avatar
!d discord.Member.display_avatar
property display_avatar```
Returns the member’s display avatar.
For regular members this is just their avatar, but if they have a guild specific avatar then that is returned instead.
New in version 2.0.
so in a command of my bot, i added a select menu, and in that i added options using a for loop, so, any way i can add response of those options using for loop too? help
What
How do i get it to only show to one person?
(someone elses bot for referance)
1min
This chat is meant for discord bot help ?? Why open that ?
And or chatting
oh
add ephemeral=True to interaction response
Where would I add that, here's code
if not staff(ctx):
await ctx.respond("Missing Perms")
else:
(continue code)
okay xd
Thanks though <3
Np :D
since when is interaction.respond a thing?
tbh interaction.response is weird too
How dpy handled slash commands feels a lot like how classes are handled in Java
i have added options to a select menu using for loops, is it possible to add interactions for every options using loops too, or have my bot respond diffrent msgs to each of those options? help
just made my first discord bot :))
is there a way to convert a member object to a string so i can replace parts of it?
message.author gives me Rosy#2503, but i cant do .replace("#", '') on it since member object has no attribute replace
just use Member parameters 
discord.Member.name returns the member name
discord.Member.nick returns the member specific nickname for that guild
discord.Member.discriminator returns the member discriminator, as a string since it can be a string too
membername = message.author.name + message.author.discriminator
if discord.utils.get(guild.channels, name=membername.lower()):
await message.channel.send(
"You are already the host of a private channel, pleaes delete it before creating a new private channel.")
return
tyty <3
what if someone changes the channel name 🧍
I wanna make a dashboard for my bot.
Is there is something that I should learn before getting started?
And I know pretty advance html and Javascript
Maybe learn a good js framework?
my friend is doing the css for me
Any good js framework will make your site more good and give good user experience
Btw I don't have any Idea how to start it
from where should I start?
or start learning stuff
I would recommend to learn react and learn concept to make login for discord account on your site
I can't tell much as i never did this
hmm... interesting
But i have a mid knowledge about react
Are there any documentations that I should read?
You can use Django for the backend, so you will have a better interface between the website and the bot
Idk
If want to learn react see YouTube
unfortunately there aren't a lot of tutorials for those kind of stuff
Why am I getting this error guys?
I don't have such file
client.py is from discord.py
lmao sorry, that traceback is handled somewhere? it is not the full traceback
I forgot a lot of python and discord.py as i moved to js
😦
import discord
from discord.ext import commands
import json
class botclass(commands.Bot):
def __init__(self):
super().__init__(command_prefix=">",help_command=None,intents=discord.Intents.all())
def on_ready(self):
print("i am ready")
bot = botclass()
I have this short code
on_ready is a coroutine, it is a method from Bot, so it is async def on_ready()
Oh k
if you want you can check on this https://github.com/Tvrsier/BaseBot
Base bot setup for discord.py and relative forks. Contribute to Tvrsier/BaseBot development by creating an account on GitHub.
Btw
I have one question
How we can should our python packages details on GitHub readme?
?
Does anyone know if discord supports taking a date as an app_command input? Like, with a date-selection menu?
Or should I like, take as input ranges of months (or enums) and days? But what about different days in a month? Should I just report the mistake to the user?
Yo who can explain this 
append returns None. The addition is in-place
!e
somelist = [1, 2]
ret_value = somelist.append(3)
print(ret_value)
print(somelist)
@agile lark :white_check_mark: Your 3.11 eval job has completed with return code 0.
001 | None
002 | [1, 2, 3]
so i have to make two lines to add an element lmao
bruh my python knowledge is quite good tbh
Sending the full error message helps
Nice, @placid skiff very nice 👏👏👏

You totally didn't make a joke out of yourself
Bro yesterday i had to regress a Java code from the last version to Java 5, my mind literally blew up
I couldn't even use lists, i had to declare sized arrays but i needed dynamically arrays, so i had to do a sort of workaround and i felt like i was back to coding in C in my first year of high school
async def send_message():
#partnership001
channel = bot.get_channel(971319808719212555)
with open('/Users/bai/Documents/Personal Things/PythonDiscord/Partnerships/partnership001.txt', 'r') as f:
msg = f.read()
await channel.send(msg)
await asyncio.sleep(10)```
error:
```Unhandled exception in internal background task 'send_message'.
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/discord/ext/tasks/__init__.py", line 176, in _loop
await self.coro(*args, **kwargs)
File "/Users/bai/Documents/aww pika discord bot v2.py", line 23, in send_message
await channel.send(msg)
AttributeError: 'NoneType' object has no attribute 'send'```
im using pycord, why does this not work?
most methods in mutable datatypes, like list and dict are inplace.
where as any operation on string, like str.strip will return a new string because its immutable
get_channel tries to get the channel from the bot's cache, if it is not present, it returns None
in the case its not present in the cache, you should try to fetch it
so await fetch_channel(id)
thanks
!e ```py
a = "a,b,c,d,e"
print(a.split(",") + ["f"])
@pliant gulch :white_check_mark: Your 3.11 eval job has completed with return code 0.
['a', 'b', 'c', 'd', 'e', 'f']
yup i found that out, thanks anyway xD
please help here
I'm assuming you meant m.author, on a side note, I have not touched discord bots for a long time
Change message.author to ctx.author
if you're having NameErrors you really should make sure you know python
what has this become
before any questions are asked: yes, the bot is in the guild I mentioned
yes, both IDs are correct
Is this in a command?
Make sure the cache is ready
!d discord.ext.commands.Bot.wait_until_ready
await wait_until_ready()```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Waits until the client’s internal cache is all ready.
Warning
Calling this inside [`setup_hook()`](https://discordpy.readthedocs.io/en/latest/ext/commands/api.html#discord.ext.commands.Bot.setup_hook "discord.ext.commands.Bot.setup_hook") can lead to a deadlock.
now that I think about it, it isn't
would that be a problem?
since I'm using asyncio, I can't put my functions inside a command nor an event
that's why I'm not using a command
What do you mean by this
It doesn't need to be in a command. The requirement is that the cache needs to be ready
You can call this to block till the cache is ready
i'm not in an async context though
asyncio.run() won't work in a command or event
for a reason I haven't understood yet
Why are you using asyncio.run though
So you're in a normal function?
Can the function be made async?
you use asyncio.run to run coroutines when you are not inside a coroutine.
meaning await can easily replace asyncio.run (inside a coroutine)?
asyncio.run should only be called once, to start an event loop and run some coroutine
Inside coroutines you should use await or create_task
wait guys I think I might be the biggest idiot on the earth
cause I was so focused on trying to use asyncio.run that I forgot await was a thing
let me see if this is true
let me test it rq
i saw that you can host discord bots on cloudflare in these docs
https://discord.com/developers/docs/tutorials/hosting-on-cloudflare-workers
is this just a java discord bot feature?
Integrate your service with Discord — whether it's a bot or a game or whatever your wildest imagination can come up with.
Thanks for blasting my brain
And you haven't code it, imagine how i was
'It is decidedly so',
'Without a doubt',
'Yes, definitely',
'You may rely on it',
'As I see it, yes',
'Most likely',
'Outlook good',
'Yes, signs point to yes',
'Dont count on it',
'My reply is no',
'My sources say no',
'Very doubtful',
'Reply hazy, try again',
'Ask again later',
'Better not tell you now',
'Cannot predict now',
'Concentrate and ask again']
@bot.slash_command(name="8ball", description="8ball command")
@commands.cooldown(1, 10, commands.BucketType.user)
async def 8ball(ctx):
ctx : ApplicationContext,
question: Option(str,
required=True)
):
if question == anything:
await ctx.respond(random.choice(8ball))```
how should i make this slash command? for it to work
wdym
Lmao Application in d.py is some real shit, maybe with interaction.original_response.edit() you can edit the message
read those points.....
oh ok
eightball = ['It is certain',
'It is decidedly so',
'Without a doubt',
'Yes, definitely',
'You may rely on it',
'As I see it, yes',
'Most likely',
'Outlook good',
'Yes, signs point to yes',
'Dont count on it',
'My reply is no',
'My sources say no',
'Very doubtful',
'Reply hazy, try again',
'Ask again later',
'Better not tell you now',
'Cannot predict now',
'Concentrate and ask again']
@bot.slash_command(name="8ball", description="8ball command")
@commands.cooldown(1, 10, commands.BucketType.user)
async def 8ball(ctx):
ctx : ApplicationContext,
question: Option(str,
required=True)
):
if question == anything:
await ctx.respond(random.choice(eightball))
how should i make this slash command? for it to work
changed it
those rules apply for naming any identifiers i.e classes, functions, variables, etc
Why do you even need to write this
@bot.slash_command(name="8ball", description="8ball command")
@commands.cooldown(1, 10, commands.BucketType.user)
async def 8ball(ctx):
ctx : ApplicationContext,
question: Option(str,
required=True)
):
if question == anything:
await ctx.respond(random.choice(eightball))
what is this?
What is that condition for
then how im supposed to write it
Just reply without any conditions
def function(arg1, arg2)
not
def function(arg1):
arg1: type
arg2: type
i wanna make something like this
?
Did you look at your function? That is not correct syntax.
thats why im asking cuz i dont know how 😦
you should should be familiar with the basics before you start making bots, its not a beginner friendly.
thanks.
Code:
async def send_message():
#partnership001
channel = bot.get_channel(971319808719212555)
with open("/Users/bai/Documents/Personal Things/PythonDiscord/Partnerships/partnership001.txt", "r") as f:
msg = f.read()
await channel.send(msg)
await asyncio.sleep(10)```
error:
```Unhandled exception in internal background task 'send_message'.
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/discord/ext/tasks/__init__.py", line 176, in _loop
await self.coro(*args, **kwargs)
File "/Users/bai/Documents/aww pika discord bot v2.py", line 23, in send_message
await channel.send(msg)
AttributeError: 'NoneType' object has no attribute 'send'```
how to fix
Make sure the channel with ID 971319808719212555 exists, your bot is in the server where this channel is in and that the bot has permissions to view it.
If everything is good, try fetching the channel (await bot.fetch_channel(id))
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/discord/ext/tasks/__init__.py", line 176, in _loop
await self.coro(*args, **kwargs)
File "/Users/bai/Documents/aww pika discord bot v2.py", line 23, in send_message
await channel.send(msg)
TypeError: can't send non-None value to a just-started coroutine```
new error
Does await command() exist in discord py
@tasks.loop(minutes=120)
async def send_message():
#partnership001
channel = bot.fetch_channel(971319808719212555)
with open("/Users/bai/Documents/Personal Things/PythonDiscord/Partnerships/partnership001.txt", "r") as f:
msg = f.read()
await channel.send(msg)
await asyncio.sleep(10)```
the code is already changed and this error
it does, it's not part of dpy btw, it's just a call of a function
Cuz I don’t know how to use invoke
await invoke(command, /, *args, **kwargs)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Calls a command with the arguments given.
This is useful if you want to just call the callback that a [`Command`](https://discordpy.readthedocs.io/en/latest/ext/commands/api.html#discord.ext.commands.Command "discord.ext.commands.Command") holds internally.
Note
This does not handle converters, checks, cooldowns, pre-invoke, or after-invoke hooks in any matter. It calls the internal callback directly as-if it was a regular function.
You must take care in passing the proper arguments when using this function...
It always says NonType is not callable
your file is something weird
what's in it?
i mean the txt file
oh no thats not a file problem
then what is it
you just didnt await fetch for some reason
yes?
What to fill in ‘/‘ in the syntax
no..
File "/Users/bai/Documents/aww pika discord bot v2.py", line 20, in send_message
channel = await bot.fetch_channel(971319808719212555)
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/discord/client.py", line 1619, in fetch_channel
data = await self.http.get_channel(channel_id)
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/discord/http.py", line 353, in request
raise Forbidden(response, data)
discord.errors.Forbidden: 403 Forbidden (error code: 50001): Missing Access
your bot doesnt have perms to fetch the channel, it probably doesnt have perms to view it, otherwise idk
oh
So I did await ctx.invoke(command = ‘TheCommandName’)
The command has no arg required
And it says NoneType not callable
The command it tries to invoke is used to create and print an embedded message
!d discord.ext.commands.Context.invoke
await invoke(command, /, *args, **kwargs)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Calls a command with the arguments given.
This is useful if you want to just call the callback that a [`Command`](https://discordpy.readthedocs.io/en/latest/ext/commands/api.html#discord.ext.commands.Command "discord.ext.commands.Command") holds internally.
Note
This does not handle converters, checks, cooldowns, pre-invoke, or after-invoke hooks in any matter. It calls the internal callback directly as-if it was a regular function.
You must take care in passing the proper arguments when using this function...
command is not a kwarg, so you dont need to do command =
invoke needs a command object, not the command name
and 
just invoke(‘commandname’)?
read 3rd last message
Sorry but I just don’t understand kwarg…
you already undestood that you need to remove command = , I'm about black's message
My bad
args and kwargs are just the arguments of the command, if the command has arguments, you can pass them by positional (*args, so the first one will be the first arg declared) or as keyword (**kwargs, you will set the argument with the key of the argument and assign it to a value arg_1 = "something")
It has no arg, it is async def CommandName(ctx)
then neither args or kwargs are needed
But if ‘/‘ is nothing, why it appears as an arg in invoke command
Fact too…
/ only tells that the previous argument(s) is/are positional and cannot be invoked as a keyword argument
def foo(uwu: str, /):
print(uwu)
''' can be invoked through foo("uwu") '''
''' cannot be invoked through foo(uwu="uwu")'''
Thanks ashley 

lemme check if i still have my free nitro
ill give you if i do
Last question, I use invoke as interaction response, and when the invoke was successfully executed, the select option still showed interaction failed
it expired :bruhness:
I mean that's so kind but free nitro 💀 ok master
sad
Thanks
whats wrong
i think u deserve it
no wait I though that was a joke
lmao no
I don't have a free nitro, but i have a free xbox game pass if you want xD
wish I had time to play games 😔
bruh same 😔
Coding is a full time job 
but I have to rank on rainbow and League so i play anyways 
im not even coding
my school + chess tournament is full time bob for me
me who simply works at McDonald's lmao
cz no time
btw im going to the tournament in five mins
😔... im in russia, we dont even have mcdonalds
thx
Trust an old man, the school is usefull untill High School if you study computer sience, literally high school license is enough to find a job as a dev
sad
my opponent seems to be trash tho
ikrr
don't judge huh
huh but if his rating is 1100 and mine is 1400 what else can i say
depends though, idek how chess is played
I used to play chess during lessons with a classmate of mine
like war but way more to think of
cuz wdgaf about school 
strategy tactics and all that shit
I literally use my phone during classes
okay gotta hurry up
oki, good luck!
or im gonna be late like last time
,
what
ok bye

async def on_member_join(member):
#main server
if member.guild.id == 971319429461835836:
await bot.fetch_channel(971319830064017458).send(f"Welcome {member.mention}, this is our proofs channel!", delete_after=30) #proofs channel
await bot.fetch_channel(987268323731439646).send(f"{member.mention}, pls check out these giveaway channels!", delete_after=30) #giveaways info channel
await bot.fetch_channel(971319847352950835).send(f"Welcome to the server! Please do remember to get reaction roles in #⟡💫・reaction-roles channel!") #main chat```
why this not working?
it worked before i changed everything to slash commands, and moved from discord.py to pycord, how to fix?
Dont they pay a bit above minimum wage?
they pay enough
discord.py to pycord
"Do you want a medium burger or large"
lmao
They pay like a dollar above minimum iirc
it's fine, I just need a temporary job lol
plus I don't necessarily need to work
Yeah its not that bad, quite nice ig
no error its just not working..
very informative
Well then making spare cash would be fine
how is something supposed to not work without an error, have you enabled member intents?
yeah ig
wait...
yes it is
on_command_error laughing
ok hunter
!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 Members, Message Content, and Presences. These are needed for features such as on_member events, to get access to message content, 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.
oh
yo, i plan on making this in the near future,
was just wondering if anyone got advice that might be useful
quite frequently i get ppl joining my server and promoting financial nonsense, or ppl who beam/cookie log accounts
ive seen some discord bots that offer to ip ban with premium
i was wondering if banning individual ips is doable, ig id have to store them in a db file
i added intents in the code but still not work
nice, show the intents
Discord ip bans by default
from discord import Intents
from discord.ext import commands
intents = Intents.default()
intents.members = True
bot = discord.Bot()
pass the intents to the bot too....
bot = discord.Bot(intents=intents)
like this?
yes
ok
ima test it
isnt it commands.Bot
Im building a dicord bot for the first time and ive hit a slight snag when i use the bot it will only reply in dm's not on the server i made
its still not working @slate swan
show
im using pycord, slash commands...
py-cord PoV
when ppl join there is no message
Warning (from warnings module):
File "/Users/bai/Documents/Personal Things/Do not delete/Only viewable by me/Aww Pika Discord Bot/script/main/aww pika discord bot v2.py", line 43
await bot.fetch_channel(971319830064017458).send(f"Welcome {member.mention}, this is our proofs channel!", delete_after=30) #proofs channel
RuntimeWarning: coroutine 'Client.fetch_channel' was never awaited
Ignoring exception in on_member_join
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/discord/client.py", line 382, in _run_event
await coro(*args, **kwargs)
File "/Users/bai/Documents/Personal Things/Do not delete/Only viewable by me/Aww Pika Discord Bot/script/main/aww pika discord bot v2.py", line 43, in on_member_join
await bot.fetch_channel(971319830064017458).send(f"Welcome {member.mention}, this is our proofs channel!", delete_after=30) #proofs channel
TypeError: coroutine.send() takes no keyword arguments
you need to enable message content
from discord import Intents
intents = Intents.default()
intents.message_content = True
you'll have to do
await (await bot.fetch_channel(...)).send(...)
if you are using pycord then why are you importing intents from discord
ok
py-cord uses the same namespace as discord
a okay
it still doesnt work...
error
Warning (from warnings module):
File "/Users/bai/Documents/Personal Things/Do not delete/Only viewable by me/Aww Pika Discord Bot/script/main/aww pika discord bot v2.py", line 43
await bot.fetch_channel(971319830064017458).send(f"Welcome {member.mention}, this is our proofs channel!", delete_after=30) #proofs channel
RuntimeWarning: coroutine 'Client.fetch_channel' was never awaited
Ignoring exception in on_member_join
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/discord/client.py", line 382, in _run_event
await coro(*args, **kwargs)
File "/Users/bai/Documents/Personal Things/Do not delete/Only viewable by me/Aww Pika Discord Bot/script/main/aww pika discord bot v2.py", line 43, in on_member_join
await bot.fetch_channel(971319830064017458).send(f"Welcome {member.mention}, this is our proofs channel!", delete_after=30) #proofs channel
TypeError: coroutine.send() takes no keyword arguments
Ignoring exception in on_member_join
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/discord/client.py", line 382, in _run_event
await coro(*args, **kwargs)
File "/Users/bai/Documents/Personal Things/Do not delete/Only viewable by me/Aww Pika Discord Bot/script/main/aww pika discord bot v2.py", line 43, in on_member_join
await (await bot.fetch_channel(971319830064017458).send(f"Welcome {member.mention}, this is our proofs channel!", delete_after=30) #proofs channel
TypeError: coroutine.send() takes no keyword arguments
you're missing a parentheses after the fetch_channel(1234555)
?
async def on_member_join(member):
#main server
if member.guild.id == 971319429461835836:
await (await bot.fetch_channel(971319830064017458).send(f"Welcome {member.mention}, this is our proofs channel!", delete_after=30) #proofs channel
await (await bot.fetch_channel(987268323731439646).send(f"{member.mention}, pls check out these giveaway channels!", delete_after=30) #giveaways info channel
await (await bot.fetch_channel(971319847352950835).send(f"Welcome to the server! Please do remember to get reaction roles in #⟡💫・reaction-roles channel!") #main chat```
this is the code



I need support anyone!? Im new to coding testing and playing around with stuff but i keep getting this error.
!indents
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
also, Discord.py is not really a playing around library
Could i send u the code and u fix it fo rme please?!
no one will do that here
y?
we are here to make people learn not spoon-feed
I am learning but on youtube
I just need the tiniest bit of help
youtube tutorials are quite outdated y'know, so there's a big chance that things will break every so often
can someone please just help me this 1 time
You're probably only learning syntax and not the actual functionalities of each abstraction shown
well could u hel
help
The only thing that can help your issue is that embed given and your delete key
whats a tab key
the key under your escape key!
9?
Thanks alot u gave ma bigger error 😦
im a new coder and im being treated like im the master of python .-.
ur format is not correct...
how do i fix that?
put no space infront of
@bot.command()
and asnyc def
then put a tab for the rest of the lines
u literally gotta learn this.... @slate swan
No? the whole function is indented lol
That gave me another error
line 39 (), u did not close bracket
what does that mean
You have a ( but no ) to match it
The last line is indented incorrectly
//
it fixed but whe n i use the command it dont reply and this happens
Did you read the error
☠️
?
this is the important part of your error py File "main.py", line 88, in luckboost em.add_field(name="luckboost") TypeError: add_field() missing 1 required keyword-only argument: 'value' in your main.py file at line 88, inside your luckboost command, you tried to add a field to your embed without providing the value= argument
Where do i put value
you write it like a second argument, i.e. value="my thing" and a comma inbetween your name= argument so python knows they're separate
ye idk what that means
def my_function(x, y):
return x + y
# calling it
my_function(x=123, y=456)```
this is still python
Lmaooo
cause im losing half my braincells trying to figure out wtv u just said
Generally we recommend learning python before trying discord.py
wasnt talking to u 
I was talking to you
In line 89
em.add_field(name="Luckboost")
you're missing the value= parameter
where am i suppost to put that
like treat em.add_field as a normal function with parameters and stuff
@bot.command()
async def luckboost(ctx):
pfp = 'no'
em = discord.Embed(color=800000)
em.set_thumbnail(url=pfp)
em.set_footer(text="wtv")
em.add_field(name="Luckboost")
await ctx.reply(embed=em) ```
I dont know what a function is
give it a shot
uhm
☠️☠️☠️
What languages do u know?
???
Sure Mr. Python expert
?
if u wanna learn then go to some sites that teach python or the learning guide of python
Sir, I am very very very very very very very very very very very very sorry I did not mean to I just got a bit angry 😦
This is not funny
The number of trolls in here have increased lately, i wonder why that is
i wasnt trying to be funny.
if you here to troll, you should leave
im not im ownestly just looking for help .-..
you already got help, you are just not taking it
Since when was Marceline emo?
ye there telling me to import functions and do this and that i dont know waht anything is im new .-.
I just wanna know where to put the value=
discord.py is not a beginner friendly library, you need to be familiar with basics of python, OOP and asynchronous programming. So it's better you learn those things before jumping into making discord bots. You are basically trying to run in the Olympics without knowing how to walk.
Please refer to this #discord-bots message
We cant help u that much if your only knowledge is to copy paste codes without knowing how it works and not knowing basic python
😦 But i pay
how do i make a bot ignore dms messages?
Wdym pay?
how do i make a bot ignore dms messages?
wdym ignore like in the on_message ?
async def on_message(self, message):
if message.guild.id == Channel ID Here:
print(f"{message.author} said --- {message.clean_content}
elif message.channel.type is discord.ChannelType.private:
pass ```
!rule 9
disable the dm_typing intent
see howcomes yall help him but not me
Why is this channel unmoderated
They already you told how to fix it
ye idk any of it
You just chose not to understand and wait for them to fix it for you it seems 
from where?
# message is from a server
else:
# message is from a dm. ```
You could also remove dm_typing intent but i prefer using scripting since it gives extra lines to my code
stack overflow?
Extra lines? Have you ever read the python zen?
ya
pasting is fun i can sound like ik what to do
i want my bot to only work in private channels since i got verify channel
intents = discord.Intents.all()
intents.dm_typing = False
bot = commands.Bot(.., intents=intents)
thanks
you really don't