#discord-bots
1 messages · Page 1083 of 1
the earn per server (eps) is wrong needs to x100
epic rpg is really wild, it's a good model if you wanna follow it
capital U
fake rpg too
!d discord.User.banner
property banner```
Returns the user’s banner asset, if available.
New in version 2.0.
Note
This information is only available via [`Client.fetch_user()`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Client.fetch_user "discord.Client.fetch_user").
property url```
Returns the underlying URL of the asset.
fake rpg gets almost 7p per server per month, they would earn £7000 per month if they had 100k servers
okay so inorder to get the url i fetch the user and use user.banner.url
ah because of partially initialized objects?
i guess so
its like bot.fetch_guilds() which doesnt return a full Guild object and is limited in attributes
Is it possible to dynamically create tasks w/o using the decorator?
the decorator?
Without using one, since the decorator locks me into making the task "static" (e.g I have to define the interval beforehand)
For context I need to start a tasks loop after a command has been run, and the interval is provided through the command
!d discord.ext.tasks.Loop
class discord.ext.tasks.Loop```
A background task helper that abstracts the loop and reconnection logic for you.
The main interface to create this is through [`loop()`](https://discordpy.readthedocs.io/en/latest/ext/tasks/index.html#discord.ext.tasks.loop "discord.ext.tasks.loop").
subclass this
There's no indication of which arguments tasks.Loop takes though
!d discord.ext.tasks.Loop.change_interval is exactly what ur looking for
change_interval(*, seconds=0, minutes=0, hours=0, time=...)```
Changes the interval for the sleep time.
New in version 1.2.
So define a dummy task with 0 of everything, then change it later when necessary?
yep, that should do!
is a voice channel an abc.Messageable now
👍 thanks, will give that a shot
looking at the source code, not yet
but with the implementation of voice text channels may be soon?
ill miss the #no-mic channels
does voice text channels have endpoints yet?
so bots can send messages and view the channel?
!d discord.VoiceChannel.last_message this exists for sure
property last_message```
Retrieves the last message from this channel in cache.
The message might not be valid or point to an existing message.
New in version 2.0.
Reliable Fetching
For a slightly more reliable method of fetching the last message, consider using either [`history()`](https://discordpy.readthedocs.io/en/latest/api.html#discord.VoiceChannel.history "discord.VoiceChannel.history") or [`fetch_message()`](https://discordpy.readthedocs.io/en/latest/api.html#discord.VoiceChannel.fetch_message "discord.VoiceChannel.fetch_message") with the [`last_message_id`](https://discordpy.readthedocs.io/en/latest/api.html#discord.VoiceChannel.last_message_id "discord.VoiceChannel.last_message_id") attribute.
seen it but im not really looking for that

!d discord.abc.GuildChannel.changed_roles
property changed_roles```
Returns a list of roles that have been overridden from their default values in the [`roles`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Guild.roles "discord.Guild.roles") attribute.
it kinda means you can view messages
ik but i ment in voice chat text channels
yes
!d discord.VoiceChannel.send
await send(content=None, *, tts=False, embed=None, embeds=None, file=None, files=None, stickers=None, delete_after=None, nonce=None, allowed_mentions=None, reference=None, ...)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Sends a message to the destination with the content given.
The content must be a type that can convert to a string through `str(content)`. If the content is set to `None` (the default), then the `embed` parameter must be provided.
To upload a single file, the `file` parameter should be used with a single [`File`](https://discordpy.readthedocs.io/en/latest/api.html#discord.File "discord.File") object. To upload multiple files, the `files` parameter should be used with a [`list`](https://docs.python.org/3/library/stdtypes.html#list "(in Python v3.10)") of [`File`](https://discordpy.readthedocs.io/en/latest/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/latest/api.html#discord.Embed "discord.Embed") object. To upload multiple embeds, the `embeds` parameter should be used with a [`list`](https://docs.python.org/3/library/stdtypes.html#list "(in Python v3.10)") of [`Embed`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Embed "discord.Embed") objects. **Specifying both parameters will lead to an exception**.
mhm ig their is already endpoints
Seems like a yes
What
new feature
ooh Nice
@slate swan Thanks for the help, subclassing did exactly what I wanted 😄
pleasure <3
okimii is waiting for sarthak to get the Helper role so that sarthak can nominate okimii for Helper
And loop goes on and on and on and on and on and on and on and on
but we all know thats okimii needs to please hunter for that 😳
👀
disnake.ext.commands.errors.ExtensionFailed: Extension 'cogs.events' raised an error: OperationalError: connection to server at "iphere", port 3306 failed: received invalid response to SSL negotiation: p
hmm odd
U on Mac?
it should be
u should verify
how do i verify that since the database is remote
u bought a VPS or smth?
you have exposed me
ive been here almost everyday for about a year but your the og
i have one via google cloud as progreSQL or however that is spelled and one i had from bot-hosting.net
wait a sec i think the second one i was trying might be sql database instead
O
recursion😳
Nice
dedication
def helper_role_loop():
helper_role_loop()
helper_role_loop()
i just do it cuz i love what i do, but yeah you can ask the regulars here im always here like on a daily basis
Can you please take this to #bot-commands

nice 👍
:p
and no helper role😔 , hunter deserves it more than me tho
welp u just gotta grind a year or two more ig
hunter is mypy, enforces rules :p
yup like robin
Robin has done the same thing @sick birch am i right Robin
but i actually have good examples
with the amount of off topic chats we do in this channel, lets stop hoping for helpr roles
dont take my hope away sarthak😔 
!ot
Off-topic channel: #ot2-never-nester’s-nightmare
Please read our off-topic etiquette before participating in conversations.
Suggest more topics here!
smh
ability to delete the bot
😭
"feature"
that is a feature
thats a library feature
no
isnt it
elaborate
Hm?
i made a whole class that handles commands that use apis and i made a command that lets you make api request with the bot but its limited to a request per day
per user ofc
that youve been in this channel on a daily basis like me
id rather just use firefox instead of making a req with a bot
especially 1 req per day
ill rather use a phone than a discord bot
exactly
🙄 
More or less, yeah
I FIXED THE DATABASE ACCESS!!
congo
Nice
yup vouch for me, im like you but i have good examples but my name also starts with an R 
oops caps... i forgot to authorise my ip
Ah
R gang
Would ya'll go to an OT channel by yourself or I have to bother @unkempt canyon?
onelettervariablename gang
E = "best gang"
its almost 12am , go sleep
!ot
Off-topic channel: #ot2-never-nester’s-nightmare
Please read our off-topic etiquette before participating in conversations.
this channel is cursed, every channel tagged from here dies :/
If only
@vale wing
includign databases
track_background_image = Image.open('images/spotify_template.png')
album_image = Image.open(requests.get(spotify_result.album_cover_url, stream=True).raw).convert('RGBA')
ret = await coro(*args, **kwargs)
File "/home/runner/mv/cogs/spotify.py", line 22, in track
album_image = Image.open(requests.get(spotify_result.album_cover_url, stream=True).raw).convert('RGBA')
Does anyone have any resources they could link to me for setting up tests for my bots code? I want to set up some tests on something like circleci but I don't have any tests written. I've seen libs such as https://github.com/Cobular/distest and https://github.com/CraftSpider/dpytest which aim to make testing discord bot code easier but none of these, as far as I can see, support discord.py 2.0. I'm just interested to learn how others how write discord bots in python write their code tests
You might wanna look into how discord.py itself tests their code: https://github.com/Rapptz/discord.py/tree/master/tests
Okay will do, thanks for the advice
💀
embed.set_thumbnail(url=user.avatar.url)
why does this not work, it says nonetype doesn't have attribute url but I am certain the user is a user object since I can make it print it's username and discriminator
consider using display_avatar instead 
Would this work on both discord.py and discord.py v2?
discord.py v1.7.3 no, it was added in v2
Oh ok, do you know any alternative for discord.py 1?
well, on 1.7 avatar doesn't have a url attribute
hikari, better and faster, but harder @slate swan
It's avatar_url in 1.7.3 iirc
^
Ok and I guess this isn't really related to discord bots but is there like a check I could do using subprocess to check what version of discord.py the one running the code has?
So when they have v2 I could make it display_avatar and if they have older I do avatar_url
You really shouldn't be doing that
As having a stable environment you can predict is important
sys.version/sys.version_info discord.__version__/discord.version_info but just stick to one dpy version
thats python version not dpy version, no?
Well yeah I guess that'd be quite complicated for no reason lol
Set yourself up a virtual environment that way you don't have issues with package verions
oh, I thought they meant py, mb 😅
If you really want to know though, check this for versioning info related to discord.py: https://discordpy.readthedocs.io/en/stable/api.html#version-related-info
you can just pip show Library in the cmd, prob fastest and more informative
They want it from within their code programatically
os.system('pip discord.py --version)
would that work? I don't know how to get the version tho 
No need, just use discord.version_info from within your code
But again, probably not a good idea as you should have a stable, static environment
it's for github haha that's kinda why
if you're uploading it to github dockerize your app
what's dockerize
VersionInfo(major=2, minor=0, micro=0, releaselevel='alpha', serial=0)
I get returned this but idk what it means
Use docker for your apps
You should always dockerize your apps, good practice
Hey @oblique forum!
It looks like you tried to attach file type(s) that we do not allow (.pyc). We currently allow the following file types: .gif, .jpg, .jpeg, .mov, .mp4, .mpg, .png, .mp3, .wav, .ogg, .webm, .webp, .flac, .m4a, .csv, .json.
Feel free to ask in #community-meta if you think this is a mistake.
discord.__version__ gives a stringified version of that
OOOOO
can some one help me please
thanks bro
also how do u move to a different dsc version just to check
i can't back my soruce from pyc
Update yourself to 2.0 to check
Also idrk what that is lol
I am on 2.0 rn but don't know how to move back yk
uninstall your current dpy and use pypi to install it on version 1.7.3
how to uninstall
Also I swear there was a command I used before to go to a version, something like
pip install discord==1.7.3
no?
you can't, .pyc is just the cache file used for imports...
either way how does that relate in any way to discord bots?
no idon't know where i have to go
not entirely sure if you can use that to go back to a version, but tias ig
#❓|how-to-get-help message or some topical category channel that covers that
pip uninstall
I doubt this would work because 2.0 is installed from git and most likely "is not conflicting" with the package installed from pypi (in fact it does but pip might not recognise that)
I mean this
So just pip freeze, copy your discord req and pip uninstall it
Or locate its installation (gonna be easier if installed in venv) and delete manually
from __future__ import annotations
from typing import TYPE_CHECKING, Any, Callable, Coroutine, TypeVar
import asyncio
import inspect
import re
class MaybeAwait:
def __init__(self, coro: Callable[..., Coroutine]) -> None:
if not asyncio.iscoroutinefunction(coro):
raise RuntimeError("Received non-coroutine.") from None
self.syncf: Callable[..., Any]
self.coro = coro
def __call__(self, id: int) -> Any:
ctx = inspect.getframeinfo(inspect.stack()[1][0]).code_context[0] # type: ignore
if re.search(r"^(.*?)(\bawait get_member\b)(.*)$", ctx):
return self.coro(id)
return self.syncf(id)
def sync(self) -> Callable[..., Callable[..., Any]]:
def inner(func: Callable[..., Any]) -> Callable[..., Any]:
self.syncf = func
return func
return inner
async def main() -> None:
@MaybeAwait
async def get_member(id: int) -> int:
return id
@get_member.sync()
def _get_member(id: int) -> int:
return id
print(await get_member(123))
print(get_member(456))
asyncio.run(main())
``` cc: @visual island
^ Not originally what I wanted to do to make this work. Originally I was using `ctypes` to do some hacky pointer stuff, then hooking onto RuntimeWarning; for the most part it worked. Except RuntimeWarning was only emitted after a call, therefor I had to call the sync function twice to make my original POC work (It did work but it was ugly)
I am sorry but wtf. Please don't do this haha
@bot.event
async def on_ready(guild):
client_guild_name = guild.name
client_guild_id = guild.id
reference = db.reference(f"/")
reference.update({
client_guild_name: {
"client_guild_id" : client_guild_id
}
})
Would this be the correct way to get guild information?
It works with the on_guild_join(guild) - It's giving this error.
TypeError: on_ready() missing 1 required positional argument: 'guild'
Ctypes version was more cursed
Didn’t require me to look at the stack either
I need a pycord dev for a command
Go ahead and tell your issue
So I'm making a class which sets some defaults for my embeds, is the kwarg for the colour set as colour or color in the embed kwarg list? I know I can do
embed.colour.green()```
and
```py
embed.color.green()```
but I'm doing this
```py
class PositiveEmbed(LogEmbed):
def __init__(self, *args, **kwargs):
if "colour" not in kwargs:
kwargs["colour"] = discord.Colour.green()
super().__init__(*args, **kwargs)```
and it seems a bit odd to me that the kwarg list would have both `colour` and `color` so is there some weird background converting done when `colour` is in the list/called to make it call `color`
The kwarg list can have both, but it shouldn't, so I suppose you can assume that it's only going to have one
discord/embeds.py lines 161 to 162
colour: Optional[Union[int, Colour]] = None,
color: Optional[Union[int, Colour]] = None,```
`discord/embeds.py` line 170
```py
self.colour = colour if colour is not None else color```
ah okay, thanks for clearing that up for me
just say your issue
couldnt they just do
self.colour = colour or color

i want a dpy rewrite smh
The color black would be false.
Why do you need to do inspect.getframeinfo()? inspect.stack()[1].code_context[0] already returns the code context, right?
Oh, your right. I just used that because I had a file using that method before it was changed
wdym
do you mean the color black returns false? just use the missing sentinel? im not sure what you mean...
import asyncio
import os
import aiohttp
class Foo:
async def fetch(self):
headers = {"Authorization": "Bot token"}
url = f"discord.com/api/v9/users/{self}"
async with aiohttp.ClientSession().get(url, headers=headers) as resp:
return await resp.json()
def __eq__(self, other):
other["fetch"] = Foo.fetch
int.__dict__ == Foo()
async def main():
await (270700034985558017).fetch()
asyncio.run(main())
``` Neat little bug to edit the underlying map, let’s you add some methods to built-in literals
Color black returns false
show
!e print(bool(0x000))
@cloud dawn :white_check_mark: Your eval job has completed with return code 0.
False
ohhhhhhh you ment the hex code
That's what color/colour is right :3
@bot.slash_command(guild_ids=guild_ids)
async def setup_status(interaction : Interaction, channel : GuildChannel):
status.start()
@tasks.loop(seconds=30)
async def status():
print("Loop Done")
For something like this, does anyone know how would you send the @tasks.loop to a certain channel that a user specifies in the command above?
Or, am I just going about it wrong?
For some reason I'm getting this error
Unexpected token at end of expressionPylance
``` on this line
```py
f"{f'role.name' for role in channel.overwrites if len(channel.changed_roles) >= 1}"```
I'm trying to do something like
role1.name, role2.name, etc
```but I've forgotten how to do it which is a bit nnoying
", ".join([role.name for role in channel.overwrites if len(channel.changed_roles) >= 1])
Joining Iterables
If you want to display a list (or some other iterable), you can write:
colors = ['red', 'green', 'blue', 'yellow']
output = ""
separator = ", "
for color in colors:
output += color + separator
print(output)
# Prints 'red, green, blue, yellow, '
However, the separator is still added to the last element, and it is relatively slow.
A better solution is to use str.join.
colors = ['red', 'green', 'blue', 'yellow']
separator = ", "
print(separator.join(colors))
# Prints 'red, green, blue, yellow'
An important thing to note is that you can only str.join strings. For a list of ints,
you must convert each element to a string before joining.
integers = [1, 3, 6, 10, 15]
print(", ".join(str(e) for e in integers))
# Prints '1, 3, 6, 10, 15'
thanks, been pulling bashing my head against my desk trying to work this out as ik I've done it before - in this project as well - but couldn't remember where
Not sure if this is the right channel, but basically I want to display an entire table in a message when I do the /users command, any pointers as to how to start this?
minus the database connector etc
@commands.Cog.listener()
async def on_ready():
for user in bot.users:
self.bot.get_user(user)
self.db.insert_one({"_id": user.id,
"cash": 0,
"bank": 0,
"notifications": True})
``` i need help its not inserting
Why are you adding this in on_ready?
on the ready it adds all the people that aren't in the db
but i'm switching it to an on message so that only the author is added when they send message
Just add a check if they are in the database or not when they access their account.
No need to add people that aren't going to use it anyways.
how?
No clue I have never used mongo
should it be like if user not in db
Something like that
upsert exists if no data is found
if user not in self.db.find({"_id": user.id}):
self.db.insert_one({"_id": user.id,
"bank": 0,
"cash": 0,
"notification": True})
its in the db but it still keeps looking for it
railwayapp is good for hosting bot?
its still trying to enter it into the db
Obviously, you need to get that data to check if it needs to be inserted or not
obviously im not understanding ..
.find_one_and_update(
{'_id': 'userid'},
{'$inc': {'seq': 1}},
upsert=True,
return_document=ReturnDocument.AFTER)
{'seq': 1}```
Using upsert will create the document if doesn't exist
I suggest you to move to #databases to get more help regarding databases
if user.id not in self.db.find_one_and_update({"_id": user.id}):
self.db.insert_one({"_id": user.id,
"bank": 0,
"cash": 0,
"notification": True,
upsert=True})
``` ???
hold up no
im gonna go to #databases
Since you will need to get the data from the db anyway, you can leave that check and just do the method ive sent you. In a single method it gets the data and if not found it will create the document thats it
self.db.find_one_and_update({"_id": user.id,
"bank": 0,
"cash": 0,
"notification": True,
upsert=True,
return_document=ReturnDocument.AFTER})
```what should i do now
Can someone help with this? Unsure how to fix this error.
get_channel(channel_id, /)```
Returns a channel with the given ID.
Note
This does *not* search for threads.
Changed in version 2.0: `channel_id` parameter is now positional-only.
Got it, will try that.
Thank you
How do I make my bot appear online but mobile
Oi, so... ModuleNotFoundError: No module named 'discord_slash' and I'm not able to startup my bot :/ I installed discord-py-slash-command and nothing changes
Oh?
Yes
@slate swan Read some of these
U mean, u want your bot's online status to look like mobile?
@commands.command()
async def balance(self, ctx, user: discord.Member = None):
user = ctx.author if user is None else user
user = self.bot.get_user(user)
try:
get = self.db.find_one({"user": user.id})
if get is None:
self.db.insert_one({"user": user,
"bank": 0,
"cash": 0,
"notifications": True})
except:
cash = self.db.find_one({"user": user.id})["cash"]
bank = self.db.find_one({"user": user.id})["bank"]
error:
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: AttributeError: 'NoneType' object has no attribute 'id'
Lol it's unstable
You don’t need user = self.bot.get_user(user) because u already have the user object
Yes
Does anyone know how to do this?
discord.py doesn't offer that feature
you would have to change stuff with the gateway. I’m not sure exactly how to do it
But it’s possible
^
I use nextcord
its a bug of the api, its an endpoint for users but can still be accessed by bots
eh, samething
Meh
why forks
Not important
Cause they are more stable that dpy
some have better implementations than dpy imo

You can but I do believe you have to tweak with the IDENTIFY payload, it's not supported and not recommended
!d discord.Member.joined_at
#bot-commands <-
Is this a good way of making a hangman game? https://mystb.in/ResponsibilitiesNylonYorkshire.python
:incoming_envelope: :ok_hand: applied mute to @nocturne plover until <t:1654314005:f> (9 minutes and 59 seconds) (reason: duplicates rule: sent 4 duplicated messages in 10s).
anyone know how to make the bot reply to your msg
Like this...
with ping or without ping?
Specify the reference kwarg in the send method e.g. ```py
message = ...
channel = ...
await channel.send('Hello there.', reference=message)
instead of using "ctx.send()"
do "ctx.reply(MSG, mention_user = True)"
MSG is whatever u want to be sent
got it thanks
async def setwelcome(self, ctx, *, message=None):
"""Sets the welcome message for your server (bot-admin only).
Available Options:
[[user]] = user name
[[atuser]] = user mention
[[server]] = server name
[[count]] = user count
[[place]] = user's place (1st, 2nd, 3rd, etc)
[[online]] = count of users not offline"""
if not await Utils.is_bot_admin_reply(ctx):
return
if message == None:
self.settings.setServerStat(ctx.guild, "Welcome", "")
return await ctx.send('Welcome message removed!')
self.settings.setServerStat(ctx.guild, "Welcome", message)
await ctx.send('Welcome message updated!\n\nHere\'s a preview:')
await self._welcome(ctx.message.author, ctx.guild, ctx.message.channel)
# Print the welcome channel
try:
welcomeChannel = ctx.guild.get_channel(
int(self.settings.getServerStat(ctx.guild, "WelcomeChannel")))
except:
welcomeChannel = None
if welcomeChannel:
msg = 'The current welcome channel is **{}**.'.format(
welcomeChannel.mention)
else:
if self._getDefault(ctx.guild):
msg = 'The current welcome channel is the default channel (**{}**).'.format(
self._getDefault(ctx.guild).mention)
else:
msg = 'There is *no channel* set for welcome messages.'
await ctx.send(msg)``` Any one know how to send the message as an embed for this?
.
embed = discord.Embed(title=“titleHere”, description=“descriptionHere”, color=“hexColorHere”)
embed.add_field(name=“nameHere”, value=“textHere”, inline=True/False)
You can add as many fields as you want (up to 25)
Here’s a list of the embed methods and attributes: https://discordpy.readthedocs.io/en/stable/api.html?highlight=embed#discord.Embed
no
fields are only limited up to 25
and refer to the official docs instead of some external links
!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.
The official dpy docs aren’t the most pleasant looking docs lol
unless you know how to read documentation, they're all the same and dpy's are low-key good

Edited*
Hello!
hola
Hi
I am coding a discord moderation bot. When I run the code in VS Code, the code doesn't run and shows and error which states ' SSL is not supported'. The same code runs very well in Replit. How can I fix this issue?
SSL Cert issue
How can I fix that?
so um guys im coding an ai discord bot and i am getting this errror- UnicodeDecodeError: 'charmap' codec can't decode byte 0x9d in position 1940: character maps to <undefined> from some time ( it was online and working before i added somethings)
this is my main.py - ```
import discord
import os
from dotenv import load_dotenv
from neuralintents import GenericAssistant
chatbot = GenericAssistant('noyyy.json')
chatbot.train_model()
chatbot.save_model()
client = discord.Client()
load_dotenv()
@client.event
async def on_message(message):
if message.author == client.user:
return
if message.content.startswith("&"):
response = chatbot.request(message.content[1:])
await message.channel.send(response)
client.run('t')```
i'd love it if anybody could help out
Isn't this type of config meant for chatterbot module? Idk
could you show the traceback?
Anyways that means u have a non unicode char in yr file
Yeah but what if i want it to follow the message that i have set it up as ?
do i just add str attributes to it
Wdym
So i have set up a welcome message the way i want it to but i want that message to be send as a embed
i don't really know which this my traceback - ```Traceback (most recent call last):
File "c:\Users\dhruv\OneDrive\Desktop\Dhruv_pycache_\Ayr.py", line 6, in <module>
chatbot = GenericAssistant('noyyy.json')
File "C:\Users\dhruv\AppData\Local\Programs\Python\Python310\lib\site-packages\neuralintents\main.py", line 53, in init
self.load_json_intents(intents)
File "C:\Users\dhruv\AppData\Local\Programs\Python\Python310\lib\site-packages\neuralintents\main.py", line 58, in load_json_intents
self.intents = json.loads(open(intents).read())
File "C:\Users\dhruv\AppData\Local\Programs\Python\Python310\lib\encodings\cp1252.py", line 23, in decode
return codecs.charmap_decode(input,self.errors,decoding_table)[0]````
mb
It is too big to show
!paste it here
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.
but like um any examples of non unicode character that could have been in my json file ?
this is ok?
show your intents.json or smth if you have that
If you set it up as some type of iterable you can just iterate through it and set the fields
Use a JSON sanitizer (if smth like that exists)
That's a key in his JSON file
Hunter and ash both ignored me
@slate swan
Ohh so meaning that the same way i set it up the way i need to add the text fields?
I never saw yr message, what do u need help with?
U forgot yesterday chat
Can you help me fix the issue?
self.embed.set_footer(text = f"{self.username}'s query evaluated.")
self.embed.set_author(name = f"{self.username}'s' query.", icon_url = ctx.message.author.avatar_url)
self.embed.add_field(value = f"{self.operation}", inline = False)
self.embed.add_field(value = "After evaluated, the result is :", inline = True)
self.embed.add_field(value = f"{self.evaluate}", inline = True)
await ctx.send(embed = self.embed)``` So like that
Oh god
It looks right
ok
When?
Ash ghosted me, Hunter ignored me
Uhhhhh, u on Mac?
Windows
Sad life
😭
Even sadder
y?
{"tag":"greetings",
"patterns": ["Sup", "Yo", "Hello", "Hi", "whatsup", "wazup", "Heyo", "Hey"],
"responses": ["Hello mate", "Zup", "Wasup my homie", "Yo buddy", "Good day"]},
{"tag":"rich",
"patterns": ["Are you rich?", "Are you poor ?", "Whats your income", "How much do you own", "How rich are you", "are u rich?"],
"responses": ["To put it simply I am dayum rich and to put it more simply, My money don't jiggle jiggle it fold"]},
{"tag":"live",
"patterns": ["Where do you live", "where are u"],
"responses": ["I live in the depths of the internet"]},
{"tag":"netw",
"patterns": ["What's your networth?", "whats ur networth?"],
"responses": ["About 50$ :(, My creator Fyre#2444 doesn't get any funding yet, no dmc no money #thatbrokeasscreator"]},
{"tag":"smarter",
"patterns": ["Are you getting smarter everyday?", "Are you evolving?", "Are you dumb?", "Are you smart?"],
"responses": ["I am an ever evolving artificial intelligient bot. The finest bot on all of discord"]},
{"tag":"name",
"patterns": ["What's your name", "whats ur name","Who are you"],
"responses": ["I am Ayr Alicante the first of his name, but you my friend, can call me Ayr"]},
{"tag":"jokes",
"patterns": ["Tell me a joke", "Do you know a joke ?", "humour me"],
"responses": ["Even people like you who are good for nothing have the capacity to bring a smile to your face, like when you push them down the stairs.", "Do you know the phrase “One man’s trash is another man’s treasure”? Wonderful saying, horrible way to find out that you were adopted.", "Give a man a match, and he’ll be warm for a few hours. Set him on fire, and he will be warm for the rest of his life.", "Slapping orphans is not cool, they can't even tell their parents smh"]},
{"tag":"weather",
"patterns": ["How's the weather", "Hows the weather", "Is it rainy?", "Is it sunny?"],
"responses": ["Eh I don't really like this weather but I'll deal with it, what bout u? ", "Pretty nice ngl, thinking bout going to a trip today with my AI friends", "I'M LOVIN ITTTTTT", "Well idk it's just rainin all night long here"]},
{"tag":"couple",
"patterns": ["Will I get a gf?", "Will I get a bf?", "Will I get a girlfriend?", "Will I get a boyfriend?"],
"responses": ["Who am I kiddin, Hell nah u won't.", "The future shines bright soldier"]},
{"tag":"date",
"patterns": ["Are you single ? ", "Are you in a relationship ? "],
"responses": ["I'm single silly goose"]}
]````
I showed you this yesterday 
https://stackoverflow.com/questions/56629636/aiohttp-running-client-example-runtimeerror-ssl-is-not-supported
@forest bramble
Ah yes my bad, sorry. I remember asking u to print the message id, right?
what could be the non unicode character here ? i honestly cant find it
Non uni chars ain't visible
sorry..my bad
So yea, use a JSON santizier or smth
What u even tryna do
ending the giveaway with the loop
I uh ....didnt see, my bad, plus Hunter is more knowledgeable, he'll help
I saved all the data regarding the giveaway and looping through that
Yeah
!d ssl
In the db i stored message, channel and guild ids
Source code: Lib/ssl.py
This module provides access to Transport Layer Security (often known as “Secure Sockets Layer”) encryption and peer authentication facilities for network sockets, both client-side and server-side. This module uses the OpenSSL library. It is available on all modern Unix systems, Windows, macOS, and probably additional platforms, as long as OpenSSL is installed on that platform.
Note
Some behavior may be platform dependent, since calls are made to the operating system socket APIs. The installed version of OpenSSL may also cause variations in behavior. For example, TLSv1.3 with OpenSSL version 1.1.1.
× python setup.py egg_info did not run successfully.
│ exit code: 1
╰─> [10 lines of output]
Traceback (most recent call last):
File "<string>", line 2, in <module>
File "<pip-setuptools-caller>", line 34, in <module>
File "/tmp/pip-install-vykhmk61/translators_70d2d18cea1d4bcd953b15fa09bc8463/setup.py", line 14, in <module>
VERSION = __import__(PACKAGE).__version__
File "/tmp/pip-install-vykhmk61/translators_70d2d18cea1d4bcd953b15fa09bc8463/translators/__init__.py", line 4, in <module>
from .apis import alibaba, baidu, bing, deepl, google, sogou, tencent, youdao
File "/tmp/pip-install-vykhmk61/translators_70d2d18cea1d4bcd953b15fa09bc8463/translators/apis.py", line 44, in <module>
import requests
ModuleNotFoundError: No module named 'requests'
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed
× Encountered error while generating package metadata.
╰─> See above for output.
note: This is an issue with the package mentioned above, not pip.
hint: See above for details.
! Push rejected, failed to compile Python app.
! Push failed
``` Can someone help me how to solve this?
And now, show yr loop code
i am getting this error on heroku
H didn't add requests in requirements.txt
Asher please help me I'm dying
generate a requirement file using
pip freeze > requirements.txt
And yea, I was just looking at Linux VPS prices and I am on the verge of having a heart attack...
?????
pip install SSL i terminal using
pip install ssl
Danbot, seriously?!
it's in stdlib
!d ssl
Source code: Lib/ssl.py
This module provides access to Transport Layer Security (often known as “Secure Sockets Layer”) encryption and peer authentication facilities for network sockets, both client-side and server-side. This module uses the OpenSSL library. It is available on all modern Unix systems, Windows, macOS, and probably additional platforms, as long as OpenSSL is installed on that platform.
Note
Some behavior may be platform dependent, since calls are made to the operating system socket APIs. The installed version of OpenSSL may also cause variations in behavior. For example, TLSv1.3 with OpenSSL version 1.1.1.
ok then just import it
i did
The error says otherwise
not working
@shrewd apex let's make a Custom Discord Client in Python
then u don't have module requests in ur requirements.txt
@tasks.loop(seconds=0.2)
async def give(self):
db = sqlite3.connect('giveaway.db')
cursor = db.cursor()
cursor.execute("SELECT end FROM info WHERE type = ?", ("give",))
res = cursor.fetchall()
if res is not None:
for end in res:
d = end[0]
if d == int(time.time()):
cursor.execute("SELECT msg FROM info WHERE end = ?", (end[0],))
ed = cursor.fetchall()
for msg in ed:
s = msg[0]
print(s)
cursor.execute("SELECT channel FROM info WHERE msg = ?", (msg[0],))
ms = cursor.fetchall()
for channel in ms:
cursor.execute("SELECT prize FROM info WHERE msg = ?", (msg[0],))
pri = cursor.fetchone()
cursor.execute("SELECT extra FROM info WHERE msg = ?", (msg[0],))
auth = cursor.fetchone()
ch = self.client.get_channel(channel[0])
new_msg = await ch.fetch_message(msg[0])
users = await new_msg.reactions[0].users().flatten()
if len(users) == 1:
ens = discord.Embed(description=f"Ended: <t:{int(time.time())}:R>\nWinner: No One Participated\nHosted By: <@{auth[0]}>", color=0x2f3136)
ens.set_author(name=f"🎁 {pri[0]}", icon_url="")```
@maiden fable 
y?
This is starting part
y not?
Bro bro bro bro bro bro bro bro what the fuck is even happening here
?
What's yr db schema?
@shrewd apex @maiden fable
give me a sec lemme see
k
?
when u print SSL after importing what do u get?
What's yr db structure
Table which contains msg channel and guild ending and starting time
also why is ur db sync
I'm new to ssl
Can you please explain in detail?
are u new to print() too just do print(SSL)
k
to see if lib object is even there
in the try and except?
So smth like
Table:
msg id channel id guild id
yeah try to be specific
?
no what does it print
it will print and then raise except
which line is giving u the error btw
can u post ur trace back here
!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.
delete this
k
u just posted ur token
Reset your token as well
yeah
breh
also use os.getenv() it's much better for tokens
ik that
So why not use a single SQL query to get everything in the row, so it will return a tuple like ((msg_id), (channel_id), (guild_id)) and then do smth like:
guild = bot.get_guild(res[2])
channel = guild.get_channel(res[1])
msg = await channel.fetch_message(res[0])
(This is a psuedo code, istg if u try to copy this)
but since this is VS Code, i use it directly
@shrewd apex https://paste.pythondiscord.com/bunafomihu
that don't matter
ohk lemmie do this
Seems like that emoji is yr fav
what's ur dpy version nightmare?
You like it?
It's nice, but just made that comment since 99% of yr messages have that emoji
yeah nextcord it looks like a SSL certificate has failed in the chain
what's the version tho
Ahh now i have addiction to that emoji
python version?
both python and nextcord
This was what I was using in replit
so that's what i use now
@shrewd apex
try
pip install --upgrade certifi
How can I set that?
I'm new to VS Code. I used to use Replit before this.
easiest way is when installing python there will be a checkbox click on that
????
like ✅ add python to path
ok
just install 3.10 and or 9 and do that
So, I already have python 3.9 installed in my computer
it will automatically change any old settings with the new python path version if u wanna do it manually u can too
u have to go to c users local program data python
Just help me fix this error. Idk any of this
i did
it's stored there
and select file to python.exe and put in system path variable
u can check Google how to do that tough to type on phone
ok
So, I create a shortcut for the python.exe and put it in the path where the main.py is stored right?
2022-06-04T05:33:33.485218+00:00 app[worker.1]: bot = commands.Bot(command_prefix=commands.when_mentioned_or('z.', 'Z.'), description='Basic commands for Zeram')
2022-06-04T05:33:33.485240+00:00 app[worker.1]: TypeError: __init__() missing 1 required keyword-only argument: 'intents'
``` I am getting this error when i am deploying my bot but its good on local machine
just reinstall python, its way easier
make sure to click on "add to python" while doing yhst

it's a problem with that part of ur code u are not adding kwargs intents as the error says
command_prefix is an kwarg ( key word argument ), so you would need to do ```py
bot = commands.Bot(command_prefix="prefix")
oh you already are, its the issue with intents then
Nice Discord also adding AutoMod
but i still didnt get permission of intent
u have to do intents=discord.Intents.all()
bro thats gonna be annoying af
but its working good on local machine
Dyno and MEE6: Are we nothing but a joke to discord?!
that depends on your discord.py version
in 1.7.3: its not required
in 2.0: yes it is
Smh y'all using global emojis now
Discord is just trying to make all the bots useless
i have 2.0 stil working fine in local machine
Agreed
welp making a moderation bot wouldn't be my first choice anyway
i doubt it, could you pip show discord.py in your terminal?
discord is prolly trying to make bots focus only on entertainment part to promote their platform
Yea
make a bot which bitches about discord implementations ez
Name: discord.py
Version: 2.0.0a3575+g45d498c1
Summary: A Python wrapper for the Discord API
Home-page: https://github.com/Rapptz/discord.py
Author: Rapptz
Author-email:
License: MIT
Location: c:\users\kartik\appdata\local\programs\python\python39\lib\site-packages
Requires: aiohttp
Required-by: discord
forget bot development i work in discord now😈
and it runs without passing intents=.. ?
send ur prefix part code
you need to enable them in the dev portal btw

Groovy: Ofc
well, it wasn't discord, it was YouTube
Traceback (most recent call last):
File "F:\Pycharm Projects\zeram discord bot\main.py", line 54, in <module>
bot.run(bot_token, reconnect=True)
File "C:\Users\kartik\AppData\Local\Programs\Python\Python39\lib\site-packages\discord\client.py", line 663, in run
return future.result()
File "C:\Users\kartik\AppData\Local\Programs\Python\Python39\lib\site-packages\discord\client.py", line 642, in runner
await self.start(*args, **kwargs)
File "C:\Users\kartik\AppData\Local\Programs\Python\Python39\lib\site-packages\discord\client.py", line 606, in start
await self.connect(reconnect=reconnect)
File "C:\Users\kartik\AppData\Local\Programs\Python\Python39\lib\site-packages\discord\client.py", line 547, in connect
raise PrivilegedIntentsRequired(exc.shard_id) from None
discord.errors.PrivilegedIntentsRequired: Shard ID None is requesting privileged intents that have not been explicitly enabled in the developer portal. It is recommended to go to https://discord.com/developers/applications/ and explicitly enable the privileged intents within your application's page. If this is not possible, then consider disabling the privileged intents instead.
Exception ignored in: <function _ProactorBasePipeTransport.__del__ at 0x0000023C9266DB80>
Traceback (most recent call last):
File "C:\Users\kartik\AppData\Local\Programs\Python\Python39\lib\asyncio\proactor_events.py", line 116, in __del__
self.close()
File "C:\Users\kartik\AppData\Local\Programs\Python\Python39\lib\asyncio\proactor_events.py", line 108, in close
self._loop.call_soon(self._call_connection_lost, None)
File "C:\Users\kartik\AppData\Local\Programs\Python\Python39\lib\asyncio\base_events.py", line 746, in call_soon
self._check_closed()
File "C:\Users\kartik\AppData\Local\Programs\Python\Python39\lib\asyncio\base_events.py", line 510, in _check_closed
raise RuntimeError('Event loop is closed')
RuntimeError: Event loop is closed

!intents please read the developer portal part
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.
i did
But what I'm thinking is, why tf YT wanted to close the bots this late
apply
I mean, they have been in usage since years
yt did what?
Took down Music Bots
ones with ytdl lib?
what privileged intents do you have?
With/Without it
OoO
not really... anything using YouTube
Every. Music. Bot. Well, not every but u get it
yeah few use Spotify api wrapper
idk
Spotify: I'm coming!
welp prolly like a light bulb moment idk i think i made one lemme try
can you show us the the screenshot of your bot's bot page so we can know what intents you got
or just use ```py
intents=discord.Intents.default()
intents.message_content = True
instead of `discord.Intents.all()`
i am doing this
it works in mine tho
but i still cant use it
cause you got those intents
Done man
Lmao I can sense another method coming, discord.Intents.important()
um, show code
lmao
intents = discord.Intents.default()
intents.members = True
#intents=discord.Intents.all()
bot = commands.Bot(command_prefix=commands.when_mentioned_or('z.', 'Z.'), description='Basic commands for Zeram', intents=intents)
bot.remove_command('help')
now run
i wish we could use bytewise operators like we do in hikari, its so easy
just do intents=discord.Intents.all()
same error
you don't have member intents and you are trying to enable it
after the pip command i said u to do b4
i cant enable any intent right now on my dev portal
k
i applied for it
enable then save
so you can't use them either, is your bot verified or something?
oh verified bot i think
it is verified
then wait for them to authorise till then rollback to 1.7.3
Yeah so thats the issue, request for member intents first
wait for discord to approve it
then you can use it
bruh
it's not added
I added python in system environment variables
can u tell me what are the options i can use for member intent?
umm u need intents there are no replacements?
go to #❓|how-to-get-help for adding python path
ok
just reinstall it it's so much easier
adding to system envs is easier....
options?
yes there is a form
they asking me to fill the form
to approve my request
i starting working on my bot after so long
then fill it 
i didnt know they changed alot of things

Not easy for people who haven't spent much time with Windows/a programming lang
just delete windows
You can start, I will follow suit
i already did, follow me
Nice
hunter
Ashley
at what the time's the fortnite event 
Uh, 13 hours
time 
6:30? oh
7:30
!ot
Off-topic channel: #ot2-never-nester’s-nightmare
Please read our off-topic etiquette before participating in conversations.
its already over 
what...?
go to ot channels or else
How can I create and delete channels?
!d discord.Guild.create_text_channel
await create_text_channel(name, *, reason=None, category=None, news=False, position=..., topic=..., slowmode_delay=..., nsfw=..., overwrites=..., default_auto_archive_duration=...)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Creates a [`TextChannel`](https://discordpy.readthedocs.io/en/latest/api.html#discord.TextChannel "discord.TextChannel") for the guild.
Note that you need the [`manage_channels`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Permissions.manage_channels "discord.Permissions.manage_channels") permission to create the channel.
The `overwrites` parameter can be used to create a ‘secret’ channel upon creation. This parameter expects a [`dict`](https://docs.python.org/3/library/stdtypes.html#dict "(in Python v3.10)") of overwrites with the target (either a [`Member`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Member "discord.Member") or a [`Role`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Role "discord.Role")) as the key and a [`PermissionOverwrite`](https://discordpy.readthedocs.io/en/latest/api.html#discord.PermissionOverwrite "discord.PermissionOverwrite") as the value.
Note
Creating a channel of a specified position will not update the position of other channels to follow suit. A follow-up call to [`edit()`](https://discordpy.readthedocs.io/en/latest/api.html#discord.TextChannel.edit "discord.TextChannel.edit") will be required to update the position of the channel in the channel list...
await create_category(name, *, overwrites=..., reason=None, position=...)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Same as [`create_text_channel()`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Guild.create_text_channel "discord.Guild.create_text_channel") except makes a [`CategoryChannel`](https://discordpy.readthedocs.io/en/latest/api.html#discord.CategoryChannel "discord.CategoryChannel") instead.
Note
The `category` parameter is not supported in this function since categories cannot have categories.
Changed in version 2.0: This function will now raise [`TypeError`](https://docs.python.org/3/library/exceptions.html#TypeError "(in Python v3.10)") instead of `InvalidArgument`.
await create_text_channel(name, **options)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
A shortcut method to [`Guild.create_text_channel()`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Guild.create_text_channel "discord.Guild.create_text_channel") to create a [`TextChannel`](https://discordpy.readthedocs.io/en/latest/api.html#discord.TextChannel "discord.TextChannel") in the category.
so I can just await guild.create_category ? or ctx.
guild = ctx.message.guild
await guild.create_category('cool-channel')
?
oh
How to get more than 1 choice in random.choice
How can I organize where a new channel or category will go?
!e
import random
################ 1 choice ################
print(random.choice(range(10)))
############### multiple #################
print(random.choices(range(10), k=10))
@paper sluice :white_check_mark: Your eval job has completed with return code 0.
001 | 4
002 | [0, 3, 2, 6, 2, 3, 7, 1, 5, 2]
The position in the category list. This is a number that starts at 0. e.g. the top category is position 0.
how is it used?
k means?
number of random choices u want
Range
range is just an iterable...
and this would go after I create the category ?
its sorta like a generator
Got it
i need sleep
i want to mention users in a reaction
@client.command()
async def test(ctx):
guild = ctx.message.guild
await guild.create_category('information')
await guild.edit(position=0)
didn't move the category. whatd I do wrong?
Can we move a channel to a category
and to move a created channel under this category?
Docs pls
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/latest/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...
Okay
Thanks 👍
@slate swan it seems it moved the channel I create but not the category
i am running two programs with same token everything works fine except slash commands
lets say the first program have slash commands and the 2nd one only have text commands(no slash commands)
whenever i use slash command from bot all the commands disappears after that
for instance when i define slash commands in second program they don't appear until the first program's any one slash command is called and when we call then all commands from first program disappears and it only shows second program's slash commands
@client.command()
async def test(ctx):
category = await ctx.guild.create_category(name="information")
await category.edit(position=0)
category = await ctx.guild.create_text_channel(name="info")
await category.edit(position=0)
does it make that much of a difference?
The Resources page on our website contains a list of hand-selected learning resources that we regularly recommend to both beginners and experts.
oh yeah you're right
Just create one program 
🙃 .
welcome
thanks
import discord
from discord.ext import commands
class Dropdown(discord.ui.Select):
def __init__(self):
options = [
discord.SelectOption(label='Red', description='Your favourite colour is red', emoji='🟥'),
discord.SelectOption(label='Green', description='Your favourite colour is green', emoji='🟩'),
discord.SelectOption(label='Blue', description='Your favourite colour is blue', emoji='🟦'),
]
super().__init__(placeholder='Choose your favourite colour...', min_values=1, max_values=1, options=options)
class DropdownView(discord.ui.View):
def __init__(self):
super().__init__()
# Adds the dropdown to our view object.
self.add_item(Dropdown())
class dropdown(commands.Cog):
def __init__(self, bot):
self.bot = bot
@commands.command()
async def testing(self,ctx):
view = DropdownView()
await ctx.send("choose",view=view)
async def setup(bot):
await bot.add_cog(dropdown(bot))
I have the command so where to put the decorator? @paper sluice
@discord.ui.select
dont need that...
I need for
yeah you don't need it
import discord
from discord.ext import commands
class DropdownView(discord.ui.View):
def __init__(self):
# other initilzation stuff ...
super().__init__()
# Adds the dropdown to our view object.
@discord.ui.select(placeholder='Choose your favourite colour...', min_values=1, max_values=1, options=[
discord.SelectOption(label='Red', description='Your favourite colour is red', emoji='🟥'),
discord.SelectOption(label='Green', description='Your favourite colour is green', emoji='🟩'),
discord.SelectOption(label='Blue', description='Your favourite colour is blue', emoji='🟦'),
])
async def callback(self, interaction: discord.Interaction, select: discord.ui.Select):
....
class dropdown(commands.Cog):
def __init__(self, bot):
self.bot = bot
@commands.command()
async def testing(self,ctx):
view = DropdownView()
await ctx.send("choose",view=view)
async def setup(bot):
await bot.add_cog(dropdown(bot))
like that
@robust fulcrum
get the ID of a channel by name?
channel = discord.utils.get(guild.channels, name="uwurolename")
if channel:
print(channel.id)
(edited)
what

can i only use *args when working with commands.ext? if it is possible, how would i use it for slash/bridge commands. i followed docs for bridge and slash but i get an error function got unexpected keyword 'arg'
can u show ur code?
yeah sure 1 sec
import discord
from discord.ext import bridge
import os
from dotenv import load_dotenv
bot = bridge.Bot(command_prefix="/")
load_dotenv()
@bot.event
async def on_ready():
print('Ok')
@bot.bridge_command()
async def list(ctx,args):
users = ', '.join(args)
await ctx.send(users)
bot.run(os.getenv('TOKEN')) # run the bot with the token
perhaps i did not follow docs
its *args
1 sec i think that was an older version
also slash commands dont have ctx as far as ik
waiting for bot to restart cuz iirc i tried with *args as well but it gave me same error
!d discord.ext.commands.Bot
class discord.ext.commands.Bot(command_prefix, *, help_command=<default-help-command>, tree_cls=<class 'discord.app_commands.tree.CommandTree'>, description=None, intents, **options)```
Represents a discord bot.
This class is a subclass of [`discord.Client`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Client "discord.Client") and as a result anything that you can do with a [`discord.Client`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Client "discord.Client") you can do with this bot.
This class also subclasses [`GroupMixin`](https://discordpy.readthedocs.io/en/latest/ext/commands/api.html#discord.ext.commands.GroupMixin "discord.ext.commands.GroupMixin") to provide the functionality to manage commands.
Unlike [`discord.Client`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Client "discord.Client"), This class does not require manually setting a [`CommandTree`](https://discordpy.readthedocs.io/en/latest/interactions/api.html#discord.app_commands.CommandTree "discord.app_commands.CommandTree") and is automatically set upon instantiating the class.
idk abt this bridge command i have to read the docs but
async def list(ctx, *args): or (ctx, *, args)
users = ', '.join(args)
await ctx.send(users)
should work
yeah with *args before it gave same error
alright, lemme try
based on what bridge said i thought i could use it just like a slash or command
slash commands have diffrent decorators i think not sure never tried
which lib r u using?
pycord
@tasks.loop(seconds=5)
async def status():
reference = db.reference(f"/")
value = reference.child(client_guild_name).get()
server_status = value["status_channel"]
print(server_status)
For a task loop, does anyone know how would you get the guild id/name?
i think syntax error for the or
yea it gave syntax
i'm trying to use *args with slash commands if possible
@paper sluice can you help with option choices in slash commands
and was hoping that bridge could help
u have to pass the name/id in the task loop somehow
try to get the slash commands working first before moving to the args part go one step at a time
yeah the slash command works
u get a input box thingy while calling a slash command, it kinda works like *, args
which lib? pycord?
yes
*, args turns all inputs into 1 string right?
@tasks.loop(seconds=5)
async def status(guild):
client_guild_name = bot.get_guild.name
reference = db.reference(f"/")
value = reference.child(client_guild_name).get()
server_status = value["status_channel"]
print(server_status)
Do you think something like this would work?
I'm unsure if the bot.get_guild.name is even possible.
I've never really used loops.
yes (only while working with bots, in normal python functions it does something else :)
the way i do this is i have my task loop inside a class and i use the bot db connection from the class init and use it in the task loop
ok so can i take my input and just store it in a list and then call for it later?
I don't think I'd be able to do that 😂
I'm still newer but I'll probably give it a try.
Thank you ^^
u can just put the task in ur cogs class and u can use the self.bot there should be simple for a beginner
even in main code u can just put task in directly and then use bot object since u have prolly declared it globally
I think I might try it in a cog, I have it in my main to put it together.
I'm new to databases and loops, so, just a bit confusing. Might need to just pull up something on them.
Global might be a simple fix though actually, hold on. lol
raise CommandInvokeError(exc) from exc
disnake.ext.commands.errors.CommandInvokeError: Command raised an exception: HTTPException: 400 Bad Request (error code: 40060): Interaction has already been acknowledged.```any idea?
Interaction has already been responded to

I-
sorry
How to add description to slash commands in pycord?
for?
It is at @bot.slash_command(description = "this thing")?
Actually nevermind it is.
But how do I add description to the args of slash commands?
ye on disnake. but idk abt the pycord lib
Should be the same on both ig.
Suppose the command is like
/test name:
how do i add description to that name?
iirc there is option that allows u to add descriptions to the args
not sure
@bot.slash_command(option = [some list])?
That makes sense.
Okay, last question. How do I add like infinite args in slash commands?
Or it's not possible yet?
ye
Like with the tradition commands it was like ctx, *, yourargs
or somethn
oh ion think u'll need that? in slash commands
I don't really need it but just asking.
cuz it already supports that?
I need it for like umm
Let's suppose I want to make a make a /rank command which will show me the rank of everyone I mention.
It could be one, it could be 10,
ah
well idk haha
any number. How do I create a command to show that?
/rank name1: p1 name2: p2 ......
Okay thennnn 1 moreee question. Do you know what are message commands? Are they just what the prefix commands are?
!d disnake.ext.commands.Greedy
class disnake.ext.commands.Greedy```
A special converter that greedily consumes arguments until it can’t. As a consequence of this behaviour, most input errors are silently discarded, since it is used as an indicator of when to stop parsing.
When a parser error is met the greedy converter stops converting, undoes the internal string parsing routine, and continues parsing regularly.
For example, in the following code:
```py
@commands.command()
async def test(ctx, numbers: Greedy[int], reason: str):
await ctx.send("numbers: {}, reason: {}".format(numbers, reason))
``` An invocation of `[p]test 1 2 3 4 5 6 hello` would pass `numbers` with `[1, 2, 3, 4, 5, 6]` and `reason` with `hello`...
this works on commands but idk if it will work on slash commands
I can experiment with that. Good to know. What about the replied question if you have any idea?
no idea 
Alright, thanks a lot tho' mate. You were really helpful!
class donations(commands.Cog):
def __init__(self, client):
self.client = client
@commands.command()
async def edonate(self, ctx, event, prize, *, msg):
embed1 = discord.Embed(title=f"{ctx.author.name} wants to make an event donation!", description=f" \n:dot_877959363388641300:**Event:** {event} \n:dot_877959363388641300:**Prize:** {prize} \n:dot_877959363388641300:**Message:** {msg}")
embed1.set_author(name=ctx.guild.name)
await ctx.send(embed=embed1)
async def setup(client):
await client.add_cog(donations(client))
command 'edonate' is not found | but i did load the cog
hey i wasnt able to find the question only so im hoping someone here might know. so im trying to find what the maximum size (in px) that an embed image can be?
if msg.content.lower() == '&skip':
ctx.bot.game_states[str(game_channel.id)].location = Locations.MainMenu
ctx.bot.game_states[str(game_channel.id)].Intro_Spoken = True
await game_channel.send("*Welcome to*\n "
this should only fire off if i type &skip right
because im having a problem where it appears to be firing off even if the msg isnt &skip
msg = await ctx.bot.wait_for('message', timeout=None, check=game_check)
yeah, if the message's content is &skip it should work
and if it isnt, then it should skip past right
because for some bizzare reason, it seems to be looping me back to that text anytime i enter a valid option, regardless of what it is
def game_check(message: discord.Message):
return message.author == ctx.author and message.channel == game_channel and message.content.lower() in [*ctx.bot.game_states[str(game_channel.id)].valid_game_options, 'pause', 'resume', 'inv', 'inventory', 'end', '&skip']
hang on gotta check something
this seems fine 
yeah; i presume its not a bug, but im not sure why its doing what its doing
How do I make the button to only be clicked by a particular role?
are you using Button class or the @button decorator?
Decorator
any teacher here?
have time for me and interest in guiding me?
any brother?
could i see your code, so i can get some reference how you want to use it
python, or discord.py?
is that a list in a list?
Discord is asking for verification now my bot is close to 100 users, what do you think about this
Should I give my id or not
if you want to verify your bot, thats the only way
it needs an ID to verify that you're over 16
Jump to "WHY DO I NEED AN ID"
Anyone know how to install the latest version of discord 2.0
pip install -U git+https://github.com/Rapptz/discord.py
You should consider upgrading via the 'C:\Users\thoma\Desktop\MyBot\venv\Scripts\python.exe -m pip install --upgrade pip' command.``` do you know how to fix this
it contains the answer ig
python3 -m pip install --upgrade pip
*--upgrade pip also, its not an error, its just a warning
yeah it should not be a problem installing discord v2.0
Python was not found; run without arguments to install from the Microsoft Store, or disable this shortcut from Settings > Manage App Execution Aliases.```
mb
you should probably be using py since you're on a windows system
try using py
ok
you have your python on path right ?
Well yes i am using py
seems like they do, else they would never get that warning from pip while installation.
you have installed python from microsoft store ?
pip install --upgrade pip
ic
umm no
from the website it self
i hate microsoft for having no fixed name for python installations, sometimes its py, sometimes its python or sometimes python3
Check the permissions.```
aah do you use vsc ?
Yes
try using powershell
@paper sluice you told me to put the decorator
If i want that if someone select yes option my bot send the dm to a user provided in the command
How to do that?
in the callback do something like if select[0] == 'yes': <code for sending dm>
I have a variable called {user} and {message} in the command
Will these varibales work ?
show code
Ok
I......don't know
its either, self.values[0] or interaction.data.get("name")[0]
both of those work
@paper sluice
import discord
from discord.ext import commands
class Dropdown(discord.ui.Select):
def __init__(self):
options = [
discord.SelectOption(label='Send', description='send the message', emoji='✍🏻'),
discord.SelectOption(label='Cancel', description='Cancel the message', emoji='❌'),
]
super().__init__(placeholder='Choose your favourite colour...', min_values=1, max_values=1, options=options)
class DropdownView(discord.ui.View):
def __init__(self):
super().__init__()
# Adds the dropdown to our view object.
self.add_item(Dropdown())
class dropdown(commands.Cog):
def __init__(self, bot):
self.bot = bot
@commands.command()
async def testing(self,ctx,user: discord.Member = None):
def check(msg):
return msg.author.id == ctx.author.id and msg.channel.id == ctx.channel.id
await ctx.send("what messaeg do you want to send?")
mes = await self.bot.wait_for('message', check=check,timeout=20)
view = DropdownView()
await ctx.send("Do you want to send the message?",view=view)
async def setup(bot):
await bot.add_cog(dropdown(bot))
I am getting this error
How to fix?
dude, u do the changes i told u to.....
ur still using the code from yesterday
I forgot the changes :( sorry
I did code yesterday and my code not saved
Idk why
i sent it today 🤦
When
^
Do i need to put that decorator in the class?
in DropDownView, u dont need the discord.ui.Select subclass
@paper sluice
import discord
from discord.ext import commands
class DropdownView(discord.ui.View):
def __init__(self):
# other initilzation stuff ...
super().__init__()
# Adds the dropdown to our view object.
@discord.ui.select(placeholder='Choose the option....', min_values=1, max_values=1, options=[
discord.SelectOption(label='Send', description='Send the message', emoji='✍🏻'),
discord.SelectOption(label='Cancel', description='cancel the message', emoji='❌'),
])
async def callback(self, interaction: discord.Interaction, select: discord.ui.Select):
class dropdown(commands.Cog):
def __init__(self, bot):
self.bot = bot
@commands.command()
async def dm(self,ctx,user: discord.Member = None):
await ctx.send("pls send the message you want to send!")
mes = await self.bot.wait_for('message', check=check,timeout=20)
view = DropdownView()
await ctx.send("do you want to send message?",view=view)
async def setup(bot):
await bot.add_cog(dropdown(bot))
Here is code
I am getting a EOL error
How to fix?
you didn't put anything in the callback....
Not for that
so are you just not going to tell
import discord
client = discord.Client()
@client.event
async def on_ready():
print('We have logged in as {0.user}'.format(client))
@client.event
async def on_message(message):
if message.author == client.user:
return
if message.content.startsWith('hello'):
await message.channel.send('Hello!')
I typed this code and the I typed hello in the chat nothing seems working, also I am just a beginner to discord.py and will appreciated if someone helps. thanks in advance.
its startswith not startsWith
thank you!
I'll tell
is there a lib that u can scrape bots from memberlist with?
Like i have a variable called {mes} and {user} in my command and i any the when someone click on send option it send dm to {user} and {mes} how to?
it's hard because you have to pass the member and text to your view
class DropdownView(discord.ui.View):
def __init__(self, member, text):
# other initilzation stuff ...
super().__init__()
self.member_to_send_to = member
self.text_to_send = text
class dropdown(commands.Cog):
def __init__(self, bot):
self.bot = bot
@commands.command()
async def dm(self,ctx,user: discord.Member = None):
await ctx.send("pls send the message you want to send!")
mes = await self.bot.wait_for('message', check=check,timeout=20)
view = DropdownView(user, mes.content)
await ctx.send("do you want to send message?",view=view)
the callback would look weird
Hmm
How would call back look?
Can you tell once it would be helpful to me
I don't know, I've only seen the variant where the Dropdown is a subclass of discord.ui.Select
where the value that was chosen is stored inside self.values
yes
!d discord.VoiceChannel.send now exists
await send(content=None, *, tts=False, embed=None, embeds=None, file=None, files=None, stickers=None, delete_after=None, nonce=None, allowed_mentions=None, reference=None, ...)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Sends a message to the destination with the content given.
The content must be a type that can convert to a string through `str(content)`. If the content is set to `None` (the default), then the `embed` parameter must be provided.
To upload a single file, the `file` parameter should be used with a single [`File`](https://discordpy.readthedocs.io/en/latest/api.html#discord.File "discord.File") object. To upload multiple files, the `files` parameter should be used with a [`list`](https://docs.python.org/3/library/stdtypes.html#list "(in Python v3.10)") of [`File`](https://discordpy.readthedocs.io/en/latest/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/latest/api.html#discord.Embed "discord.Embed") object. To upload multiple embeds, the `embeds` parameter should be used with a [`list`](https://docs.python.org/3/library/stdtypes.html#list "(in Python v3.10)") of [`Embed`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Embed "discord.Embed") objects. **Specifying both parameters will lead to an exception**.
and more
I mean I have my button as variable
And don’t mind me replying late
@commands.command()
async def edonate(self, ctx, event, prize, *, msg):
button1 = Button(label="Cancel", style=discord.ButtonStyle.red, emoji=":cross8:")
async def button_callback(interaction):
if interaction.button.label == "Cancel":
await interaction.response.send_message(f"{ctx.author.mention} your donation has been denied by {interaction.user.mention}")
if interaction.button.label == "Claim":
await interaction.response.send_message(f"{ctx.author.mention} your donation has been accepted by {interaction.user.mention}")
embed1 = discord.Embed(title=f"{ctx.author.name} wants to make an event donation!", description=f" \n:dot_877959363388641300:**Event:** {event} \n:dot_877959363388641300:**Prize:** {prize} \n:dot_877959363388641300:**Message:** {msg}", color = discord.Colour.random())
embed1.set_author(name=ctx.guild.name)
await ctx.send(embed=embed1)
!d discord.ui.View.interaction_check
await interaction_check(interaction)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
A callback that is called when an interaction happens within the view that checks whether the view should process item callbacks for the interaction.
This is useful to override if, for example, you want to ensure that the interaction author is a given user.
The default implementation of this returns `True`.
Note
If an exception occurs within the body then the check is considered a failure and [`on_error()`](https://discordpy.readthedocs.io/en/latest/interactions/api.html#discord.ui.View.on_error "discord.ui.View.on_error") is called.
@slate swan ^ use this
If I want people to enter args in a fixed way. How do I do that?
Like /test arg1: key1 arg2: key2 ...
Not /test arg2: key1 arg5: key2 ...
Also, what are those messages called which are dismissable and only visible to the person who used the command?
which library? and those are called ephemeral messages which can only be used with slash commands and views
discord2 or pycord
import discord
bot = discord.Bot()
@bot.slash_command()
async def uwu(inter, arg1: str, arg2: str):
...```
Possible to do like
if role in interaction.user.roles:
. . .
ew
sorry....
pycord moment
What if I want to do a .respond instead of ephemeral if a certain arg is true?
EW
Pycord, a maintained fork of discord.py, is a python wrapper for the Discord API - pycord/slash_basic.py at master · Pycord-Development/pycord
?
better switch to disnake or nextcord, thry are the same; but disnake's examples are better and updates are pushed earlier than py-cord, their last update to the lib was 5 days ago
from disnake.ext import commands
bot = commands.Bot() #all arguments are optional
@bot.slash_command()
async def test(inter: disnake.CommandInteraction):
...```
same
.ext uhh
comands
I'm gonna sound like a psycho, but consider hikari
commands
By the way, would you recommend switching to disnake?
You definitely are lmaoo.
okay that was rude 
Alright 👍
By the way, the GitHub in yout bio is probably ded. Link ain't loading.
sigh
thats why they shit on app commands
said that multiple times
I still won't use Client
bot has a CommandTree by default
but why do y'all use client.start now
so you can run 2000 bots in one script
shouldnt this work?
I want the bot to send the video link whenever the user with the ID says something
from disnake.ext import commands
import disnake
intents = disnake.Intents.default()
intents.members = True
bot = commands.Bot(intents=intents)
@bot.slash_command(name="test", description="...", guild_ids=[]) #if no guild_ids are specified, the command is globalized
async def _test(inter: disnake.CommandInteraction):
await inter.response.send_message("...", ephemeral=True)
bot.run("TOKEN")
This is for the description (both command and params)
Disnake:
@bot.slash_command()
async def give_cookies(inter: disnake.ApplicationCommandInteraction, disnake.User, amount: int = 1):
"""
Give several cookies to a user
Parameters
----------
user: The user to give cookies to
amount: The amount of cookies to give
"""
...
@client.tree.command()
@app_commands.describe(
user='The user to give cookies to',
amount='The amount of cookies to give',
)
async def give_cookies(interaction: discord.Interaction, user: discord.User, amount: int = 1):
"""Give several cookies to a user"""
...
lmao
This if statement will never be True
Cause two issues
String and not accessing ID attr
BTW @visual island did u see andy's solution
That sucks
Can bots add and read notes on user?
no
why would they need to? bots dont need discord to remember things, thats what a database is for
like you could store small data on notes for a particular user, like his settings for the bot without creating an additional file
not here.
Where ?
not really, read vcokltfre's message
I already read
Bro u know integer
It will not work
I swear I had a fucking stroke writing vco's full name 
we don't start var with numbers because it can be written normally
and it will raise invalid syntax
also if we hover to the id attribute it show literal int
Hence proved it is int
so u need to remove the quotes
so it's a integer
and it will work fine
it won't ever do that
it'll be a Member/User object, depending upon where the command/event was run/dispatched from
!e
1a = 2
print(1a)
@nimble plume :x: Your eval job has completed with return code 1.
001 | File "<string>", line 1
002 | 1a = 2
003 | ^
004 | SyntaxError: invalid decimal literal
See error
uh?
U didn't read my msg properly
I did, that's why I said that it's wrong
I'm talking about this in my 1st 2 lines
which api are you guys using for selfbot
ok
alright
U didn't read my msg properly again I said the attribute .id
!e
class Member:
cvar = 2
def __eq__(self, other):
return self.cvar == other
_ = Member()
print(_ == "uwu")
@slate swan :white_check_mark: Your eval job has completed with return code 0.
False
var with number? where are they using vars with numbers?
🤦♂️
...? that's what you wrote
I'm telling a fact so he don't string int
guys
Yes


