#discord-bots
1 messages Β· Page 129 of 1
i have problem my bot is running well and all but
when i type the command its not working idk why
async def on_message(message):
if message.author == client.user:
return
async def on_message(message):
if message.author == client.user:
return
if message.content.startswith('!play'):
await message.channel.send('now playing the song you sent')
await message.delete()
return```
you need to process commands
await asyncio.sleep(0)
how
my bot got ratelimited bcuz of this
ty
that makes absolutely no sense

what delay number should i put??
what endpoint are you calling that you're actually getting ratelimited on?
not zero lol
'builtin_function_or_method' object has no attribute 'choice'
full error
if you're trying to use numpy random it's numpy.random.choice
!e ```py
from random import random
random.choice
@vocal snow :x: Your 3.11 eval job has completed with return code 1.
001 | Traceback (most recent call last):
002 | File "<string>", line 3, in <module>
003 | AttributeError: 'builtin_function_or_method' object has no attribute 'choice'
Could send DMs but it throws an error that triggers:
await message.author.send(embed=embed)
AttributeError: 'ClientUser' object has no attribute 'send'
what should i change
the bot can't dm itself
and how to fix?
async def on_message(message):
if not message.guild:
embed=discord.Embed(title="DM this Bot is not allowed!", url="url", description="whoops this isn't in a server this is in dms", color=discord.Color.blue())
await message.author.send(embed=embed)
return
@slate swan
Check if the author is a bot or not probably π€·
Are your message content intents enabled?
yes
Hmm, here it looks like you have two on_message functions, but you only have one of them as an event
Just make one function
check if the message author is bot, if it is then return
@ bot.event?
ohhh wait
nvm
Yes, you use that to make a function an event handler. Just make a single on_message function, put that decorator on it, and put all your code under that
Donβt make two on_message functions with bot.event, one of them will end up overriding the other
async def on_ready():
print(f'Logged in as {Client.user}')
@Client.event
async def on_message(message):
if message.author == Client.user:
return
@Client.event
async def on_message(message):
if message.author == Client.user:
return
if message.content.startswith('!play'):
await message.channel.send('now playing the song you sent')
await message.delete()```

Looks like of of them is redundant anyway
Why does your Client instance have CamelCase?
Yeah, why is it different from what you had initially?
Adjust it back, only use snake_case for everything except classes. Makes it clear what is a class and what isnβt.
π
logging module: hold my beer π»
I still dont understand why they havent made a pr to change the namespaces
Yeah it bugs me how much of the builtins donβt follow the naming scemes
it's a bit odd seeing camelCase in your python code lol
it will be breaking for like almost every python application
intents = discord.Intents.all()
client = discord.Client(intents=intents)
token = ''
@client.event
async def on_ready():
print(f'Logged in as {client.user}')
@client.event
async def on_message(message):
if message.author == client.user:
return
@client.event
async def on_message(message):
if message.author == client.user:
return
if message.content.startswith('!play'):
await message.channel.send('now playing the song you sent')
await message.delete()
client.run(token)```
Right, guess ill have to use, asπ
monkeypatch π the module
On what function?
delete and make new function? await message.channel.send('now playing the song you sent')
No?
im confused sry
You have two on_message event functions. That second one will overwrite the first one, but the first one technically doesnβt do anything.
mhm
i see.....
then ima change it to on_delete_message
i wasnt aware sry if i wasted ur time @wicked atlas
wait nvm
Nah its good. Iβm in the middle of procrastinating my schoolwork.
Why?
i got it this time
Meant the message below it
i had the same on message function
You could just delete that first on_message function alltogether?
π
Anyone know why this doesn't work?
@tree.command(name = "addusertorep", description = "Adds a user to the database for Valcarries", guild = discord.Object(id = bot.guild_id))
async def addusertorep(interaction: discord.Interaction, user: discord.Member, startingrep: int):
async with aiosqlite.connect(r"C:\Users\Fiery\OneDrive\Desktop\AtomProjects\HyperionFund\Databases\Database.db") as db:
values = (user.Name, user.id, startingrep)
await db.execute("""INSERT INTO RepStorage (Username, DiscordID, RepAmount) values ( ?, ?, ?)""", values)
await db.commit()
I get this error ```py
discord.app_commands.errors.CommandInvokeError: Command 'addusertorep' raised an exception: InterfaceError: Error binding parameter 0 - probably unsupported type.
thats sqlite telling you the first value you passed to your query cant be understood
user.Name shouldnt exist though
the actual attribute you're probably referring to is .name, lowercase
I also have another query
I want to create an embed and I'd like it to edit the description to add a players username when the addusertorep command is run
Is editing embeds possible?
sure
you just need the Embed object that you're updating it to, and the Message (or PartialMessage) object that's going to be edited
Well if I get the bot to post an embed can I just copy the message ID and use that to grab the embed
The bit im most confused about is how I would edit the description to add the new players username
if your database stores all the information you need to create the embed, i wouldnt bother "editing" the actual embed that the message has
you can simply recreate the embed with what you know, and update the message with that
So you mean like deleting the embed message then grabbing the username for each record and using that to create a new embed?
But how would I get like the messageID for the new embed and save it
dont mix up "embeds" with the "message" itself
Would I have to save it in a database too
yes the channel and message ID would have to be saved
well the channel doesn't change so I can just make a variable and put the channel in it
But the messageID does change so I would most likely have to store it in a database and then delete the previous record in the database?
does the message normally change?
Only the description of the message will change
Of the embed sorry
Im a little confused on what you mean by does the messgae change
if you're referring to just editing the message, that by itself doesnt affect the message's ID
Yeah but wasn't your idea to delete the message and create a new one rather than editing it?
no, i didnt say that
oh
the Embed object can be recreated, and you can simply edit the message with your new embed object
oh!
thats what i mean by not mixing up "message" and "embed", because the message can be edited to display a new embed
dang makes more sense now aha
I'm just confused on how I would grab the Username for all records from the table and put them into the description of the embed
because doesn't it return it as a tuple?
each row would contain one user name (inside a tuple), so you have to fetch many rows at once to get all the names
Isn't that watch fetchall is for?
yeah
e.g. ```py
cursor = await conn.execute('SELECT name FROM players')
rows = await cursor.fetchall()
rows would look something like:
[('thegamecracks',), ('Fiery',), ...]```
result1 = await db.execute("SELECT Username FROM RepStorage")
result2 = result1.fetchall()
Since I used aiosqlite
Forgor await
But then if its returned as a tuple then how would I put it into my embed description?
figure out how to turn it into a string that looks nice
if you need help with how to do that, you should ask in a help channel
!d str.join
str.join(iterable)```
Return a string which is the concatenation of the strings in *iterable*. A [`TypeError`](https://docs.python.org/3/library/exceptions.html#TypeError "TypeError") will be raised if there are any non-string values in *iterable*, including [`bytes`](https://docs.python.org/3/library/stdtypes.html#bytes "bytes") objects. The separator between elements is the string providing this method.
I remember turning a tuple into an integer previously however that was only with one record
Doesn't that join them all together
Can someone please help me? I have the complete code for my Discord bot. It is in a .py file. How do I add the code to my bot?
bot.run(token)
token being the bots token
then run the py file
Cool thanks
ofc it does
!d map
map(function, iterable, /, *iterables)```
Return an iterator that applies *function* to every item of *iterable*, yielding the results. If additional *iterables* arguments are passed, *function* must take that many arguments and is applied to the items from all iterables in parallel. With multiple iterables, the iterator stops when the shortest iterable is exhausted. For cases where the function inputs are already arranged into argument tuples, see [`itertools.starmap()`](https://docs.python.org/3/library/itertools.html#itertools.starmap "itertools.starmap").
Yeah I sort of need them to have like a space between them
?
!e
seq = [1, 2, 3, 4, 5]
try:
print("-".join(seq))
except:
print("1 doesnt work")
try:
print("-".join(map(str, seq)))
except:
print("2 doesnt work")
@alpine cove :white_check_mark: Your 3.11 eval job has completed with return code 0.
001 | 1 doesnt work
002 | 1-2-3-4-5
?
wait so technically could I use \n instead of - and it would print them on seperate lines?
that is correct
Dang alright thanks ill try it out now
np
Hi short question, i want that the bot is sending something when a new Record is in Database (Mysql). At the moment i am doing it with a loop but i think there should be a better way without looping, just with listining or sth like that?
@tasks.loop()
async def verification_code(cursor) -> None:
cursor.execute("SELECT * FROM password_forgot")
records = cursor.fetchall()
print("Total number of rows in table: ", cursor.rowcount)
print("\nPrinting each row")
for row in records:
print("Id = ", row[0], )
print("Name = ", row[1])
print("Code = ", row[2])
print("Date = ", row[3], "\n")
await asyncio.sleep(10)
wait how do I get a pre existing message into a variable so that I can use msg.edit
I have the message ID of the message however I can't find the function to get the actual message object
if that makes any sense
!d discord.TextChannel.fetch_message
await fetch_message(id, /)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Retrieves a single [`Message`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Message "discord.Message") from the destination.
Positional-only argument
How can i do an on lookup to mysql if something have added
discord.app_commands.errors.CommandInvokeError: Command 'addusertorep' raised an exception: NameError: name 'fetch_message' is not defined
?
does it need to be imported ?
i doubt it but it somehow went wrong
no you'll have to grab a TextChannel object, you can do that via Bot.get_channel (search from the cache) or Bot.fetch_channel (fetches the info from the discord api itself)
also, both the methods are available for a Guild object too
I have the text channel object so it would just be channel.fetch_message?
sure
Alright
discid = (user.id)
result3 = await db.execute("SELECT * From RepStorage Where DiscordID = ?", discid)
what will this return if no record has a discord ID matching it?
nil?
Can I send a Direct message with a Python Bot if i have only the Name with Tagg of a Person (Probably not on the same Server as the bot)
think true
you must first run the fetchall or fetchone method on it
if you use fetchone and the id is inexistent, it's gonna return None
in case of fetchall it'll return an empty list
what's the issue?
what is the documentation for ctx
congrats
guys anyone knows how i make those black boxes inside an embed ?
!d discord.ext.commands.Context
class discord.ext.commands.Context(*, message, bot, view, args=..., kwargs=..., prefix=None, command=None, invoked_with=None, invoked_parents=..., invoked_subcommand=None, ...)```
Represents the context in which a command is being invoked under.
This class contains a lot of meta data to help you understand more about the invocation context. This class is not created manually and is instead passed around to commands as the first parameter.
This class implements the [`Messageable`](https://discordpy.readthedocs.io/en/latest/api.html#discord.abc.Messageable "discord.abc.Messageable") ABC.
you need a backtick
thx
how ?
backtick is `
use
```language
text
```
inside the description of the embed or the value of an embed field
how did you make it so it doesnt make the thing
!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.
ah ok
ok
!d discord.Message
class discord.Message```
Represents a message from Discord.
x == y Checks if two messages are equal.
x != y Checks if two messages are not equal.
hash(x) Returns the messageβs hash.
and how do i put it in an embed ?
just make an embed and put it inside
but how
um, could you use #bot-commands for self-serving commands?
i cant use enter things
to make an embed?
no
i think you can't do it in the title
I hate my life
alright So then I could do like
result4 = result3.fetchone()
if result4 == None:
do blah blah
π₯΄
lol
- It will only work in descriptions or values of embed fields
- use triple quotes
ah ok
o_o
still error
when comparing between boolean values, it is better to use the is keyword instead of the == operator
triple quotes not double quotes for strings
so if result4 is None?
right
ye its triple
Alright will give it a go now
got a problem my bot doesent want to work even if the code is the same what should i do?
those are double
ow huh ?
!intents
Using intents in discord.py
Intents are a feature of Discord that tells the gateway exactly which events to send your bot. By default discord.py has all intents enabled except for Members, Message Content, and Presences. These are needed for features such as on_member events, to get access to message content, and to get members' statuses.
To enable one of these intents, you need to first go to the Discord developer portal, then to the bot page of your bot's application. Scroll down to the Privileged Gateway Intents section, then enable the intents that you need.
Next, in your bot you need to set the intents you want to connect with in the bot's constructor using the intents keyword argument, like this:
from discord import Intents
from discord.ext import commands
intents = Intents.default()
intents.members = True
bot = commands.Bot(command_prefix="!", intents=intents)
For more info about using intents, see the discord.py docs on intents, and for general information about them, see the Discord developer documentation on intents.
instead of "'''
do '''
thanks
!e
print("""Hello
World""")
@naive briar :white_check_mark: Your 3.11 eval job has completed with return code 0.
001 | Hello
002 | World
what is better to use?
class MyClient(discord.Client):
async def on_message(self,message):
if message.author.id == self.user.id:
return
if message.content.startswith("-hi"):
await message.reply("hello")
or
intents = discord.Intents.default()
intents.message_content = True
bot = discord.ext.commands.Bot("-", intents=intents)
@bot.command(name="name")
async def name(ctx):
await ctx.reply("h")
use the later one, the former is quite outdated
ok thx
what
Error:
discord.app_commands.errors.CommandInvokeError: Command 'addusertorep' raised an exception: ValueError: parameters are of unsupported type
Code:
async with aiosqlite.connect(r"C:\Users\Fiery\OneDrive\Desktop\AtomProjects\HyperionFund\Databases\Database.db") as db:
values = (user.name, user.id, startingrep)
discid = (user.id)
result3 = await db.execute("SELECT * From RepStorage Where DiscordID = ?", int(discid))
result4 = result3.fetchone()
if result4 == None:
bruh wdym outdated commands.Bot is subclass of Client
put a comma (,) so as int(discid,)
ok
very informative but I know that
Why π€¨
then how is it 'outdated'?
same error
same question π
so should i use Bot or Client
client is for interactions only bot ie app commands
doesent work
you can use either one depending on the use case, if you wanna make prefix commands, you would want to use Bot
?
commands.bot allows prefix commands and allows cogs
alright
what does cog do
meaning u cant have prefix commands in client slash commands only
how can i split buttons up into custom_id ? like how can i do the "if custom_id == blablabla" ?
Asher
π average godly piece of advice
tf wdym
Client isn't only for slash commands lmao (I know you know so)
oh
it would have been better if u elaborated instead of just saying its outdated
@client.event
async def on_message(message):
if message.author != client.user:
msg = message.content
await client.process_commands(msg.content.lower())
Traceback (most recent call last):
File "/home/runner/game-bot/venv/lib/python3.8/site-packages/discord/client.py", line 409, in _run_event
await coro(*args, **kwargs)
File "main.py", line 19, in on_message
await client.process_commands(msg.content.lower())
AttributeError: 'str' object has no attribute 'content'
too much work π I'm lazy
didnt wor?
help please π
i defined it as integer in database
trying to make commands not case sensitive and I get this error, any help?
@client.event
async def on_message(message):
if message.author == client.user:
return
msg = message.content
blah blah blah
user.id will always be an integer by default really
Exactly
how is that going to work
yeah you shouldn't need to typecast it again
oh oops
I got the error without typecasting it
hence why im trying it
I totally messed up π I got confused up in the parantheses hence the error again
send ur function
@client.event
async def on_message(message):
# if message.author != client.user:
# you dont really need this part
msg = message.content
blah blah blah
(im not very experienced so my apologies if it doesnt work)
async def addusertorep(interaction: discord.Interaction, user: discord.Member, startingrep: int):
async with aiosqlite.connect(r"C:\Users\iamro\OneDrive\Desktop\AtomProjects\HyperionFund\Databases\Database.db") as db:
values = (user.name, user.id, startingrep)
discid = (user.id)
result3 = await db.execute("SELECT * From RepStorage Where DiscordID = ?", int(discid,))
result4 = result3.fetchone()
if result4 == None:
@slate swan
its a slash command btw
message.content = message.content.lower()
await client.process_commands(message)
got it with this so now commands arent case sensitive π
smart
i might steal that
try doing
(int(discid),)
and that should fix it
alr
oh yeah
and if it dosent exist its gonna return an empty iterable
from latest dpy version yes
{"1031053618008301588": {"money": 4092, "bank": 3432423, "totalmny": 28993}, "994474388042813450": {"money": 1536, "bank": 5000, "totalmny": 1536}, "950652516708782120": {"money": 1331, "bank": 5000, "totalmny": 1664}, "812729257968009256": {"money": 1500, "bank": 5000, "totalmny": 1500}, "1022261701850169445": {"money": 1500, "bank": 5000, "totalmny": 1500}, "695051432302346271": {"money": 1500, "bank": 5000, "totalmny": 1500}}
yes
was told if I use fetchone it would return None
lemme check the docs i dont use aiosqlite
async fetchone() β Optional[sqlite3.Row]
Fetch a single row.
yeah None
i dont think so coz if u pass datetime the task loop is supposed to run at that point in time everyday not sure if u can put multiple kwargs never tested
also shouldnt it be result3.fetchone() since the variable above is named result3
yeah await it
@discord.ext.tasks.loop(*, seconds=..., minutes=..., hours=..., time=..., count=None, reconnect=True)```
A decorator that schedules a task in the background for you with optional reconnect logic. The decorator returns a [`Loop`](https://discordpy.readthedocs.io/en/latest/ext/tasks/index.html#discord.ext.tasks.Loop "discord.ext.tasks.Loop").
it can take integers too
i store a timestamp in db and use that in the taskloop to find timedelta and calculate
if the bot restarts the loop starts again
i love making economy bots (totally)
@tasks.loop(hours=12)
async def my_loop() -> None:
old_time = datetime.fromtimestamp(await bot.db.get_time())
if (datetime.datetime.utcnow() - old_time).days >= 7:
...
something along these lines
yes
neither of the queries you supplied worked π¦
discord.app_commands.errors.CommandInvokeError: Command 'addusertorep' raised an exception: ProgrammingError: Incorrect number of bindings supplied. The current statement uses 1, and there are 2 supplied.
dosent seem related to the query
result3 = await db.execute("SELECT * From RepStorage Where DiscordID = ?", ("", discid))
π
I had it like this before though
result3 = await db.execute("SELECT * From RepStorage Where DiscordID = ?", (discid))
and it wasnt working
How do I timeout a user?
result3 = await db.execute("SELECT * From RepStorage Where DiscordID = ?", (discid,))
how can i modify this line so that the bot can send the message to the 1st text channel of every guild?
!d discord.Member.timeout
await timeout(until, /, *, reason=None)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Applies a time out to a member until the specified date time or for the given [`datetime.timedelta`](https://docs.python.org/3/library/datetime.html#datetime.timedelta "(in Python v3.11)").
You must have [`moderate_members`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Permissions.moderate_members "discord.Permissions.moderate_members") to do this.
This raises the same exceptions as [`edit()`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Member.edit "discord.Member.edit").
ty
iterate through bot.guilds and use guild.text_channels[0]
It underlines the timeout part
if text_channels := guild.text_channels:
await text_channels[0].send(...)
thx guys
discord.ext.commands.bot: Privileged message content intent is missing, commands may not work as expected.
what should i do?
Enable message_content intent
Anyone know how i get it to not have these brackets and parenthesis?
discord.ext.commands.bot: Privileged message content intent is missing, commands may not work as expected.
!d discord.Intents.message_content
Whether message content, attachments, embeds and components will be available in messages which do not meet the following criteria:
β’ The message was sent by the client
β’ The message was sent in direct messages
β’ The message mentions the client
This applies to the following events...
await db.execute("""INSERT INTO RepStorage (Username, DiscordID, RepAmount) values ( ?, ?, ?)""", values)
await db.commit()
await interaction.response.send_message(f"Succesfully added the user {user.name} to the database!")
result1 = await db.execute("SELECT Username FROM RepStorage")
result2 = await result1.fetchall()
channel = interaction.guild.get_channel(bot.valcarrierchannel)
message1 = await channel.fetch_message(bot.valcarriermessage)
embed = discord.Embed(title = "List Of Verified ValCarriers", description = ("\n".join(map(str, result2))) )
embed.set_thumbnail(url = "exampleURL")
await message1.edit(embed = embed)
my code ^^
Get the string from the tuple
Isn't that what
("\n".join(map(str, result2)))
``` does
It's just converting elements in result2 to string and join them
so how would I get the string from the tuple and then join them
I would use for loop
!e
result2 = (("mmm",), ("000",))
print("\n".join(i[0] for i in result2))
@naive briar :white_check_mark: Your 3.11 eval job has completed with return code 0.
001 | mmm
002 | 000
π€·
!e
result2 = (("mmm",), ("000",))
print (sum(result2, tuple()))
@shrewd apex :white_check_mark: Your 3.11 eval job has completed with return code 0.
('mmm', '000')
python 
π³
is there a way to use mongodb to take away a role tmrw
mongodb to take away a discird role?
ye
how can i make a command that reads a number after the command like im using this but i want to specify that amount on discord ```@bot.command()
async def ren(ctx, amount=100):
await ctx.channel.purge(limit=amount)
instead u can use discord to take away a discord role
do ren 20 while typing
or whatevere number u want
it deosent work
it needs to read the number after but idk how
since there its just deleting in the limit
how do u enter the command?
like 100 thats how much messages it will delete
? you talking about the bot's prefix?
i use ΓΈ since its easier for me
im saying that i want to specify how much messages i want to delete
what happend when u type ΓΈren <ur_number_here>
it deletes 100 messages
bro just enter a number other than 100
since it deletes in the limit=amount
thats the whole point of commands
but i want to type it on discord not on the script
I need to create a leaderboard command for my database,
I need to somehow match all records that have the same UUID
then I need to add the Column Called Amount for all the records with the same UUID
and then I need to compare the sum against other UUIDS to find the top 10 with the most total Amount.
Where do I even begin?
Hey @slate swan!
You either uploaded a .txt file or entered a message that was too long. Please use our paste bin instead.
https://paste.pythondiscord.com/ofuxavaker
so this is my inventory command but for some reason it only shows your inventory even when the other person is in the db
Seems like SQL
im dumb
order by amount limit 10
The issue is I'm not very confident in my SQL skills
similar syntax
But I need to factor in the UUIDs
basically pseudocode select * from table where x = ? order by whatever acs/dsc limit 10
also if u need sum of selected values use the sum() in sql
We sadly aren't wizards we need to know how your DB is structured.
why is it like this tho?
Like so when a new donation is logged it creates a record with their UUID, username and the Amount
whats wrong with just updating a single value
Why even have the username
my guess is uuid is not generated by him
bro just use the user id
dosent explain why u need two rows
The username can change
Wait no
The two rows are seperate donations
just from the same person
this api doesnt support lists? also why u need them seperate?
I will make a query I'm mid game rn tough lol
and vice versa
"SELECT UUID FROM table WHERE Username = ? ORDER BY SUM(AMOUNT) DESC LIMIT 10"
on these lines mind u i aint done sql in like 2 months so not sure
But heres my issue
Why would you sum amount if it's a single value lol
Like The sum of all amounts would have to be the sum of the amounts with a certain UUID
its multiple right he has multiple records
and I have to check this for every UUID in the table
or similar rows
And then find the top 10 totals
bro y are u making multiple rows in first place then
I thought that would be the best option at the time
But now its made it more complicated
I guess I could change the code to add to amount if the user is already in the database
Yeah for this query we need to debug since this is not a small query lol
Lemme fire up a dummy db
oh
I just started changing my code so that each UUID would only have one record
In a Slash command how do i add an argument as a user
Sorry, I mean like when you use a slash command it asks you for a user
like /test @winged linden ?
yeah
user: discord.Member
but in slash command form
I believe
how would I use that?
put it in the arguments of the command?
async def test(interaction: discord.Interaction, user: discord.Member)
i can do it in 2 queries not sure about one
actually one also possible
just fetch all data then sum up and sort the list get first ten
I just changed the actual command π
I want to add a UI button to a cog, but I get this error:
TypeError: expected an instance of View not <class 'type'>
wrong place to ask?
ok figured it out
!intents
Using intents in discord.py
Intents are a feature of Discord that tells the gateway exactly which events to send your bot. By default discord.py has all intents enabled except for Members, Message Content, and Presences. These are needed for features such as on_member events, to get access to message content, and to get members' statuses.
To enable one of these intents, you need to first go to the Discord developer portal, then to the bot page of your bot's application. Scroll down to the Privileged Gateway Intents section, then enable the intents that you need.
Next, in your bot you need to set the intents you want to connect with in the bot's constructor using the intents keyword argument, like this:
from discord import Intents
from discord.ext import commands
intents = Intents.default()
intents.members = True
bot = commands.Bot(command_prefix="!", intents=intents)
For more info about using intents, see the discord.py docs on intents, and for general information about them, see the Discord developer documentation on intents.
where should I?
oh
"SELECT Username, SUM(Amount) FROM mytable GROUP BY UUID ORDER BY SUM(Amount) DESC LIMIT 10"
π
gurantee it works
that Worked!! thanks so much, Any idea on how to make that optional?
optional?
why
bro
I have been trying to tell you i WAS changing my code
what did i miss here? i want to loop through every channel and send a message, the bot starts with no errors but it doesnt send anything
ik i took it as an assignment or something
So the user can use themselves
You need to wake up at 7 then execute the command for the task to go again.
Did your ticket_launcher class subclass discord.ui.View?
||You can't put a command in a task ||
but can i put a task in the command?
Uhm
i dont want to mess with slash commands they seem hard π₯Ί
Did you call the supers initializer?
Well I'll save it because im sure ill find it useful in the future lol
not working bro what line i put it
There's literally an example on the embed
what u are logging just dispatch a custom event
Here is the cog file in full view
So basically we run like a charity on a mc server
And we were going to log all the donations we handed out
W
but its a little time consuming to run a command considering theres 100s of people daily
thats why use an event
wdym
how do they donate?
On minecraft via trading
I'd have to make a minecraft mod
but i do not know java π¦
this is smart....
never thouht of getting the channel
oh rip nvm idk mc either but if can create a webhook and trigger it everytime someone donates that might do the job
Yeah it would but I also have to change the database when donation
And even like detecting when someone donates will be difficult
since its not like theres any api which tells you when someone trades
hypixel aint making it easy
so for now we are just changing it to where we log the total amount we give out per day
and then when I understand how to make a mc mod I can revert back to this system
hypixel is an L (Ive never played it)
Does anyone have an explanation as to why line 64 raises the error?
Can you provide a full traceback?
Hey @slate swan!
You either uploaded a .txt file or entered a message that was too long. Please use our paste bin instead.
@sick birch #community-meta message well rip
so i found some code about breach checking and i want to make the print commands into message.channel.send so it doesnt print the output but it sends it to the user
[2022-11-11 19:23:45] [INFO ] discord.client: logging in using static token
[2022-11-11 19:23:47] [INFO ] discord.gateway: Shard ID None has connected to Gateway (Session ID: 0e7114365fa541c3d2d29c0176a77625).
C:\Users\marko\Desktop\Heroku-Bot-main\main.py:106: RuntimeWarning: coroutine 'init_example' was never awaited
init_example()
RuntimeWarning: Enable tracemalloc to get the object allocation traceback
Where does discord say economy bots are ToS violating?
Not being combative I'm just curious
Since dank memer is not in the app discovery because of the economy
in this the user inputs the string and the program checks of the user is breached but i need to make the string variable password to be message.content
Can you also pastebin the code for the entire cog file?
I'm on my phone rn but it does say it in the tos
wait so
Would you mind pointing me to the appropriate clause when you can?
am i required to remove my gambling commands from my bot
Sure can when I finish up eating
can someone help me with this ?
It's just so many people do economy bots so I want to make sure that it's TOS violating
Also this is news to me :p
You forgot the ()
ticket_launcher()
I would suggest you remove that like because you're going to be adding the view soon anyway
You'd be adding it twice
so is this gambling command against discord ToS?
https://paste.pythondiscord.com/orenotujuk
If it's for real-world value, yes
wait no
its just my bot currency
not irl currency
(other than the electricity/internet bill π€£)
If there is no real money in line, then I guess you're safe
okay ty
@sick birch It's complicated.
App Directory: Discovery
The App Directory is a discoverable surface where server owners and admins can browse through a variety of verified apps and add them to their servers. In order for apps to...
Discord was designed to bring people together. It is our hope that users on our platform are able to meaningfully connect with others around common interests. Partnerships with individuals, organiz...
real-world value.
"Gambling-adjacent or addictive behavior"
Most economy bots dont offer real world value but value in their own coins
Thank you so much for finding it
It's for the app directory, so it's not against ToS I presume.
Either way most economy bots dont offer gambling, even if something is addicting i doubt they would care enough, after all addiction is a very sensitive topic
Allot of gatekeeping would appose from such discussion
can anyone help me make a message transcript for tickets?
fileName = f"{ctx.channel.name}.txt"
with open(fileName, "w") as file:
async for msg in ctx.channel.history(limit=None):
file.write(f"{msg.created_at} -
{msg.author.display_name}:
{msg.clean_content}\n")
I have this but i need help implementing it
how do I get the time a message was created at?
is any1 able to help me make sum its a few lines of code and would help me so much :)) dm
Are you sure that the API is actually returning an image?
like how do you make the bot copy your message and return it in a message?
u didnt process cmds
await client.process_commands(message)
or
await bot.process_commands(message)
wdym?
The same one as the embed's image?
oh ill try that
put what I sent
like how do you make the bot copy your message and return it in a message??
@slate swan
yo
Do you have message_content intent enabled
do this
@client.event
async def on_message(message):
msg = message.content
await message.channel.send(msg)
@slate swan
forgot to add something
which
@client.event
async def on_message(message):
msg = message.content
if message.author != client.user:
await message.channel.send(msg)
sorry but where does that go π
oh? but u said "put what i sent"

ohh
anywhere in your on_message
put it at the very top
if u rlly care
tickets yay
how do you make an argument optional in a slash command?
AttributeError: 'aclient' object has no attribute 'process_commands' π’
@dense flower send me the code
discord.Client doesn't have process_commands method
Only discord.ext.commands.Bot
And he's making his commands in on_message event for some odd reason
you need to define a default value for it
How can I make the discord.Buttons all next to each other instead of like under each other?
how do you make code stop and wait for user to write
you need to set the row keyword
!d discord.ui.Button
class discord.ui.Button(*, style=<ButtonStyle.secondary: 2>, label=None, disabled=False, custom_id=None, url=None, emoji=None, row=None)```
Represents a UI button.
New in version 2.0.
thanks
is the first row 0?
!d discord.Client.wait_for
wait_for(event, /, *, check=None, timeout=None)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Waits for a WebSocket event to be dispatched.
This could be used to wait for a user to reply to a message, or to react to a message, or to edit a message in a self-contained way.
The `timeout` parameter is passed onto [`asyncio.wait_for()`](https://docs.python.org/3/library/asyncio-task.html#asyncio.wait_for "(in Python v3.11)"). By default, it does not timeout. Note that this does propagate the [`asyncio.TimeoutError`](https://docs.python.org/3/library/asyncio-exceptions.html#asyncio.TimeoutError "(in Python v3.11)") for you in case of timeout and is provided for ease of use.
In case the event returns multiple arguments, a [`tuple`](https://docs.python.org/3/library/stdtypes.html#tuple "(in Python v3.11)") containing those arguments is returned instead. Please check the [documentation](https://discordpy.readthedocs.io/en/latest/api.html#discord-api-events) for a list of events and their parameters.
This function returns the **first event that meets the requirements**...
ty
I know this is an incredibly lazy way to make an embed but does anyone know why when I type !insertembed i'm not getting the embed back?```py
@client.event
async def on_message(message):
if message.content.startswith('!insertembed'):
embedVar = discord.Embed(title="Title", description="", color=0x00ff00)
embedVar.add_field(name="line1", value="",inline=False)
embedVar.add_field(name="line2", value="",inline=False)
embedVar.add_field(name="line3", value="",inline=False)
await message.channel.send(embed=embedVar)
msg = 'Hi {0.author.mention}'.format(message)
await client.send_message(message.channel, msg)```
send_message has been gone for an aeon
probably consider using a bot instead of a client too
oh so trash this? ```py
class aclient(discord.Client):
def init(self):
super().init(intents=discord.Intents.default())
self.synced = False
async def on_ready(self):
await self.wait_until_ready()
if not self.synced:
await tree.sync(guild=discord.Object(id=1040618103249326181))
self.synced = True
print(f"We have logged in as {self.user}.")```?
if you're gonna be coding commands, I'd recommend it, yes. Also, don't sync automatically either
do you have any resources you could recommend? Most stuff seems really outdated
is there any way to accept an attachment through slash commands
use discord.Attachment as the arg type hint
Hello, it helped tysm! is there any way to get the image url out of this?
!d discord.Attachment
class discord.Attachment```
Represents an attachment from Discord.
str(x) Returns the URL of the attachment.
x == y Checks if the attachment is equal to another attachment.
x != y Checks if the attachment is not equal to another attachment.
hash(x) Returns the hash of the attachment.
Changed in version 1.7: Attachment can now be casted to [`str`](https://docs.python.org/3/library/stdtypes.html#str "(in Python v3.11)") and is hashable.
use the url attribute
anyone familiar with this error msg
WARNING discord.gateway Shard ID None heartbeat blocked for more than 10 seconds.
you're blocking
my bot is still working fine but it spit out this error msg every once in a while
blocking?
ty ty
Lord have mercy.
@slate swan Don't advertise paid work here please.
Are you still there?
How can I disable all commands on dms of bot?
Hosting service?
!d discord.ext.commands.dm_only
@discord.ext.commands.dm_only()```
A [`check()`](https://discordpy.readthedocs.io/en/latest/ext/commands/api.html#discord.ext.commands.check "discord.ext.commands.check") that indicates this command must only be used in a DM context. Only private messages are allowed when using the command.
This check raises a special exception, [`PrivateMessageOnly`](https://discordpy.readthedocs.io/en/latest/ext/commands/api.html#discord.ext.commands.PrivateMessageOnly "discord.ext.commands.PrivateMessageOnly") that is inherited from [`CheckFailure`](https://discordpy.readthedocs.io/en/latest/ext/commands/api.html#discord.ext.commands.CheckFailure "discord.ext.commands.CheckFailure").
New in version 1.1.
!intents
Using intents in discord.py
Intents are a feature of Discord that tells the gateway exactly which events to send your bot. By default discord.py has all intents enabled except for Members, Message Content, and Presences. These are needed for features such as on_member events, to get access to message content, and to get members' statuses.
To enable one of these intents, you need to first go to the Discord developer portal, then to the bot page of your bot's application. Scroll down to the Privileged Gateway Intents section, then enable the intents that you need.
Next, in your bot you need to set the intents you want to connect with in the bot's constructor using the intents keyword argument, like this:
from discord import Intents
from discord.ext import commands
intents = Intents.default()
intents.members = True
bot = commands.Bot(command_prefix="!", intents=intents)
For more info about using intents, see the discord.py docs on intents, and for general information about them, see the Discord developer documentation on intents.
yeah what's up
data = r.json()['objects']
for all in data:
indice = all['level']
embed.add_field(
name = 'level',
value = f'{indice}'
)``` how to display all the values that are printed in the value field
enable it from the dev portal
read the full error for god's sake
you gotta run the code again though, did you?
and whats the full error you get
is it necessary to be that hostile tho
everyone makes mistakes when starting out, allow it
^
sorry what? im sorry if that came out as rude
can you send the full error in pastebin, cant really guess with the partial one
!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.
you haven't set your token x
oh i mean if ur using replit u should set ur token as a secret anyway
just use default intents as long as you don't actually need them
discord.Intents.default() for start
change your intents
to discord at the start
bro cmon
don't name a variable with buit-in name
bro ur the reason people shit on new people asking questions
ur not trying
i did
i literally said replace your intents with the line
did discord/python changed the way u interact with bots? cause all the bots I've made in the past dont work anymore
just put ur token in there lol
discord.py has made some changes, yes
ah I see
you can read about the changes made in 2.0 here:
https://discordpy.readthedocs.io/en/stable/migrating.html
I wonder where we are right now...
you need to actually put in your bot token, not just the text token
smh
In what way does it not work?
show the errror you get when u run it with the code
you need to pass the intents object you've created to your client
client = discord.Client(intents = intents)
you sure?
shouldn't be
There isn't some built-in user-level cooldown system for Discord buttons in discord.py is there?
Can you show the error?
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.
You need to define it then
Well idk what any of that means but do you have intents enabled on the developer portal
Then you need to enable them all in your code as well. You only enabled default and members

The same way you did members but with the rest
Or turn off the ones you don't need in the dev portal if you only need members
that one looks like a replit issue π
one of the reasons you don't host bots on replit
Fact: I am approaching the 500th line of code for a single slash command and it is becoming exponentially more painful to go on.
yeah, the problem with replit is that there are many other people just like you trying to host a bot, and all these requests to the discord api are being made from one IP address. Cloudflare, the service protecting discord's apis from DDoS attacks doesn't like this large ammount of requests, and blocks the IP from making api requests. That error you're seeing has HTML for cloudflare's block page.
I know the struggle. I never want to touch my on_message again lmao
Am I just being painfully inefficient? 
maybe
async def main():
try:
pool_ = asyncpg.create_pool(host="*", database="*", user="*", password="*")
except:
pool_ = asyncpg.create_pool(host="*", database="*", user="*", password="*")
async with ClientSession() as session_client, pool_ as pool:
intents = discord.Intents.default()
intents.members = True
async with Bot(commands.when_mentioned,
db_pool=pool,
web_client=session_client,
initial_extensions=['cogs.configuration', 'cogs.developer', 'cogs.info'],
intents=intents
) as bot:
print('starting...')
await bot.start('...')
asyncio.run(main())
is what im using right now
bot remains offline, even after going past the print line
im very lost
Cereal I dunno about you but I'm personally not gonna help someone to make a bot say that to someone.
I don't think it's against rules unless we discuss it. Shall we consult <@&831776746206265384> ?
bro you still didn't get it to work @slate swan ?
after pinging them yes
Quickest way to get one usually 

bro did windows so badπ€Ί imagine a taskbar at da top
totally like it as a xfce default user
Lmao I hadn't even noticed. I did that once on accident though when I was a kid. Had to google how to change it back lol
Correction: about 600 because I also had to build an entire system for evaluating Poker hands and find the strongest hand

Down side of building something nice
Does anyone know why @app_commannds.checks.has_any_role(adminrole) isn't affecting whether or not a user can call joined? in this block of code?py @bot.command() @app_commands.checks.has_any_role(adminrole) async def joined(ctx, member: discord.Member): """Says when a member joined.""" await ctx.send(f'{member.name} joined {discord.utils.format_dt(member.joined_at)}')
If I'm not mistaken you need the role ID?
its okay i had to write 300+ lines just for the client
you use commands.has_any_role for prefix commands
I thought it was just the name you needed? I've got adminrole set to the name of the role
Dawg what were you tryna do
ohhh ok ty
i made my own api wrapper lol
Why does it differentiate between two different commands for slash and prefix π
cause prefix commands work with a message context
app commands on other hand works with interactions
Yea I missed that you weren't using a slash command with that. They differentiate between the two with .checks.
wait I think i'm a bit lost, prefix commands react to your message context tho no?
eh either way I think i've just got a decent bit to revise haha
yes
they basically wrap the Message object to a Context object
oh yeah so like how i'm doing ?joined, but I don't understand why the same @strange knoll_commands can't be applied, is it just cause of the way it's wrote in the library?
probably a really dumb question lmao
just hoping to try wrap my head around it
thats just because the library is written that way
only ext.commands related checks will be added to a command for checks
same goes for app commands
comamnds.has_any_role won't work on an app command
so just to be clear ext.commands is for prefix, and app_commands is for /
ok cool
ποΈ
exactly, app_commands supports context menus as well
ok cool
Yea if it says app commands it's referencing some sort of interaction based event
and then there's hybrid commands which mix the slash and prefix commands
to get this to work with a prefix, would I change @tree.error to @bot.event?py @tree.error async def on_app_command_error(interaction: discord.Interaction,error: discord.app_commands.AppCommandError): if isinstance(error, discord.app_commands.errors.MissingRole): await interaction.response.send_message("You don't have permission to use this command", ephemeral=True) else: await interaction.response.send_message("An error occurred, please try again later.", ephemeral=True) raise error
bruhhhh why π
wait that can't be right cause there's interactions
yeah that shouldn't be it
I think my main issue is i'm not sure where i'm looking in the docs of discord.py π
You have interactions and text commands in your bot?
i've got one prefix command i'm trying to get to work rn which is "?joined" and it returns a line of text
basically just trying to set it to admin only
!d discord.app_commands.CommandTree.error it would be tree.error yes
@error(coro)```
A decorator that registers a coroutine as a local error handler.
This must match the signature of the [`on_error()`](https://discordpy.readthedocs.io/en/latest/interactions/api.html#discord.app_commands.CommandTree.on_error "discord.app_commands.CommandTree.on_error") callback.
The error passed will be derived from [`AppCommandError`](https://discordpy.readthedocs.io/en/latest/interactions/api.html#discord.app_commands.AppCommandError "discord.app_commands.AppCommandError").
wait but this is for a prefix command
so it wouldn't be app_commands?
you should be using on_command_error then
If you have no slash commands you shouldn't have app_commands anywhere then lol
yeah ik, i'm just trying to translate that code from my slash command bot to the prefix bot haha
i wanna make a leveling bot but I'm too lazy and broke to get a proper database
mongodb not good enough?
mongodb bad, its okay for small scale but I'll have to pay when its used at larger scale
besides that its bson based
im looking for a sql based db
pgsql preferably
I've been considering offering some hosting services on my hardware
how many users would you say it could support at one time? I thought it seemed alright when I was using it lel
the thing is that I'd need to store relational data, dictionary like structure works but tables are much more tidier and easy to handle
ohhh mb i get you
π€Ίpaid/free?
yeah and i hate dictionaries
valid π
Free until I need to upgrade my internet services to support the network traffic 
I was working with some huge ass dictionaries for my dissertation but luckily some dude on reddit sent me some godly tool to help with it all
lmao im in whenever you start
what tool?
Although I would wait until I fix my disconnect issues I've been having with my hardware firewall. Every few hours the firewall needs to restart for unknown reasons and it takes everything offline for about 2 minutes
im currently dealing with dictionaries cause of the discord wrapper
converting those json responses to a valid object is pain
and discord under-documents shit
so its even more harder to use
i personally prefer dataclasses, attrs or typedicts if i already know what the data inside that dictionary would be
!pip attrs this lib is fire
lol same i was just wondering what shit tool he be using lmfao
whats attrs tho?
dataclasses but better
Can someone help me? I want to add a slash command to my Bot which outputs the newest youtube video link to the output of the bot
Do you have anything written yet
it's quicker with updates and helps with backward compatibility in my case
like i can use the python 3.10 dataclasses system in 3.8 if i use attrs
no :/
You should start with writing a slash command that you want to use for the link
oh yeah i already have that
-_-
I don't think anyone will write the whole command for you but if you run into problems we can help with that
i just dont know how i get the newest video
yk
are you still here?
oh okay thanks
thanks i will try it
This would work well for automatic updates when a new video is published
how do i only disable a button for some users?
In this episode, you'll learn how to handle webhooks from the YouTube Data API using PubSubHubbub or WebSub with Ruby on Rails.
h/t to Sunday Club's live stream here: https://www.youtube.com/watch?v=CyTjGWLyUqA
Table of contents
00:00 Introduction
01:23 Generate a new Webhooks controller
02:53 Start ngrok tunnel
04:05 Verify PubSubHubbub ...
didnt check woops
nvm then
Could better suit what they want idk 
he's gonna do a discord bot
Idk about disabling a button for certain users but you could send a message for certain users instead of doing the other intended interaction
like that yt api wrapper aint async
check if the id is in a list
if id not in list:
inter.response.send_message
return
why tho?
i'm implementing ERS in a discord bot
so like a card game with each player having a turn & whatnot
so i don't want a player to go if it isn't their turn
Yea I'd just send an ephemeral message if they hit the button out of turn
k cool
if self.turn.id != inter.user_id:
return
self.turn being the user
kk, cool
Is it because chance() isn't a list?
ctx.reply is not like the print function
It only takes 1 argument
Try using f strings to join the string
Or adding the strings
What did you try-
Missed a )
I'm tryna install discord library but it keeps giving me this error
?tag msvc
This is not a Modmail thread.
Oops
wrong server π
error: Microsoft Visual C++ 14.0 or greater is required. Get it with "Microsoft C++ Build Tools": https://visualstudio.microsoft.com/visual-cpp-build-tools/
Some C extension packages take time to have their wheels built when new Python versions release.
One option is to download and install wheels from https://www.lfd.uci.edu/~gohlke/pythonlibs/ if they're available.
The other option is to build them yourself.
Start by downloading and installing the Microsoft Visual C++ Build Tools from the URL in the error message.
After installing, it should open the build tools installation menu. Switch to the Individual components tab at the top.
Roughly half way down the list, find and select the latest version of MSVC build tools for your CPU architecture, most likely x64/x86.
At the end of the list, find and select the latest Windows SDK for your Windows version.
Click Install at the bottom and you should then be able to build your packages. You may need to restart your terminal/editor.
@open yoke
I wish I remembered, i'll see if I can find it on reddit but it basically just converted stuff you shoved in there into code/dictionaries in like 20s
wait so do I download that
from that link
Did you read what I sent at all?
skimmed
Just install python 3.10 instead of 3.11
o
any idea when it'll start working for 3.11?
No idea. I just got here. But I had the problem earlier
whenever the maintainers of multidict and yarl release prebuilt wheels for 3.11 then it'll be an easy install
but otherwise you need build tools in order for pip to compile those wheels
oh alr thanks
There are wheels here
frozenlist used to be in that error message too, but it looks like they uploaded the 3.11 wheels three days ago
I don't know what wheels arfe
Could someone help me? How can i get the newest youtube video link of a channel?
use channel.history with a limit of 1 and a check
Use regex in that check
use the YouTube api or webscrape the channel
!d discord.TextChannel.history
async for ... in history(*, limit=100, before=None, after=None, around=None, oldest_first=None)```
Returns an [asynchronous iterator](https://docs.python.org/3/glossary.html#term-asynchronous-iterator "(in Python v3.11)") that enables receiving the destinationβs message history.
You must have [`read_message_history`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Permissions.read_message_history "discord.Permissions.read_message_history") to do this.
Examples
Usage...
yt api?
i mean from a youtube channel
im confident they mean a channel as in a youtube channel there
So why are you asking in #discord-bots -
because i want to use it for a discord bot
Just because you're doing something in a discord bot doesn't make it related to discord but whatever
what
why does it say its not a module anymore
poetry add pymongo in the shell
thanks
Requests & Pymongo ποΈποΈ
should i buy a vps or host my bot on replit
Here's an example to look at. Doesn't do exactly what you want but it's a start
https://github.com/Riceblade/YouTube-Discord-Bot
Free vps
buy a vps, or get a free one from oracle if you have a credit card
thats only for one year, oracle provides lifetime free VM
thanks i think i got it now
Did not know that
Oracle π
more like java company
Lawsuit after lawsuit, after lawsuit
Most recent one was about selling data about people
:flattered: atleast someone will know me
cant you run it on a raspberry pi?
will it bypass the discord ratelimits by cloud fare
no but you won't get ratelimited like you do on replit
it doesnt bypass it, but you won't get ratelimited until you do something craZy
is digitalocean a good vps
yes it is
i'll suggest digital ocean or vultr out of these
you can actually get some better ones if you check this channel's pins
^^
ok thanks
would i choose python since my bot code is in python
python/django yes
or docker if you dockerized your bot
How can I get the TOP 10 Records with the highest RepAmount from my sqlite database
#databases
hint: SORT BY
I did the second option and it didn't work
I think I have finally finished my Poker game π
gg
hi, I have a list of 100 items. I want my embed description to be from 1-10 while paginating every 1-10 out of that 100 items. How exactly would I get every 1-10 until 100?
resp = ["1", "2", "3", "etc"]
for count, i in enumerate(resp, start=1):
embed = discord.Embed()
embed.description = f"**{count}.** {i}"
could use a list comprehension to make a list of list of 10 elements
should all my functions be async?
nope, only functions that really perform async operations should be a coroutine
On different VPS services
localhost π
never thought about this, but has anyone used discord.py without a gateway connection? i just thought about only calling Client.login() but not connect()
maybe its possible to do dpy app commands via http...
you can't, discord.py implementats interactions using the INTERACTION_CREATE gateway event instead of a HTTP server
its still the same payload though right? id figure you could create an Interaction from that and pass it to CommandTree._from_interaction() to trigger the app command
and if that works, maybe views will work too
http bot from the comfort of dpy
yes
i made a lib
ive tried it an it works
yeah the payloads are exactly same, if you're able to create your own HTTP server you can mock the discord.py app_commands api easily
discord.Client._connection.parse_interaction_create
oh yeah that method's more convenient
i remember asking u about it a while ago
really?
yep
oh yeah i did (respond to you)
#discord-bots message
The following are "raw" methods.
These are all for internal use, and could be subject to change without notification.
Only the methods formessageare documented, as everything else can be done with proper class methods and possible application ofdiscord.Object
Use only if you have to, not suitable for general consumption.
client.http.do_thing
client.http.add_reaction(channel_id, message_id, emoji)
client.http.remove_reaction(channel_id, message_id, emoji, member_id)
client.http.remove_own_reaction(channel_id, message_id, emoji)
client.http.get_reaction_users(channel_id, message_id, emoji, limit, after=None):
client.http.clear_reactions(channel_id, message_id)
client.http.pin_message(channel_id, message_id)
client.http.unpin_message(channel_id, message_id)
client.http.edit_message(channel_id, message_id, **fields) #fields can include content, etc. Embeds must be to_dict'd
client.http.delete_message(channel_id, message_id, *, reason=None)
All emojis must be a unicode string or in name:emoji format.
Alternatively, for an easier method, see ?tag partialmessage
There's this ig
yeah seen that tag
You can look through the source for other http methods

