Traceback (most recent call last):
File "C:\Users\nikit\PycharmProjects\discord.py\discord\ui\view.py", line 359, in _scheduled_task
await item.callback(interaction)
File "C:\Users\nikit\PycharmProjects\discord.py\docs\discbot.py", line 253, in nft_callback
await interaction.response.edit_message(embed=nfts_Emb)
File "C:\Users\nikit\PycharmProjects\discord.py\discord\interactions.py", line 621, in edit_message
await adapter.create_interaction_response(
File "C:\Users\nikit\PycharmProjects\discord.py\discord\webhook\async_.py", line 191, in request
raise HTTPException(response, data)
discord.errors.HTTPException: 400 Bad Request (error code: 50035): Invalid Form Body
In embeds.0.image.url: Scheme "attachments" is not supported. Scheme must be one of ('http', 'https').```
#discord-bots
1 messages · Page 871 of 1
consider subclassing help instead
no
why can't u just tell me my actual problem, not about how i set up my help command
lol your gonna suffer hardcoding help, good luck :D
would that fix the problem about my commands not being defined?
- just make member have a value of the author or the member
- you werent supposed to copy paste my example
- you arent sending the embed
yes? because your just modifying the defualt help command instead of making your own
i have more commands though
i already removed the help commands bro
help_command=None)
!e
print(f"You're {__import__('random').randint(0, 100)}% cool")
@slate swan :white_check_mark: Your eval job has completed with return code 0.
You're 79% cool
can someone please help
Hi, so uhh I'm making a welcome command, but I can't get the channel ID to send it to.
import disnake
from disnake.ext import commands
import random
class Welcome(commands.Cog):
"""Fires one of many welcome messages."""
def __init__(self, bot: commands.Bot):
self.bot = bot
@commands.Cog.listener()
async def on_member_join(self, member: disnake.Member):
"""Fires off a welcome message on user join."""
welcomeEmbed = disnake.Embed(
title = f"Welcome {member.name}!",
description = "Shitter >:)"
)
channel = await self.bot.fetch_channel(channel_ID)
await channel.send(embed = welcomeEmbed)
def setup(bot):
bot.add_cog(Welcome(bot))
print(" | Loaded Extension: Welcome")
print(" | ")
It says channel_ID not defined
because you didnt define channel_id?
no need to be a one liner you can just import it without the special method
@heavy folio help command is removed
you dont remove it, subclass it
Variable names should be in snake_case, not camelCase
?
istg water, pep8, idk about variable names
Yeah this is more of a design choice than anything, you'll need to figure out which approach you want to take:
- find a channel that's close to
generalorglobalorchator something - loop through each channel and send it in the first one you can
doesn't matter, with it or without it, my commands still aren't defined,
and that's what i need fixing
If you want my two cents I don't like bots that send a message in some random channel when they join because more often than not that message is gonna end up being in like annoucements or something
whatever, do you have other cogs
@scarlet aurora do your cogs have a setup function
It's not when they join, it's when a member joins
they do
because I don't see it in your code
yes
def setup(bot):
bot.add_cog(Commands(bot))```
does it load
import discord
from discord.ext import commands
class status(commands.Cog):
def __init__(self, bot):
self.bot = bot
def setup(bot):
bot.add_cog(status(bot))
So say you joined the server it's setup in, it sends an embed with
Welcome Robin! {insert funny welcome message}
he loads cogs on ready which is probably not the best choice
why is loading cogs on ready an issue?
on_ready triggers many times
because its ran multiple times iirc
yw
create a separate method and call that in your run method
because on_ready is not fired just once
so i should just create a function to load cogs, then call it once in the main file?
@scarlet aurora just load them outside of any method and youll be fine
are you on 2.0 or 1.7
avatar_url is an attr of the Member class?
nvm
There's mutliple ways to load cogs.
bot.load_extension()
Some huge random shitpile that uses os and scans the dirs for files ending in .py (wacky)
If you're using Disnake (idk if it's anywhere else), you can use bot.load_extensions to load a folder of .py cogs
Whichever way you want to do it is up to you, but just don't load em in on_ready
USING OS module isnt wacky
it's fixed
!d discord.Guild.avatar
NEGATORY.
No documentation found for the requested symbol.
classes dont have random attrs
iirc
even if you do os, you will need load_extension() no matter what
!d discord.Guild.icon
property icon: Optional[discord.asset.Asset]```
Returns the guild’s icon asset, if available.
lol
def get_quote():
response = requests.get("https://zenquotes.io/api/random")
json_data = json.loads(response.text)
quote = json_data[0]['q'] + " - " + json_data[0]['a']
return(quote)
@commands.command()
async def quote(self, ctx):
quote = get_quote()
await ctx.send(quote)``` why is get_quote not being defined? also i fixed my last problem thanks guys
This isn't wacky?
Idk I didn't make it
the method is a static method
it cant access the class instance
async def nft_callback(self, button, interaction):
nfts = [stuff.jpg, otherstuff.jpg]
randnum = random.randrange(len(nfti.get_List()))
files = discord.File(r"C:\Users\nikit\Downloads\nft\images{}.jpg".format(randnum) , filename=f"image{randnum}.jpg")
nfts_Emb = discord.Embed(title="Free nfts")
nfts_Emb.set_image(url=r"https://cdn.discordapp.com/attachments/images{}.jpg".format(randnum))
await interaction.response.send_message(embed=nfts_Emb)```this just sends a blank embed
all methods in a class need self first param, unless its a class or static method
oh ofc
Easier than doing load.extension(commands.cognamehere over and over again
request isnt async btw use aiohttp and just do response.json() and return it lol
return response.json()
or just do it without a variable lol
def get_quote():
response = requests.get("https://zenquotes.io/api/random")
json_data = json.loads(response.text)
quote = json_data[0]['q'] + " - " + json_data[0]['a']
return response.json()
@commands.command()
async def quote(self, ctx):
quote = get_quote()
await ctx.send(quote)```
like that?
you still need self and no need to load the response body
ok so remove line 3
idk which line lol
and self, ctx is there?
bro
lmaio
get_quote is a staticmethod
decorate it with @staticmethod first off
weirdchamp
😳
thanks

list comp would of been faster
it will*
[member for member in ctx.guild.members if member.bot]
is there a way for the bot to cache a channel
if member.bot
[member for member in ctx.guild.members if member.bot]
If your just trying to get the amount of bot's in a server using sum is a fast way to get it
Can someone help me in #☕help-coffee
sum is such an interesting method
Actually doing len on a list comp here might be faster, not sure
timeit😼
In [1]: import random
In [2]: class A:
...: def __init__(self):
...: self.bot = random.choice([False, True])
In [3]: foo = [A() for _ in range(1000)]
In [4]: def bar():
...: sum(a.bot for a in foo)
In [5]: def baz():
...: len([a for a in foo if a.bot])
In [6]: %timeit bar()
35.3 µs ± 1.13 µs per loop (mean ± std. dev. of 7 runs, 10,000 loops each)
In [7]: %timeit baz()
20.2 µs ± 1.22 µs per loop (mean ± std. dev. of 7 runs, 100,000 loops each)
In [8]: def qux():
...: len(list(filter(lambda a: a.bot, foo)))
In [9]: %timeit qux()
44.3 µs ± 2.68 µs per loop (mean ± std. dev. of 7 runs, 10,000 loops each)
wow not bad
Need help writing a detailed help embed command with discord.py module
if anyone has any good resources or code I can use as a reference let me know
just subclass the helpcommand and get creative ig lol
ty!
yw
Oh but is not an embed
the default?
yes
its a codeblock iirc so just subclass it as i said and customize it
Add an , after the SelectOption instance you created inside of options
!e ```py
foo = (1)
for i in foo:
print(i)
@pliant gulch :x: Your eval job has completed with return code 1.
001 | Traceback (most recent call last):
002 | File "<string>", line 2, in <module>
003 | TypeError: 'int' object is not iterable
!e ```py
foo = (1,)
for i in foo:
print(i)
@pliant gulch :white_check_mark: Your eval job has completed with return code 0.
1
or you could pass options to the initializer
so like this?
(nextcord.SelectOption(...),)
how do i check for the number of ppl in a vc
so if a vc reaches 2 members they get moved
to a different vc
i need to put dots?
no thats a placeholder
OH ok
options = (nextcord.SelectOption(label='Hello', description='Wasssup'),) @slim ibex like this?
ye
If you have the VoiceChannel instance you can call len on VoiceChannel.members to get how many users are currently in the VC. You'd then compare this number to 2
!d discord.VoiceChannel.members
property members: List[Member]```
Returns all members that are currently inside this voice channel.
uh
You'd then use Member.move_to to move them to a new channel
!d discord.Member.move_to
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.
if i have a line of code saying voice_channel = discord.utils.get(ctx.guild.channels, name="General")
i can do len(voice_channel.members)
?
Yea to get the amount of members in the VC
yep
You compare this via to 2 via > etc
👍 Then just this to move them to the new channel
how do i create a voice channel?
!d discord.Guild.create_voice_channel
await create_voice_channel(name, *, reason=None, category=None, position=..., bitrate=..., user_limit=..., rtc_region=..., video_quality_mode=..., overwrites=...)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
This is similar to [`create_text_channel()`](https://discordpy.readthedocs.io/en/master/api.html#discord.Guild.create_text_channel "discord.Guild.create_text_channel") except makes a [`VoiceChannel`](https://discordpy.readthedocs.io/en/master/api.html#discord.VoiceChannel "discord.VoiceChannel") instead.
import discord
from discord.ext import commands
import nacl
client = commands.Bot(command_prefix="1")
@client.command(name='check', invoke_without_subcommand=True)
async def check(ctx):
guild = ctx.guild
voice_channel = discord.utils.get(ctx.guild.channels, name="General")
if len(voice_channel.members) == 1:
await guild.create_voice_channel(name="Match")
no errors but didnt create one
Does it have permissions to create it? Does the if statement get executed? etc
You need to provide more info here
@quaint scaffold can the bot manage the community ?
if yes can u send me the docs for it?
it has admin
should i debug it using print

yea if statement didnt execute
Why are you doing invoke_without_subcommand
In the command deco
Uhmm
@quaint scaffold i changed it to <2 instead of ==1 and it worked but how do i create the voice channel in a category
What are you even doing
Do you want the voice channel under a category
You’re going to have a logic error from the looks of it. It will execute if the len is 0 or 1
Don't name your Bot instance client
discord.Client exists
Variable naming matters
how about prefix
Do not use discord.Client
why and why no
Never said too
he's asking to change it to bot
Because client is far inferior, there are many things commands.Bot has that Client doesn’t.
Again, I never said to use Client
discord.Bot does not even exist🤡
Lmao
no error?
Well not everybody needs the commands extension
Yes, my bad lol
Besides the only thing Bot has that I consider a "feature" over Client is the ability to register multiple listeners for a single event
🥴 it's still Better to use commands.Bot for features like cogs
Noone likes to have multiple events in the same file
commands?
Well, I meant as actual feature that you would want to use it other than the commands stuff
also being able to hot-reload or modulearize your bot
If you ever make a proper project, you will need to use Bot.
Lol no you can just... write your own code?
What?
discord.Client feels akin to how discord.js does it
just dump all these events for you and let you figure it out
Why wouldn’t you use commands when it’s perfectly functional and very useful lol.
The commands extension doesn't abstract a whole lot, everything is pretty easy to implement by yourself
Might as well write my OS too and build my router from scratch as well.
len(voice_channel.members) gives me 0
Especially cogs
when i print it
Cogs abstract little to nothing
Intents
Do you have member intents?
oh
it's fun
!intents
Using intents in discord.py
Intents are a feature of Discord that tells the gateway exactly which events to send your bot. By default, discord.py has all intents enabled, except for the Members and Presences intents, which are needed for events such as on_member and to get members' statuses.
To enable one of these intents, you need to first go to the Discord developer portal, then to the bot page of your bot's application. Scroll down to the Privileged Gateway Intents section, then enable the intents that you need.
Next, in your bot you need to set the intents you want to connect with in the bot's constructor using the intents keyword argument, like this:
from discord import Intents
from discord.ext import commands
intents = Intents.default()
intents.members = True
bot = commands.Bot(command_prefix="!", intents=intents)
For more info about using intents, see the discord.py docs on intents, and for general information about them, see the Discord developer documentation on intents.
Not everyone prefers the commands extension, though I think you like your router as it is..?
yep works now
Writing an OS from scratch is hard, just build on top of something
What's the point of using the library then lol
Just make your own aiohttp connnection to the gateway why discord.py
ty
not a big deal either
discord.py doesn't consist only of the commands extension lmao
Kernels are so hard to code from scratch 😔
good learning experience nonetheless (i haven't tried)
I've only gotten to emulating VGA
imagine kernel in python
did mine in rust and c++
I mean, if you really like things to not be easy you should do that
It's called preference, as I've said. Don't force the extension onto someone, simple.
you don't really need the commands extension unless you're actually making a bot, if you're making a one off thing to help you do something client is probably your best bet
They just asked to change the name of their commands.Bot variable for client to bot 🤡
not the instance
.
#discord-bots message
#discord-bots message
Was referring to this
Gotcha
await voice_channel.members.move_to(channel=x) would this work?
self.label isn't an attribute.
oh, then what would be the correct attribute?
It's a list of member instances you need to iterate
!d discord.VoiceChannel.members
property members: List[Member]```
Returns all members that are currently inside this voice channel.
I was going to refer to an abc then I forgot lol
so i need it in a list?
VoiceChannel.members is a list of the members, not the member itself
Sooo, you'd iterate the list to get the member instances, then call move_to on them
.
Not sure, what are you trying to do?
Only you would know if we're being honest here, it's your code, your intentions.
a dropdown command
voice_dict = []
for member in voice_channel.members:
voice_dict.append(member)
would that work
The voice_dict is kinda useless if you just want to call move_to
i thought self.label would work but it wont work when I click the dropdown command
You'd just do await member.move_to(...)
Since you iterate and you get member
ye
👍
If you care about speed/responsiveness, don't take this approach. Instead use asyncio.create_task() to just schedule the coroutines. The difference is even bigger if your client's connection latency to Discord is poor.
They execute in parallel and each call of move_to() doesn't pause the current coroutine's execution
But if you you're not comfortable with asyncio, just ignore what I'm saying.
They only do this in the case there is 2 members in a voice channel, this wouldn't do much of a change
Oh, sorry I must have missed that.
ye works
!d discord.TextChannel.purge
await purge(*, limit=100, check=..., before=None, after=None, around=None, oldest_first=False, bulk=True)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Purges a list of messages that meet the criteria given by the predicate `check`. If a `check` is not provided then all messages are deleted without discrimination.
You must have the [`manage_messages`](https://discordpy.readthedocs.io/en/master/api.html#discord.Permissions.manage_messages "discord.Permissions.manage_messages") permission to delete messages even if they are your own. The [`read_message_history`](https://discordpy.readthedocs.io/en/master/api.html#discord.Permissions.read_message_history "discord.Permissions.read_message_history") permission is also needed to retrieve message history.
Examples
Deleting bot’s messages...
how do i check for the voice channel to reach 2 members
like i dont want to do a command for it
discord.py abstracts the purging process and the only thing you should probably pass to purge() is the limit and check
infact i want it to move when th voice channel reaches 2 members
You can also use type annotation to hint that the argument is an int like so:
@commands.command()
async def purge(ctx, count: int):
...
await channel.purge(count=count)
!d discord.on_voice_channel_join
Huh? No.
No documentation found for the requested symbol.
wait hm
confuse
!d discord.on_voice_state_update
discord.on_voice_state_update(member, before, after)```
Called when a [`Member`](https://discordpy.readthedocs.io/en/master/api.html#discord.Member "discord.Member") changes their [`VoiceState`](https://discordpy.readthedocs.io/en/master/api.html#discord.VoiceState "discord.VoiceState").
The following, but not limited to, examples illustrate when this event is called...
Ah yes
finally
I'm a bit rusty, sorry
so is it an event?
yes
so client.listen("on_voice_state_update)
check which circumstances the event is called on though first
async def somethign
It's understandable discord.py does some abstraction with events, E.g READY => on_connect get's confusing sometimes
i think it would be ```@client.event
async def on_voice_state_update(member, before, after):
do shit here```
Specifically to expand more, after is of VoiceState which has a channel attribute, you'd call len on VoiceState.channel.members then check for 2
on_ready signals that the cache is ready i think
Yea, usually after all futures for guild chunking is finished
but discord.py's ready event just doesn't exist and is 100% library abstraction
the real READY event from the gateway correlates to on_connect
Not sure why I thought on_voice_channel_join() was a thing
CuNfuZeD??/??
because it makes sense gramatically
I had a habit of splitting up events in my modules, maybe that was it (on_voice_state_update would dispatch different events depending on the payload)
I just dislike how discord.py does events at all anyways 😔
Using string literals mean no auto suggestion from your intellisense
discord.py isn't very strongly typed, if that's what you meant
you're calling the purge() command
Not what I meant, I meant in the case I typed on_re it would auto suggest on_ready
^
But since it's a string literal it won't auto suggest that or show me hints
not how that works, you should use channel.purge()
In the case they used enums it would auto suggest or hint that event
ctx.channel in your case @slate swan
Although typechecking with discord.py is frustrating to say the least
I cannot run strict typing on any discord.py codebase I've had really
The only solution now is to fork it and go apeshit with typing
With how discord's API is making all the models nested that would quickly become a horrendous task
Easily 10k line diff??? prob
Maybe an over-exaggeration
You mean the component nightmare?
TypedDicts are hard to type narrow yea that too 😔
You missed a comma after limit = 500
Is there a way to check if the guild community before was disabled and after enabled?
!d discord.Guild.features
A list of features that the guild has. The features that a guild can have are subject to arbitrary change by Discord.
They are currently as follows:
discord.on_guild_update(before, after)```
Called when a [`Guild`](https://discordpy.readthedocs.io/en/master/api.html#discord.Guild "discord.Guild") updates, for example:
• Changed name
• Changed AFK channel
• Changed AFK timeout
• etc...
@dry kelp You can also listen to this event to get notified when a guild is updated
dw i got it
Are there any exceptions being thrown?
Are there any errors? If you haven't overridden the default error handling, it should appear in stdout
If you're running this in your terminal with python filename.py then it should be in the terminal
Do you have Manage Messages permissions?
Can you show full code?
Just doing true or false is time consuming
do you have an on_message event?
^
Why waste time with more questions anyway
!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.
there u go, your error handler is eating up the rest of the errors u don't handle
Remove the error handler for the command, and try again
and please don't make a custom error handler for a command, you can simply handle the errors inside of an on_command_erroror the command
It's limit
your limit will be the number of messages that'll be purged iirc
!d discord.TextChannel.purge rtd
await purge(*, limit=100, check=..., before=None, after=None, around=None, oldest_first=False, bulk=True)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Purges a list of messages that meet the criteria given by the predicate `check`. If a `check` is not provided then all messages are deleted without discrimination.
You must have the [`manage_messages`](https://discordpy.readthedocs.io/en/master/api.html#discord.Permissions.manage_messages "discord.Permissions.manage_messages") permission to delete messages even if they are your own. The [`read_message_history`](https://discordpy.readthedocs.io/en/master/api.html#discord.Permissions.read_message_history "discord.Permissions.read_message_history") permission is also needed to retrieve message history.
Examples
Deleting bot’s messages...
read this
it's limit, not count
yes
!d discord.TextChannel.send it takes a delete_after kwarg, just put it inside your send and set it to 5 seconds or something
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**.
@slate swan
hi
how can i check if the guild community is being disabled
Just check if 'COMMUNITY' is in the old features and not present in the new ones
It's just an array of strings, so you can easily check if a value isn't there like
if x not in []: ...
if 'COMMUNITY' in before.features and 'COMMUNITY' not in after.features: ...
This is flawed as the second clause would only be true if the guild had no other features.
Unless that is your intention 🤷
thats why too complicated
no?
which is bad
it can break the TOS
no, it doesnt
^
show the code 
@commands.has_permissions(manage_messages=True)
async def purge(ctx, amount):
await ctx.channel.purge(limit=int(amount)+1)
works
yeah but I have a logs channel setup for what is purged
so i dont really need a confirmation message
just check the logs
nvm its fine
but your bot has a high chance of getting rate limited?
no
why are you making the argument an int just typehint it as an int?
yes it does
do embed=embed
dude
you joking rn?
it works for me in all my bots
thats not how python works bro
yeah i didnt know that


hmm
why do you have kwargs set to None just dont add the kwargs lmao
limit=limit will work just fine
others arent needed since they are the default values added explicitly
and follow pep 8 lol
your type hint
uhh i.d.k. 
it should be
_type: int
🗿
is what you did
and?
ever heard of pep8
s.m.h. ikr, just help them with what they want rn, people rarely care about following clean code, which is bad ofc
im just saying that youre not following pep8 thats all
why dont you
i do

use dummy prints and see where the error is
can your bot even delete msgs

24, let me count
the message doesn't even send apparently, and a bot can always delete it's own messages
ik but i ment in purge lol
it worked before adding delete after
ill probably raise a forbidden so idk why i asked
tbh i have no clue why it doesnt work

wait, I was kidding, did it really work? 
well

its probably failing to delete after
Np
it probably was failing at first as in docs it says if it fails an exception is never raised
tldr if you provide to delete_after the exception won't be raised
including if you provide to the wait or w/e the name is on message.delete()
its silently ignored if it fails to DELETE, it should still send the message atleast
which actually means you can suppress the exception by using wait=0
which he said it worked before adding it 🗿
yeah i know
thats weird tho
yes
if it fails how would it stop the msg from sending?
seems like he didnt
plausible
thanku 
reasonable
🗿
Imagine making bots
💀
boring 
im hungry
Always at this time
At the time i wake up 😔
you like to start your day off by helping people?
Yea, the day starts good for me this way
that's great to hear but unfortunately i don't have all that much time in the morning
Cz I over slept anyways if I go down rn, I'm gonna be taunted by my parents 
That feeling when you sleep for 15 hours and you don't want people to make fun of you
I feel you
Indeed
!rule 7
7. Keep discussions relevant to the channel topic. Each channel's description tells you the topic.
Okay
Fair point but kind of just waiting for someone to ask a question at this point
elevator music
Oh someone here 👀
please ask question
Yes
I'll just go from here 

do buttons work in discord.py 1.7.3??
No
yes they do, but with unofficial libraries
discord_components?
recommended to use dpy 2.0 or its forks
Ohk
yuh you could use that
Either use dpy 2.0, a fork or third party modules like disnake (now depreciated in favor of disnake)
Why are there so many disnake shills here
Not shills, it's just the best fork
Or maybe it’s just you two but you’re all super active
I just gave an example bruv
i am unable to install dpy 2.0 i am using python 3.8.6 :/
There's a difference between being a shill and just recommending the best fork
What makes it the best
Wait iirc 2.0 is compatible with 3.8
Also u should seriously update to 3.9 since most of the modules don't support 3.8 anymore
Im win 7 user 
Yea, 2.0 works with 3.8.6 @stray carbon
I don't think that should make a difference?
Better feature implementation, things are supported faster, devs actually know what they're doing, code actually goes through multiple stages of testing before it gets released and a few others I'm missing
I aint able to install it tho
Yeah, 3.8 is the minimum version
Show the error?
You need to install through GitHub either the zip archive or a git tag
3.9 requires win 8.1+
Ouch, well then u should think of a way to upgrade since the next version bump gonna remove support for 3.8 and most of the modules don't support 3.8 or have very less support
You shouldn't be using windows 7 anyway. Support for it has been removed which means it's not getting security updates anymore
pip install discord.py=2.0.0
Could not find a version that satisfies the requirement discord.py....
:/
pip install git+https://github.com/Rapptz/discord.py
oh
Run this command (:
The 2.0 update wasn't published on pypi
Ic,tysm
It's cool
What do you mean by “they actually know what they’re doing”
I can sense a huge disagreement starting 👀
Apparently some of the devs aren't good at python
Yes
They as in, disnake developers
@final iron u know, u shouldn't really target other forks, whether directly or indirectly. The only reason I advice to use disnake is cz they release features faster that's it (:
Or who
Pycord developers don't know what they're doing
Yeah they’re kind of amateur
It’s cool to see a test bot in disnake though, and I’m assuming they have some kind of automatic testing in their test guilds
Or slaves
Anyway
Lemme start making a dpy wrapper. Would be fun to see all your comments on my wrapper, like this is the worst code I have ever seen till now. At least u will start to respect pycord devs then 👀
GitHub
Pycord, a maintained fork of discord.py, is a python wrapper for the Discord API - pycord/discord/bin at master · Pycord-Development/pycord
Pycord devs already had a good code base though
What is this
Install ffmpeg from google
Wut
Isnt the same with repl packages?
https://github.com/Rapptz/discord.py/tree/master/discord/bin
Stop blaming them for having DLLs
It's an external exe file used to play music
How was I targetting pycord
Exactly
There, edited the message (;
This?
I wasn't blaming them for having dlls anyway
Yea
The top or bottom one
Well the bot won't work on replit anyways
It's gonna get ratelimited
File "D:\Coding\Discord BOT\BOT.py", line 59, in <module>
client.command()
AttributeError: 'Client' object has no attribute 'command'
U need an instance of commands.Bot
ok
I once tried to play something on vc with replit and worked great
maybe try to install ffmpeg from package manager?
Huh, ffmpeg works on replit?
yeah it does
they even have a music bot template
Idk bout that, the last time I used replit to host a bot was in 2020
same, but they still supported it at that time too
I hardly knew anything about discord bots back then ¯_(ツ)_/¯
same
freecodecamp nostalgia
I just used it to waste my time
idek how a bot even works
Cool
Cool
how do you know that?
I smell something starting 
I've heard a few people say things. Nothing verified though
Believing rumors is bad idea
🤷♂️
I made one it worked
Then i copy paste the code
Then it says ffmpeg not found

Install ffmpeg
how did you install it?
In chrome
Like he said
I dont use urls
I would prefer the title url
same title is clean
ah yes xenon
Xenon is one of the noble gasses that can actually form stable compounds though.. wonder what that means for your bot
what IDE are you using
sure it is 👀
You do know thT science sucks, right? 👀
rule 7
Ok
i agree science is top tier
AttributeError: 'Client' object has no attribute 'command'
client.command is making this happen since im using discord.client but i dont want to switch to commands.Bot
any way around it?
No
Client doesnt have commands
and why not use the subclass aka the Bot class its all the same? but better
Hmm
Nope
why are you even making commands if you're using Client
Idk lol
@digital crest this is not possible. you instead gotta use commands.Bot to make commands
Rip k
Anyone know how to edit a message in nextcord?
!d nextcord.Message.edit
await edit(content=..., embed=..., embeds=..., attachments=..., suppress=..., delete_after=None, allowed_mentions=..., view=..., file=..., files=..., append_files=...)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Edits the message.
The content must be able to be transformed into a string via `str(content)`.
Changed in version 1.3: The `suppress` keyword-only parameter was added.
just do msg = await ctx.send(...) and then do await msg.edit(...)
Hmm idk how nextcord implements their slash commands, sorry
Owh okay
What the :stare:
!d nextcord.ext.commands.Bot.slash_command
slash_command(name=..., description=..., guild_ids=..., default_permission=..., force_global=False)```
Creates a Slash application command from the decorated function.
read it's docs maybe
!d nextcord.Interaction.original_message
await original_message()```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Fetches the original interaction response message associated with the interaction.
If the interaction response was [`InteractionResponse.send_message()`](https://nextcord.readthedocs.io/en/latest/api.html#nextcord.InteractionResponse.send_message "nextcord.InteractionResponse.send_message") then this would return the message that was sent using that response. Otherwise, this would return the message that triggered the interaction.
Repeated calls to this will return a cached value.
There
Ok ty
msg = await interaction.original_message()
await msg.edit(...)
or make it a one liner
I don't know quite how to phrase my question but how do you test your bot's features without actually releasing them?
await interaction.edit_original_message()```
?
no

Hmm forgot about that
!d nextcord.Interaction.edit_original_message
await edit_original_message(*, content=..., embeds=..., embed=..., file=..., files=..., view=..., allowed_mentions=None)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Edits the original interaction response message.
This is a lower level interface to [`InteractionMessage.edit()`](https://nextcord.readthedocs.io/en/latest/api.html#nextcord.InteractionMessage.edit "nextcord.InteractionMessage.edit") in case you do not want to fetch the message and save an HTTP request.
This method is also the only way to edit the original message if the message sent was ephemeral.
Where do you test it?
@hazy oxide use this lol
nextcord 
in your server?
That is what they are using
use what
help , i think it is because the servers 2fa
oh
because when its off it has no problems
@maiden fable this one?

interaction.edit_original_message
okay thank you
you need 2fa enabled
Their wish 🤷
restart 
yems 
I don't wanna go down rn so nvm

settings > enable 2fa
i mean you need 2fa
Its on
are you sure?
show screenshot of your settings (dont show email)
Weird
@bot.command()
async def say(ctx, *, args):
say = [851997270597828618]
if ctx.author.id in say:
await ctx.send(args)
await ctx.message.delete()
else:
return ```
i dont think the code is wrong
How can i stop that the bot spam the message into the channel?
I tryed that the bot send a message to an channel if a specific person comes online. But if the person comes online the bot spam the message permanently.
@bot.event
async def on_member_update(before, after):
if str(after.status) == "online" and after.id == MYID:
channel = bot.get_channel (941209391917568000)
await channel.send("idk")
pass
no it is correct
weird
BTW u using 2.0 or 1.7?
Do u have a on_message event?
No an py on_member_update
But do u have a on_message event anywhere else in ur code?
Yes
How does that effect on_member_update event lol
He says it spams the message permanently so maybe it’s responding to its own message
class GameButton(Button):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
async def callback(self, interaction):
await interaction.response.send_message("Hi bro", ephemeral=True)
if interaction.user == p1 and self.pc1:
try:
await interaction.response.send_message(self.chosen, ephemeral=True)
except:
await interaction.followup.send_message(self.chosen, ephemeral=True)
elif interaction.user == p1:
self.c1 = str(self.custom_id)[0]
self.pc1 = True
elif interaction.user == p2:
self.c2 = str(self.custom_id)[0]
self.pc2 = False
class RockButton(GameButton):
def __init__(self):
super().__init__(label="Rock", style=discord.ButtonStyle.blurple, custom_id="rock", callback=super().callback)
class PaperButton(GameButton):
def __init__(self):
super().__init__(label="Paper", style=discord.ButtonStyle.blurple, custom_id="paper", callback=super().callback)
class ScissorsButton(GameButton):
def __init__(self):
super().__init__(label="Scissors", style=discord.ButtonStyle.blurple, custom_id="scissors", callback=super().callback)```
callback aint getting trigerred
you need to add buttons to ui.View object
i added =_=
class MyView(View):
def __init__(self):
super().__init__()
self.pc1 = False
self.pc2 = False
self.c1 = '/'
self.c2 = '/'
self.chosen = "You have already chosen"
self.add_item(RockButton())
self.add_item(PaperButton())
self.add_item(ScissorsButton())
async def interaction_check(self, interaction) -> bool:
if interaction.user not in plist:
try:
await interaction.response.send_message("You are not playing this", ephemeral=True)
except:
await interaction.followup.send_message("You are not playing this", ephemeral=True)
return False
else:
return True```
async def callback(self, interaction, choice, custom_id):
await interaction.response.send_message("Hi bro", ephemeral=True)
if interaction.user == p1 and self.pc1:
try:
await interaction.response.send_message(choice, ephemeral=True)
except:
await interaction.followup.send_message(choice, ephemeral=True)
elif interaction.user == p1:
self.c1 = str(custom_id)[0]
self.pc1 = True
elif interaction.user == p2:
self.c2 = str(custom_id)[0]
self.pc2 = False
class Game(ui.View):
def __init__(self):
super().__init__()
self.choice = None
self.pc1 = False
self.pc2 = False
self.c1 = '/'
self.c2 = '/'
async def interaction_check(self, interaction) -> bool:
if interaction.user not in plist:
try:
await interaction.response.send_message("You are not playing this", ephemeral=True)
except:
await interaction.followup.send_message("You are not playing this", ephemeral=True)
return False
else:
return True
@ui.button(label="Rock", style=discord.ButtonStyle.blurple, custom_id="rock")
async def confirm(self, button: ui.Button, interaction: Interaction):
self.choice = "Rock"
game_action(self, interaction, self.choice, "rock")
@ui.button(label="Paper", style=discord.ButtonStyle.blurple, custom_id="paper")
async def confirm(self, button: ui.Button, interaction: Interaction):
self.choice = "Paper"
game_action(self, interaction, self.choice, "paper")
@ui.button(label="Scissors", style=discord.ButtonStyle.blurple, custom_id="scissors")
async def cancel(self, button: ui.Button, interaction: Interaction):
self.choice = "Scissors"
game_action(self, interaction, self.choice, "scissors")
try doing it like this
view = Game()
await ctx.send(..., view=view)```
and then just py await view.wait() for choice
usage:
...
view = Game()
msg = await ctx.send(
...,
view=view
)
await view.wait() # Wait for input
if view.choice is not None:
# Do something here
will it still work if the method is in the class
!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.
https://paste.pythondiscord.com/acuhaherut
Any1 help me?
you will need to specify it with self.callback or with another name because ui.View can't have its own callback function
i'll paraphrase
it can have that function because it's a class, but it won't be used by discord.py (or any other lib) itself
RuntimeWarning: Enable tracemalloc to get the object allocation tracebackgame_action(self, interaction, self.chosen, "scissors")
RuntimeWarning: Enable tracemalloc to get the object allocation traceback```
and it still doesnt respond
lemme test it, give me a minute
👍
await game_action
ahh ok
Coloured functions dude. Cringe
help anyone.
okay
then it should work perfectly
yup works
Guys can anyone give me code of broadcast msg
u mean the news channel?
what exactly does member.premium_since return?
something like this? 2021-05-24T01:35:41.336000+00:00
Yea
it returns a datetime object
premium_since refers to nitro?
yes
yea
oof
refers to a server boost origin date
?
that....huh?
the day you started boosting "this server"
premium_since means the time since u have had nitro
oh
!d discord.Member.premium_since
An aware datetime object that specifies the date and time in UTC when the member used their “Nitro boost” on the guild, if available. This could be None.
there isnt one
^
lol, thats not a dpy attr
O
yes, sad
I am starting to forget what attrs are for 😔
it can be, i believe
but flags are faulty in a way
i dont rely on them personally
id rather hardcode my way through a calling
its stupid why bots cant access user profiles
wait, how do you get the badges of a user?
what calling
!d discord.Member.public_flags
property public_flags```
Equivalent to [`User.public_flags`](https://discordpy.readthedocs.io/en/master/api.html#discord.User.public_flags "discord.User.public_flags")
!d discord.PublicUserFlags exists
class discord.PublicUserFlags```
Wraps up the Discord User Public flags.
x == y Checks if two PublicUserFlags are equal.
x != y Checks if two PublicUserFlags are not equal.
hash(x) Return the flag’s hash.
iter(x) Returns an iterator of `(name, value)` pairs. This allows it to be, for example, constructed as a dict or a list of pairs. Note that aliases are not shown.
New in version 1.4.
or you never knew it in the first place
then try to get some sleep
i just gathered all the badges a user has with if statements
👀
I did, checked it some days ago then forgot about it
then sends the badges as emotes of the actual badge
thats what most people do
like the userinfo command for @unkempt canyon?
!source userinfo
Bad argument
Unable to convert 'userinfo' to valid command, tag, or Cog.
!source info smh
Bad argument
Unable to convert 'info smh' to valid command, tag, or Cog.
Bruh :stare:
!source u
!source info
Bad argument
Unable to convert 'info' to valid command, tag, or Cog.
nothing is like my userinfo command lol
hunter spamming
Ok I suck
Uhh yea these
you need to tell?
Yes, there are new people here
'{"user": {"id": "431427182926102528", "username": "tame", "avatar": "47eecdedbde0240cbe8db6056e881b20", "discriminator": "4444", "public_flags": 256, "flags": 256, "banner": "dc2516de42402d9c3b4a1215a9a8ce7f", "banner_color": "#b5d8cb", "accent_color": 11917515, "bio": "\\n\\n\\u2605 \\u2605 \\u2605\\u2606 \\u2606"}, "connected_accounts": [], "premium_since": "2021-06-25T09:39:51.096537+00:00", "premium_guild_since": "2021-05-24T01:35:41.336000+00:00", "guild_member": {"roles": ["917284127701598250", "917284786471596035"], "nick": null, "avatar": null, "premium_since": null, "joined_at": "2021-12-08T01:55:06.914000+00:00", "is_pending": false, "pending": false, "communication_disabled_until": null, "user": {"id": "431427182926102528", "username": "tame", "avatar": "47eecdedbde0240cbe8db6056e881b20", "discriminator": "4444", "public_flags": 256}, "bio": "", "banner": null, "mute": false, "deaf": false}}'``` so much user data in the profile api, its honestly a huge shame that bots cant access this endpoint 😔
who?
Terror
they have been here for a long time
Oo, I like it. Sending raw requests to the API
Saw them the first time here, sooooo
they can
nope, they cant

too much high level stuff for u lmao
wtf
i tried a bot token and a user token (may have bent the rules a bit there for that one, it was for experimental purposes)
how the fuck did you get the users bio
bot tokens raise status code 20001, users raise 200
I should go to sleep, my brain is unable to do anything rn
PoV: They used a user token
This is you'd use a user token yeah.
what?
theres so much rich information that even i never knew could be accessed
the bots don't have access to the bio BTW
profile api endpoint
yeah, i know. but they should, not just bio but the entire profile endpoint
Lemme give u a bot token, u can try it yourself
ive already tested it with my own bot token
I don't have to explain to you that you are breaking ToS? And there is a perfectly good explanation why bots cannot access this info.
it raised a 20001 (unavailable)
they can't access it for a reason though
iirc it was allowed in former API version(s), when dpy had a discord.Profile class
why cant bots access it? and i know it was violation but i had to find out for myself what was in that api. considering headers only provide so little information
privacy?
A person can always self bot to evade this limitation
im curious as to why
Alts exist. Just make a temp account or use a temp mail and use its token until discord detects, but then it is against ToS so I better not continue this
But yea, I would love to continue this convo in DMs if u want
Discord’s self bot prevention is garbage every update they push is bypassed in 1 second
Indeed
add me, surely we could go in depth
Sure
Since it is pretty useless information to have, al tough it doesn't really invade privacy it can be used maliciously. With much data bios, premium, connected accounts you can get a pretty accurate profile of what a person plays and what it likes to play.
privacy concerns
i see
Example ?bc #discord-bots hi
!d discord.TextChannel.news
Not gonna happen.
No documentation found for the requested symbol.
is_news()```
[`bool`](https://docs.python.org/3/library/functions.html#bool "(in Python v3.9)"): Checks if the channel is a news channel.
!d discord.TextChannel.edit has a news kwarg
await edit(*, reason=None, **options)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Edits the channel.
You must have the [`manage_channels`](https://discordpy.readthedocs.io/en/master/api.html#discord.Permissions.manage_channels "discord.Permissions.manage_channels") permission to use this.
Changed in version 1.3: The `overwrites` keyword-only parameter was added.
Changed in version 1.4: The `type` keyword-only parameter was added.
Changed in version 2.0: Edits are no longer in-place, the newly edited channel is returned instead.
type kwarg*
me either 
Rip no reaction perms 😔

Why stopped?
Its boring
What happened to the chat bot? Stopped it?
well once you learned the package if you don't have any project you will not continue to use it anymore of course
Nahhh
Its verified right?
Yea
everybody loves hunter and his stuffs ❤️
Damn
Hunai is my worst enemy
The bots been made a year ago?
But I love hunter more 😔
Ig?
Ayo what the

She do be sleep drunk 👀

She should go to sleep
Idk lemme see
I wanted to get a bot verified but it's probably too late

Why
yes
What do you mean why
can’t you verify it whenever you like
Yea, my bad. Was confused
But no badge anymore
shit
Then sleep and then feel silly after reading yr messages when u wake up 👀
Yeah but it's hard to grow a bot now
you are the perfect example of my status 
I mean, I am just tryna tell u that u r just tired and need some rest, if not sleep
Yes go to sleep
16 years of rest required tbh 
Not that hard
Depends on u. I wanted to make a verified bot, so I made HunAI. If u want to be a verified bot owner, then go for it, but meh, u don't even get a badge anymore, so it's totally your wish
No thanks. We gonna miss you
....funny
No cap
!ot
Off-topic channel: #ot2-never-nester’s-nightmare
Please read our off-topic etiquette before participating in conversations.
No i mean like do you think people will invite it/what feature would make people invite
Idk what yr bot is about
And how did you grow your bot
probably something like templates and stuff like xenon
Whats that
Didn't really do anything, posted it on a few bot lists, that's it
or good and accurate automod
Mod bots are old tbh. They are boring to make 😔
like it creates channels and roles and permissions when setting up a server with premade templates
In General, Bots Are Boring. Period.
Oh...i see that's interesting
Reason I have stopped making bots 
same 
There are numerous bots for the same thing 😔
Indeed
Yeah nvm there's no point trying to verify for me
The bot making scene was fun when I was new to it. There weren't that many bots back then
That’s why I decided to leave discord bots
Well yea, it's totally your decision. I madly wanted a verified bot, so went ahead and verified it
How many servers is jarvide in? @manic wing
Had to wait for like 2-3 months for a final response
Yeah id like one too but if it fails its a huge waste so don't want to risk it
Indeed
what exactly is jarvide, i've seen the repo and i saw its a ide, its ai and its like jarvis that will understand nlp, but then i saw the prs they were adding gif commands
really confusing
Lmaoo
Idfk what's that tbh. I am in the server but meh, I haven't even messaged there since ages
You saw jarvide
Apparently i was invited to work on development but haven't been assigned anything
The fuck
A bot
oh jarvide was supposed to be an AI until the person assigned it decided to give up
what is it exactly
It was also meant to be an IDE and shit
Mhm
now its just a normal dc bot?
Wait its stopped?
It's nothing now
yeah it died
No
Not anymore
they should mention that in the readme 😭
Lmaoo
Idk how it died but now we talk about the Ukraine crisis in there
Oh that's sad
Did you just browse through GitHub and just see jarvide and thought it looked cool
yeah it came in explore
Cool
i was browsing trying to find projects to contribute to
Everything is boring except developing Box It Up 
Yeah good luck on contributing to jarvide
Nothing, just a silly little game I'm making
lol
I'm waiting for voice receive
Can you send the github link?







