#discord-bots
1 messages Β· Page 490 of 1
Who's Skelmis? And why does everyone love him? I'm just curious.
I just feel like users who need to scale will extend the bot themselves and make the redis cache
bbye π
This isn't something a framework/wrapper should be doing
he teaches ous
he pog
Just like how earlier in your repo you had env variables
It should be the users who decide to set an env var then use that
On YouTube?
It looks for an env variable if a token is not provided
Adds an extra dependency for no reason
Just my opinion but this is just out of scope but you can choose otherwise
Not sure if that tiny convenience is worth the overhead
i can imagine situations where the end user could have an env variable named "TOKEN" and get confused why their bot is throwing a gateway error
same, esp since I use linux
Isn't using redis gonna be way more memory-management-wise than a dict tho?
I was talking about the usage of env variables
Oh I see
i hold the same stance as andy's, i think it should be up to the user
Nothing wrong with redis, just that the setup is a hassle I'd imagine and what if the user did not want it
Up to you, your the maintainer but at the very least it shouldn't be a required cache
Then what happens when you have a machine incapable of running redis?
Is redis that heavy?
I'm not sure but hardware limitations should always be kept in mind
yep π
You need to install from the github repo, not from pypi
Did you update to the latest vers- what andy said
you got a link?
Oh cool.
oh got it
You might need to add git+ as a prefix before the url not sure
Yeah he should
so I need github downloaded
no
No
py -3 -m pip install -U +giturl
git+
ok
not just +
oh
the regular url might just work as well
cannot detect archive format
π¦
ERROR: Cannot determine archive format of C:\Users\aaml1603\AppData\Local\Temp\pip-install-jj0pmqz2\git_c3f67d9fc45341e9bdc2eb8397ed3cb4```
Thats the whole thing
python3.8 -m pip install -U git+https://github.com/Rapptz/discord.py
I found it from the main server
guess I got the + and @ confused
ERROR: Cannot find command 'git' - do you have 'git' installed and in your PATH?```
Installed git?
No
oke
Just install git
ok done
do I re run it
oh it did work now
now im getting cannot import name 'menus' from 'discord.ext'
if you're unable to do it with git , just download the discordfolder and paste it in <pythonpath>\lib\site-packages
Where?
In your code?
yeah
you need to install it
python -m pip install -U git+https://github.com/Rapptz/discord-ext-menus
ty ty
π
Can I use more than one and ??
yes
Ahh nice
if this and that and something_else and bla_bla: ...``` is valid if you have defined everything
BTW, Whats the command i use? Like i need to check if the message is from a certain user. Is it message.author.id == 12432123432 ??
yes
Thank You!!
Heyy
If I want to lock the command
Can I do it with both role and permission??
Like you either need manage_channel=True permission or Staff role
@discord.ext.commands.has_permissions(**perms)```
A [`check()`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.check "discord.ext.commands.check") that is added that checks if the member has all of the permissions necessary.
Note that this check operates on the current channel permissions, not the guild wide permissions.
The permissions passed in must be exactly like the properties shown under [`discord.Permissions`](https://discordpy.readthedocs.io/en/master/api.html#discord.Permissions "discord.Permissions").
This check raises a special exception, [`MissingPermissions`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.MissingPermissions "discord.ext.commands.MissingPermissions") that is inherited from [`CheckFailure`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.CheckFailure "discord.ext.commands.CheckFailure").
gae
Music Bots --> Against ToS --> No Help
I have actually created a flask with folder name templates and runned it but it still says template not found
Can anyone help?
seseorang membantu saya?
Hi, I'm re-creating (and not forking) discord.py (called Disthon) using the code form discord.py, discord.js and Sapphire framework.
I need programming experts to lend me a hand with the project. If anyone's interested in contributing, please reply to this message
English please
english
import discord
import os
import requests
import json
import random
from replit import db
from keep_alive import keep_alive
client = discord.Client()
sad_words = ["sad", "depressed", "unhappy", "angry", "miserable", "depressing"]
starter_encouragements = [
"Cheer up!",
"Hang in there.",
"You are a great person / bot!"
]
if "responding" not in db.keys():
db["responding"] = True
def get_quote():
response = requests.get("https://zenquotes.io/api/random")
json_data = json.loads(response.text)
quote = json_data[0]['q'] + " -" + json_data[0]['a']
return(quote)
def update_encouragements(encouraging_message):
if "encouragements" in db.keys():
encouragements = db["encouragements"]
encouragements.append(encouraging_message)
db["encouragements"] = encouragements
else:
db["encouragements"] = [encouraging_message]
def delete_encouragment(index):
encouragements = db["encouragements"]
if len(encouragements) > index:
del encouragements[index]
db["encouragements"] = encouragements
@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
msg = message.content
if msg.startswith('$inspire'):
quote = get_quote()
await message.channel.send(quote)
if db["responding"]:
options = starter_encouragements
if "encouragements" in db.keys():
options = options + db["encouragements"]
if any(word in msg for word in sad_words):
await message.channel.send(random.choice(options))
if msg.startswith("$new"):
encouraging_message = msg.split("$new ",1)[1]
update_encouragements(encouraging_message)
await message.channel.send("New encouraging message added.")
ts)
how
!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.
e
you shouldn't use an on_message event for commands
you should use discord.ext.commands.Bot rather than discord.Client() as well.
izinkan saya menggunakan penerjemah google
π
sorry me no english google translate
#moderation
async def isAdmin(ctx):
return ctx.author.has_role(878875536095604757,879248227621273610,879248227621273610)
async def isMod(ctx):
return ctx.author.has_role(878875536095604757, 879248227621273610, 879248227621273610, 879248261427388437, 879248301487177759)```
hey would this work for mod perms?
@patent lark
no, if you are defining this outside of a decorator from discord.ext.commands then ctx in this case isnt commands.Context, on top of that, its written incorrectlty.

discord.ext.commands has a decorator ( @commands.has_any_role() ) , if you'd rather use that than making your own function
yes
tysm :)
it can take role ids (as an int), or you could pass the roles names as a string
how can i make an if statement of
if message in channel channel is NOT example then the message would be deleted
are you trying to check if its sent in a certain channel?
yes, simply put i want it this way
when someone joins they can only access one channel called #verification, now i want them to do !verify which will give them full server access. I want there to be a feature that if they say something which is not !verify in #verification it gets deleted
you could use an on_message event.
if message.channel.id != channel_id_goes_here:
return await message.delete()
else:
#code here```
^^^
ic al rightthanks
that can on in the command as well
π
thread = await channel.create_thread(name="Apple", message="Welcome") What am I doing wrong?
websites=discord.Embed(title='3# APIsοΈ π')
``` it says "invalid character in identifier" why?
@patent lark any clue mate ._.
Can you send the GitHub repo link?
@client.command()
async def verify(ctx):
if (not ctx.author.guild_permissions.change_nickname):
guild = ctx.guild
role = discord.utils.get(guild.roles, name="member")
await ctx.author.add_roles(role)
else:
await ctx.send("You are already verified!!!")``` still not working sadge
That's optional abc.Snowflake.
For the message param
https://github.com/AA1999/Disthon
It's in pretty early stages
Hope it catches your eye
Not a string
I still want it in. How do I include it?
anyone?
File "C:\Users\HP\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\discord\ext\commands\core.py", line 94, in wrapped raise CommandInvokeError(exc) from exc discord.ext.commands.errors.CommandInvokeError: Command raised an exception: AttributeError: 'NoneType' object has no attribute 'id'
Well. Idk what it's suppose to display, so. for now. find out what it does.
Your utils.get is returning None
The param makes a thread with that given snowflake
yes...
I am trying to create a thread in the channel I called the command in.
Has to be a public thread
Well threads need to be created off of a message
So "message" needs to be set to the message item?
Can be a message object or an id
so ctx.message.id or ctx.message is enough?
Yes
ooh nice
well can someone help me wih muy music bot
How
Now to figure out how to break a message into multiple embs xD
You're more than welcome to join the team if you know a good amount of Python and/or Typescript
Library?
In embeds.0.fields.2.value: Must be 1024 or fewer in length. I wouldn't suppose discordpy has a solution for long embs π€
i don't know the error specifically my command runs but doesn't give any output
use description maybe , and the limits are for discord ,not discord.py
where can i share my codes so u can pin point where I am making mistake
!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.pydis.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.
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.
Maybe I'll just send it as a txt file if it's over the limit
description can take upto 4096 characters
oh
Or you can split your text in two or more embed pages
Again. what would be the best method to doing this without breaking the message up so badly? xD
actually i am new to python bcz it started in my school this year Thanking you guys
You must found it
!ytdl
Per Python Discord's Rule 5, we are unable to assist with questions related to youtube-dl, pytube, or other YouTube video downloaders as their usage violates YouTube's Terms of Service.
For reference, this usage is covered by the following clauses in YouTube's TOS, as of 2021-03-17:
The following restrictions apply to your use of the Service. You are not allowed to:
1. access, reproduce, download, distribute, transmit, broadcast, display, sell, license, alter, modify or otherwise use any part of the Service or any Content except: (a) as specifically permitted by the Service; (b) with prior written permission from YouTube and, if applicable, the respective rights holders; or (c) as permitted by applicable law;
3. access the Service using any automated means (such as robots, botnets or scrapers) except: (a) in the case of public search engines, in accordance with YouTubeβs robots.txt file; (b) with YouTubeβs prior written permission; or (c) as permitted by applicable law;
9. use the Service to view or listen to Content other than for personal, non-commercial use (for example, you may not publicly screen videos or stream music from the Service)
@client.event
async def on_message(message):
if message.channel.name == "verification":
await message.delete()
elif message.content.startswith == "!verify":
print("Verified")``` the code vaskel gave me didnt really work for me so now im using this
but the elif statement isnt working
any clue why?
It's startswith('your str') iirc
ic
@reef shell is there anyway i can make the bot wait like 5 seconds before deleting the message
Yes
@client.event
async def on_message(message):
if message.channel.name == "verification":
await message.delete()
``` in this code i mean
!d discord.Message.delete
await delete(*, delay=None)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Deletes the message.
Your own messages could be deleted without any proper permissions. However to delete other peopleβs messages, you need the [`manage_messages`](https://discordpy.readthedocs.io/en/master/api.html#discord.Permissions.manage_messages "discord.Permissions.manage_messages") permission.
Changed in version 1.1: Added the new `delay` keyword-only parameter.
Ok so the issue im facing now is
@client.event
async def on_message(message):
if message.channel.name == "verification":
await message.delete(delay=5)``` if i add this code, then my !verify command stops working which is this
```py
@client.command()
async def verify(ctx):
if (not ctx.author.guild_permissions.change_nickname):
guild = ctx.guild
role = discord.utils.get(guild.roles, name="Member")
role1 = discord.utils.get(guild.roles, name="Unverified")
await ctx.author.add_roles(role)
await ctx.author.remove_roles(role1)
else:
await ctx.send("You are already verified!!!")```
noice
Should see how annoying it is ;D
!d discord.ext.commands.Bot.process_message
What
!d discord.ext.commands.Bot.process_commands
await process_commands(message)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
This function processes the commands that have been registered to the bot and other groups. Without this coroutine, none of the commands will be triggered.
By default, this coroutine is called inside the [`on_message()`](https://discordpy.readthedocs.io/en/master/api.html#discord.on_message "discord.on_message") event. If you choose to override the [`on_message()`](https://discordpy.readthedocs.io/en/master/api.html#discord.on_message "discord.on_message") event, then you should invoke this coroutine as well.
This is built using other low level tools, and is equivalent to a call to [`get_context()`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.Bot.get_context "discord.ext.commands.Bot.get_context") followed by a call to [`invoke()`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.Bot.invoke "discord.ext.commands.Bot.invoke").
This also checks if the messageβs author is a bot and doesnβt call [`get_context()`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.Bot.get_context "discord.ext.commands.Bot.get_context") or [`invoke()`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.Bot.invoke "discord.ext.commands.Bot.invoke") if so.
Ah
@lone aurora
Right mb
tenks
instead where i wrote ydl i have to write !ytdl
kraots confoosion
Wdym
Using ytdl is Against ToS of yt
u told !ytdl so do i have change where i wrote ydl i hve to write !ytdl specifically
lol
@client.event
async def on_message(message, process_commands):
if message.channel.name == "verification":
await message.delete(delay=5)
await process_commands(message)``` like this?
im dumb hold my hand
but now how can i create my music bot T_T
client.process......
someone end me
It's await client.process_commands(message)
Also why are you passing an extra arg
kek ok
Or bot if you're using that as the variable
Dunno
im dumb, i removed it anyays

did u get undefined when u did await process_commands(message)?
await client.process_commands(message)
Ok I want to add buttons to my embed if the user has done a particular format but it say gives me the error discord.ext.commands.errors.CommandInvokeError: Command raised an exception: TypeError: 'ButtonStyle' object is not callable here is the code: py @client.group(invoke_without_command=True) async def feedback(ctx, *,text = None): try: text = text.split("|") report=discord.Embed(color=0xfff868) report.add_field(name='Pending Confirmation', value=f"\`\`\`{text[1]} #Tittle \r {text[2]} #Description\`\`\`") await ctx.channel.send(embed=report) except: await ctx.reply("Please enter `/feedback format` to check how to format.") else: y=Button(style=ButtonStyle.green(), lable='Yes', id="yes") n=Button(style=ButtonStyle.red(), lable='NO', id="no") newreport=report=discord.Embed(color=0xfff868) newreport.add_field(name='Pending Confirmation', value=f"\`\`\`{text[1]} #Tittle \r {text[2]} #Description\`\`\`") await ctx.edit(componenets=[y][n],embed=newreport) what the problem ? also ignore\
File "C:\Users\HP\Desktop\cmdtests\main.py", line 34, in on_message await client.process.commands(message) AttributeError: 'Bot' object has no attribute 'process'
new error :/
bruh use client??
oh wait its process_commands
ok
xD https://youtu.be/YICQ5M1uuME this isn't annoying or anything
Created a bot that grabs your unread messages, throws them into a thread.
This is what I just made
wtf did anyone know u can watch youtube vids on discord
Yes
this is torturing urself
In emb.
@lone aurora π
@slate swan hi remember we chatted some time ago how can i now check if im still ip banned
sorry for the ping
you evil genius π
@lone aurora @leaden anvil I basically wanted to create a way to read my reddit notifications without actually going to reddit itself.. then reply.
While True:
await ctx.guild.create_text_channel(name='owo')
``` owo
RatelimitsπΏ
ik πΏ
Oh ok but still if u aren't do it for your self then its evil and plain annoying
I don't want channels. i want threads lol
Cloudflare bansπΏ
ok.
Yes. Annoying as heck.
πΏ
And also if you make a thread and manually delete your comment the thread was on, it'll delete the thread. BUT! If you delete the comment using a bot. hehe thread remains
what?
Heyy
what ?
Any idea how can i add spotify,soundcloud etc links to play music in my music bot since ytdl can't be used what changes i have to make
u said "ok" with no context
oh sorry my bad
ok
@commands.has_permissions(manage_channel=True)
@commands.has_role('STAFF')
This command means: Both people with staff and people with manage_channal can use right?
They don't need both..
yes both
Nice
And using description worked out aight imo
Thank You!!
Also its manage_channels=True
Can somebody help me, solve this mess of a code here: #discord-bots message
you want to debug the code or solve the errors
error
oh lemme see
i still dont get the reason to torture urself
@leaden anvil the error is bcz you are using parentheses unnecessarily
where
class discord.ButtonStyle```
Represents the style of the button component.
New in version 2.0.
yay another error :/ this time it discord.ext.commands.errors.CommandInvokeError: Command raised an exception: TypeError: __init__() got an unexpected keyword argument 'lable'
I dont want to navigate to reddit to reply to my notifications π
It's label not lable
if u were me, the reddit acc wouldve been yeedted off the net by now
Replace all lable with label
How do i see if the command was run in a thread or not? π€
yay another error discord.ext.commands.errors.CommandInvokeError: Command raised an exception: AttributeError: 'Context' object has no attribute 'edit'
I think you want ctx.message.edit? π€
ctx.message.edit
!d discord.Edit
!d discord.Message.edit
await edit(content=..., embed=..., embeds=..., attachments=..., suppress=..., delete_after=None, allowed_mentions=..., view=...)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Edits the message.
The content must be able to be transformed into a string via `str(content)`.
Changed in version 1.3: The `suppress` keyword-only parameter was added.
You can send multiple embs in 1 message?
Probably
u can?
the above bot thing says embed and embeds
ok how do I solve this I am sorry discord.ext.commands.errors.CommandInvokeError: Command raised an exception: TypeError: list indices must be integers or slices, not Button
U can
hm
There's embeds kwarg which takes a lit of embed objects and sends them in 1 messages
The limit being 10 embeds per message
Learn python
!resources
The Resources page on our website contains a list of hand-selected learning resources that we regularly recommend to both beginners and experts.
Would this still be limited to the character limit tho?
Learn/read the docs first before making discord bots
No
Bro I solved also I am an idiot
Only 1 embed has the max 6k+ or whatever the total limit was
So I could send 60k characters in 1 message coz 10 embs?
Probably
Lmao no ig
Never actually tried it
Only 2k iirc
Yeah no u can only send 6k characters per message
So nitro adds 4k?
But embeds is extremely convenient for logs
I see, thanks
Lmfao
if I create a thread in a private channel, is that thread still publicly viewable?
Afaik u can only join a thread if you can see the channel so no
Neato
Sure
Btw. ya'll know how this is currently annoying? well. im planning on moving all this reddit stuff to a background task and having it do its thing every minute or so
πΌ
can someone help...
* Serving Flask app '' (lazy loading)
* Environment: production
WARNING: This is a development server. Do not use it in a production deployment.
Use a production WSGI server instead.
* Debug mode: off
* Running on all addresses.
WARNING: This is a development server. Do not use it in a production deployment.
* Running on http://172.18.0.4:8080/ (Press CTRL+C to quit)
Traceback (most recent call last):
File "main.py", line 405, in <module>
client.run(os.getenv('TOKEN'))
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/client.py", line 723, in run
return future.result()
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/client.py", line 702, in runner
await self.start(*args, **kwargs)
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/client.py", line 666, in start
await self.connect(reconnect=reconnect)
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/client.py", line 601, 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.
ξΊ§ 172.18.0.1 - - [23/Sep/2021 05:10:23] "GET / HTTP/1.1" 200 -
why do i feel something illegal in this code 
are your intents on the bot like this?
lemme check
alright i forgot to do it let me try now
it means that you need to enable certain intents (just enable all of them) at https://discord.com/developers/applications/ to do what you're doing
alright perfectly working thanks
π
why does he get the credit?! ;-; thank me too
@drifting arrow thx to you too
π
\o/ yay
lmao i was thanking you too
I helped for a change. So gosh darnit I want my credit
is there a way you could declare a command with a variable?
yes
Wait wdym by that?
how would I do that?
if the variable is a function you can py bot.add_command(commands.Command(command_func))
Cuz it is......
Can use nitro emojis and shit without actual nitro => nitro cheats
Β―\_(γ)_/Β―
uh why 
well i was ip banned some damn friend of mine got banned a few months ago -_-
and now all good nice 
@bot.command()
async def botinfo(ctx):
embed = discord.Embed(
title=f"ChrimataGame's Info",
color=0xffcc00)
embed.add_field(name=f'{len(bot.users)} users use ChrimataGame', value='__ __')
embed.add_field(name=f'{len(bot.guilds)} servers invited ChrimataGame', value='__ __')
await ctx.send(embed=embed)
how does only one user uses it? there are almost 100 members in these servers
It's the count of total users bot can see
For precise count use
s=0
for g in bot.guilds:
s+=g.member_count
ok, ty
ok thanks
the location of my main app is for example : "python\discord"
I am trying to reach that location from this location : "python\discord\cogs".
How can I "go back" in the directory in python? ty ahead
I didn't knew that it's amazing
Β―\_(γ)_/Β―
Can it also send msgs over 4000 words?
No
how to react if someone reply a user
But an embed's description can have 4k characters
That's amazing
plzz
-_-
i have an afk command
if someone mention a afk user
bot tell him that he is afk
but i want bot to tell the user on reply also
how do i use an opensource code?
i mean... i got modmail open source code but i dont know how to use js ( basically i dont know how to apply the stuff to my bot ( i mean token ) )
Is there not something like config or botconfig?
In files?
Just config it
exports.TOKEN = '';
exports.PREFIX = '';
exports.news_API = '';
exports.giphy_API = '';
exports.AME_API = '';
ooh ok thanks
@bot.command()
async def with(ctx):
i have a syntax error, because with is already a function, what do i do?
Just put your token
And prefix and api
thankk you so much this server helps alot for free 
And all that
ok if i dont need one then? like AME and NEWS api
Leave them blank
ok thanks
With isnβt a function but a reserved keyword in python for a context manager
So itβs forbidden to have functions and variables be that name
could do _with and use the name kwarg in @bot.command()
so.. it is impossible to make a with command?
Name the func _with and in the decorator add name='with'
Do as @jade jolt said
yup
ok, tyall!
np c:
coughs its coming again and again how do i add the bot to server
....anyone here?.....
Show your discord dev bot settings
Disable the Code Grant checkbox
done
perfect thanks
hi i'm not sure why looking for ~/cogs/previousids.txt returns in the console file not found. can somebody explain why?
i know im asking lots of junk but... can someone tell me how do i run the code for javascript ( probably stupidest question ever but im not familiar with js )
how do i convert an embed object to an embed
nvm i got it
whats that coughs
nice
Now whenever I get reply on reddit I can get pinged on discord πΌ
lol
e
Hi
I'm curious, this is subjective what are the core features that any bot needs. I'm talking true core, like help command and error handler.
I think what's needed is error handler, help command, cog loading system, and maybe a paginator?
Yes, + jishaku
Cuz you need to install dependencies
Gimme the github link
does discordpy work for python in version 3.10?
@bot.command()
async def code():
# username = arg
embed = discord.Embed(
title = "Title",
description = "This has a description",
colour = discord.Colour.blue()
)
embed.set_footer(text = "This is a footer")
embed.set_thumbnail(text="Thumbnail")
embed.set_author(name="Author Name")
embed.add_field(name="Field Name",value='Field value', inline=False)
embed.add_field(name="Field Name",value='Field value', inline=True)
embed.add_field(name="Field Name",value='Field value', inline=True)
await bot.say(embed=embed)
'''The error
discord.errors.ClientException: Callback for code command is missing "ctx" parameter.'''```
did this from a tutorial
Ofc
for that person this works
try cs awit ctx.send(embed=embed)
ofc?
async def code(ctx):
that person has used bot.say(embed=embed)
oh
ctx.send
It's old
RIP
add parameter ctx
use
ctx.send
thats from 1880
the vids 3 yrs old
Loll
chill ppl
Also use
async def code(ctx):
@bot.command
async def code(ctx):
# username = arg
embed = discord.Embed(
title = "Title",
description = "This has a description",
colour = discord.Colour.blue()
)
embed.set_footer(text = "This is a footer")
embed.set_thumbnail(text="Thumbnail")
embed.set_author(name="Author Name")
embed.add_field(name="Field Name",value='Field value', inline=False)
embed.add_field(name="Field Name",value='Field value', inline=True)
embed.add_field(name="Field Name",value='Field value', inline=True)
await ctx.send(embed=embed)```
Yup
@trail breach
username = arg?
just checkin some thing
idk
He missed #
ignore
kay
how do i make if the user react to 1st emoji and then 2nd emoji, the 2nd emoji that user react will be remove?
@trail breachcan?
damnthis is dope ty @serene lynx @tiny ibex
wdym?
oo modmail?
you're welcome
?
wdym?
what were u asking by can?
tin can
cancel π
and yeah
BUTTONS ARE COMPLIACTED
Like
innit
_super__innit
LIKE WHAT?
whats with those innits?
And
SELF_
what does those innits and self and stuff mean
can mentions be embedded?
Use discohook and see JSON data editor
it will show you the format
i think
any sample images?
you can put mentions in embeds but they will not ping the user(s)
oh
i can use text and embed though lemme try that
Like prism
like this?
yes
Ditttt
pls share src code
str(user)
@commands.command(aliases=['warning', 'peringatan'])
@commands.has_permissions(kick_members=True)
async def warn(self, ctx, user: Member, *, reason=None):
if reason == None:
await ctx.send('you have to add a reason')
else:
description = f'''
**Information :**
Author : {ctx.author}
User : {user}
Reason : {reason}```'''
embed = mbed(
description=f"{description}", color=ctx.author.colour, timestamp=ctx.message.created_at,)
embed.set_author(
name=f'{user} Has Been Warned', icon_url=str(user.avatar_url))
embed.set_footer(
text=f'command used by : {ctx.author}', icon_url=str(ctx.author.avatar_url))
if user.bot == False:
await ctx.send(embed=embed)
await user.send(embed=embed)
await ctx.message.delete()
else:
await ctx.send(embed=embed)
await ctx.message.delete()```
that will return name#discriminator
k tysm
please avoid spoonfeeding, it's against the spirit of this discord
Sorry, I do not know
i dont use code pieces idk about so ill first understand it
How does one go about getting a users join date and then changing/converting it to a unix timestamp?
a member.joined_at returns a datetime object
which you can convert however you like
!d datetime.datetime
class datetime.datetime(year, month, day, hour=0, minute=0, second=0, microsecond=0, tzinfo=None, *, fold=0)```
The *year*, *month* and *day* arguments are required. *tzinfo* may be `None`, or an instance of a [`tzinfo`](https://docs.python.org/3.10/library/datetime.html#datetime.tzinfo "datetime.tzinfo") subclass. The remaining arguments must be integers in the following ranges...
user:Member is for the author??
oh
k ty
im taking a mention as an argument if i print it shows me id
how can i convert it to name
any1
ctx.user
@trail breach use the this
ohk lemme try
For get name
Mm
'Context' object has no attribute 'user'
You probably mean that
!d discord.ext.commands.Context.author
Union[User, Member]: Returns the author associated with this contextβs command. Shorthand for Message.author
no i want to take a mention arguement to use in a command
if i print it prints user id
not name
@bot.command()
async def code(ctx,lang,mention):```ok
ctx.author.mention
not the author
@trail breach you can mention
Then
whom the author mentions
Oh Ok one sec
!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.pydis.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.
@bot.command()
async def whois(ctx, member : discord.Member):
@trail breach use this
The member that you want
Athor mentioned is the member
@trail breach
ok lemme try
This code should be working
!d discord.Member
class discord.Member```
Represents a Discord member to a [`Guild`](https://discordpy.readthedocs.io/en/master/api.html#discord.Guild "discord.Guild").
This implements a lot of the functionality of [`User`](https://discordpy.readthedocs.io/en/master/api.html#discord.User "discord.User").
x == y Checks if two members are equal. Note that this works with [`User`](https://discordpy.readthedocs.io/en/master/api.html#discord.User "discord.User") instances too.
x != y Checks if two members are not equal. Note that this works with [`User`](https://discordpy.readthedocs.io/en/master/api.html#discord.User "discord.User") instances too.
hash(x) Returns the memberβs hash.
str(x) Returns the memberβs name with the discriminator.
it works ty @novel rampart
@trail breach read this document also then u understand what is that code
hmm
ok
Itβs my pleasure
π
yes
ok
can someone please help me with a suggest command?
with the bot = command.Bot
like, not client, bot
That is your creative mindset
What
what
the suggest command
I tell that answer
i am new in python
Oh
it's just a bot constructor it doesn't matter much?
no no
What all things you know in python
let me explain
Mm
oh yea, like that
but it metter
Like what
idk
Why does it matter
like you said
M
No
ok whatever
discord.Client?
It matters because Bot has commands
can you help me?
The bot and Clint is only a variable name
yes, i use discord.Bot
ik
exactly
so, cand someone help me?
Yes
what
!d discord.ext.commands.Bot
class discord.ext.commands.Bot(command_prefix, help_command=<default-help-command>, description=None, **options)```
Represents a discord bot.
This class is a subclass of [`discord.Client`](https://discordpy.readthedocs.io/en/master/api.html#discord.Client "discord.Client") and as a result anything that you can do with a [`discord.Client`](https://discordpy.readthedocs.io/en/master/api.html#discord.Client "discord.Client") you can do with this bot.
This class also subclasses [`GroupMixin`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.GroupMixin "discord.ext.commands.GroupMixin") to provide the functionality to manage commands.
to make a suggest command
Im confused
why
he said discord.Bot
yes
Which isn't a thing apparently
It isn't
how
It's commands.Bot
oh wait
you mean discord.ext.commands.Bot?
commands.Bot
That is you creative mind
srry
ok
i am new in python!!
incorrect still lol
...
Make your on unique commonts
...
commands.Bot
can anyone else help me?
Hes asking for help tho
yes, i edited
example?
yes, i am new
Then what did you want
What help
Also, if you're new to discord.py I suggest reading this for a basic understanding, it's useful https://vcokltfre.dev/
A tutorial on how to use discord.py to create your own Discord bot in Python, written to fix the flaws of many other popular tutorials.
Tell that
to make, a ,suggest, commad
ok
but can anyone help me ?
or i am wasting my time π
It's best if you read it first getting a basic understanding of the library
...
what?
nothing
i can't read rn
i need some help rn but.. anyway
can i post a picture?
Just make a command and make it send 2 that specific channel or the channel where it was used
i would suggest not rushing.
no
i want to show you how i want to look the command like
can i do it or i get banned/warned?
whatβs the issue
okay
Tried helping but
and i want, if someone say it like in general, to move it in suggestions
okay
do u understand what i am saying?
well you'll need to get the channel first to send it
make an embed, send it to the channel, add the reactions and wait
!d discord.ext.commands.Bot.get_channel
get_channel(id, /)```
Returns a channel or thread with the given ID.
i donno how to do ittt
i am neww, and i dont have time for reading
!d discord.Message.add_reaction
await add_reaction(emoji)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Add a reaction to the message.
The emoji may be a unicode emoji or a custom guild [`Emoji`](https://discordpy.readthedocs.io/en/master/api.html#discord.Emoji "discord.Emoji").
You must have the [`read_message_history`](https://discordpy.readthedocs.io/en/master/api.html#discord.Permissions.read_message_history "discord.Permissions.read_message_history") permission to use this. If nobody else has reacted to the message using this emoji, the [`add_reactions`](https://discordpy.readthedocs.io/en/master/api.html#discord.Permissions.add_reactions "discord.Permissions.add_reactions") permission is required.
Don't rush it.
Messageable.send returns a Message object
We are not going to spoonfeed
ok ok, sorry
@jagged wigeon learn basic of discord.py
...
Then you can make without our help
ok, whatever
With diabolical here. If I wanted to write somebodyβs code, Iβd get a job LOL
Lol
there are no basics of a module though? Not to my knowledge it is.
I mean learn discord.py lol
Wdym by that..? You can familiarise yourself with a module βlearning the basicsβ
i need a little spoonfeed
Learn discord.py
!d discord.Embed
class discord.Embed(*, colour=Embed.Empty, color=Embed.Empty, title=Embed.Empty, type='rich', url=Embed.Empty, description=Embed.Empty, timestamp=None)```
Represents a Discord embed.
len(x) Returns the total size of the embed. Useful for checking if itβs within the 6000 character limit.
bool(b) Returns whether the embed has any data set.
New in version 2.0.
Certain properties return an `EmbedProxy`, a type that acts similar to a regular [`dict`](https://docs.python.org/3/library/stdtypes.html#dict "(in Python v3.9)") except using dotted access, e.g. `embed.author.icon_url`. If the attribute is invalid or empty, then a special sentinel value is returned, [`Embed.Empty`](https://discordpy.readthedocs.io/en/master/api.html#discord.Embed.Empty "discord.Embed.Empty").
For ease of use, all parameters that expect a [`str`](https://docs.python.org/3/library/stdtypes.html#str "(in Python v3.9)") are implicitly casted to [`str`](https://docs.python.org/3/library/stdtypes.html#str "(in Python v3.9)") for you.
ty
!d discord.Embed
class discord.Embed(*, colour=Embed.Empty, color=Embed.Empty, title=Embed.Empty, type='rich', url=Embed.Empty, description=Embed.Empty, timestamp=None)```
Represents a Discord embed.
len(x) Returns the total size of the embed. Useful for checking if itβs within the 6000 character limit.
bool(b) Returns whether the embed has any data set.
New in version 2.0.
Certain properties return an `EmbedProxy`, a type that acts similar to a regular [`dict`](https://docs.python.org/3/library/stdtypes.html#dict "(in Python v3.9)") except using dotted access, e.g. `embed.author.icon_url`. If the attribute is invalid or empty, then a special sentinel value is returned, [`Embed.Empty`](https://discordpy.readthedocs.io/en/master/api.html#discord.Embed.Empty "discord.Embed.Empty").
For ease of use, all parameters that expect a [`str`](https://docs.python.org/3/library/stdtypes.html#str "(in Python v3.9)") are implicitly casted to [`str`](https://docs.python.org/3/library/stdtypes.html#str "(in Python v3.9)") for you.
create an embed with what the user suggests, example if he does ,suggest this is a test the embed description/a field value would be this is a test and send it to a channel and add reactions.
oh yea
You need to learn what that is
Look this
its hard
Not really
No
not for you
It is very easy
β«
Weβre here to answer specific questions you have if youβre finding it difficult. But you have to give us the impression that youβre at least tryingβ¦
okok
https://cog-creators.github.io/discord-embed-sandbox/ This is a useful tool for visualisation
wait a sec
But, of course, first starting with a basic understanding would be a lot easier, than first trying to create this suggestion bot.
i made a little help command
with embed
@bot.command(aliases=['Help'])
async def help(ctx):
em = discord.Embed(
description='**Admin Only** \n ```$clear [number] - Clears the number of messages you want```\
\n ```$create-channel [name] - Creates a text channel with the name that you want```\
\n ```$create-vc [name] - Creates a voice channel with the name that you want```\
\n ```$kick [member] - Kicks a member of your choice from the guild```\
\
n ```$ban [member] - Bans a member of you choice from the guild```\
\n ```$unban [member] - Unbans a member of you choice from the guild```\
The better way I suggest wach any good YouTube videos for the discord.py
That is better
For you
Yes
what the frick
!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.pydis.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.
what?
!d discord.Message.add_reaction
await add_reaction(emoji)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Add a reaction to the message.
The emoji may be a unicode emoji or a custom guild [`Emoji`](https://discordpy.readthedocs.io/en/master/api.html#discord.Emoji "discord.Emoji").
You must have the [`read_message_history`](https://discordpy.readthedocs.io/en/master/api.html#discord.Permissions.read_message_history "discord.Permissions.read_message_history") permission to use this. If nobody else has reacted to the message using this emoji, the [`add_reactions`](https://discordpy.readthedocs.io/en/master/api.html#discord.Permissions.add_reactions "discord.Permissions.add_reactions") permission is required.
Yes
you can make it the same as the screenshot
@bot.command()
async def suggest(ctx):
em= discord.Embed(
bot.get_channel(id)
description = 'A help command')
so thats the start
howw
thats what i am trying to do
make the embed, send it in a channel, add the reactions
ok
Indentations
the reactions are ok, but how i send it in a channel?
Like I said earlier you'll need to get the channel first
how
!d discord.ext.commands.Bot.get_channel
get_channel(id, /)```
Returns a channel or thread with the given ID.
ok
!d discord.abc.Messageable.send
await send(content=None, *, tts=None, embed=None, embeds=None, file=None, files=None, stickers=None, delete_after=None, nonce=None, allowed_mentions=None, reference=None, mention_author=None, view=None)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Sends a message to the destination with the content given.
The content must be a type that can convert to a string through `str(content)`. If the content is set to `None` (the default), then the `embed` parameter must be provided.
To upload a single file, the `file` parameter should be used with a single [`File`](https://discordpy.readthedocs.io/en/master/api.html#discord.File "discord.File") object. To upload multiple files, the `files` parameter should be used with a [`list`](https://docs.python.org/3/library/stdtypes.html#list "(in Python v3.9)") of [`File`](https://discordpy.readthedocs.io/en/master/api.html#discord.File "discord.File") objects. **Specifying both parameters will lead to an exception**.
To upload a single embed, the `embed` parameter should be used with a single [`Embed`](https://discordpy.readthedocs.io/en/master/api.html#discord.Embed "discord.Embed") object. To upload multiple embeds, the `embeds` parameter should be used with a [`list`](https://docs.python.org/3/library/stdtypes.html#list "(in Python v3.9)") of [`Embed`](https://discordpy.readthedocs.io/en/master/api.html#discord.Embed "discord.Embed") objects. **Specifying both parameters will lead to an exception**.
Hi, I'm re-creating (and not forking) discord.py (called Disthon) using the code form discord.py, discord.js and Sapphire framework.
I need programming experts to lend me a hand with the project. If anyone's interested in contributing, please reply to this message
https://github.com/AA1999/Disthon
gud now?
no
where do i put it then
Its bot.get_channel(id)
You didn't indent your code
indent?
Anywhere really
!indents
Indentation
Indentation is leading whitespace (spaces and tabs) at the beginning of a line of code. In the case of Python, they are used to determine the grouping of statements.
Spaces should be preferred over tabs. To be clear, this is in reference to the character itself, not the keys on a keyboard. Your editor/IDE should be configured to insert spaces when the TAB key is pressed. The amount of spaces should be a multiple of 4, except optionally in the case of continuation lines.
Example
def foo():
bar = 'baz' # indented one level
if bar == 'baz':
print('ham') # indented two levels
return bar # indented one level
The first line is not indented. The next two lines are indented to be inside of the function definition. They will only run when the function is called. The fourth line is indented to be inside the if statement, and will only run if the if statement evaluates to True. The fifth and last line is like the 2nd and 3rd and will always run when the function is called. It effectively closes the if statement above as no more lines can be inside the if statement below that line.
Indentation is used after:
1. Compound statements (eg. if, while, for, try, with, def, class, and their counterparts)
2. Continuation lines
More Info
1. Indentation style guide
2. Tabs or Spaces?
3. Official docs on indentation
gud
indents are wrong there
- Indents
- make a variable to store the channel id
- the
descriptionof the embed is wrongly placed
from discord.ext import commands
bot = commands.Bot(command_prefix="!")
@bot.command(name = "hello")
async def hello_world(ctx: commands.Context):
await ctx.send("Hello, World!")```
if i type !hello the bot sends messg twice
Do you have multiple instances running of somekind?
i dont undeerstand
wdym
@bot.command()
async def suggest(ctx):
em= discord.Embed(
description = 'A help command'
bot.get_channel(id))```
@spring flax gud now?
an example or single occurrence of something.
In this case I said multiple so do you have multiple instances of your bot running?
i dont think so
indents
how do i do them?
try regenerating your bots token
idk
okay
Try to learn python basics before you try discord.py
ohhh
The Resources page on our website contains a list of hand-selected learning resources that we regularly recommend to both beginners and experts.
!indents
Indentation
Indentation is leading whitespace (spaces and tabs) at the beginning of a line of code. In the case of Python, they are used to determine the grouping of statements.
Spaces should be preferred over tabs. To be clear, this is in reference to the character itself, not the keys on a keyboard. Your editor/IDE should be configured to insert spaces when the TAB key is pressed. The amount of spaces should be a multiple of 4, except optionally in the case of continuation lines.
Example
def foo():
bar = 'baz' # indented one level
if bar == 'baz':
print('ham') # indented two levels
return bar # indented one level
The first line is not indented. The next two lines are indented to be inside of the function definition. They will only run when the function is called. The fourth line is indented to be inside the if statement, and will only run if the if statement evaluates to True. The fifth and last line is like the 2nd and 3rd and will always run when the function is called. It effectively closes the if statement above as no more lines can be inside the if statement below that line.
Indentation is used after:
1. Compound statements (eg. if, while, for, try, with, def, class, and their counterparts)
2. Continuation lines
More Info
1. Indentation style guide
2. Tabs or Spaces?
3. Official docs on indentation
the rest i will try to learn
how do i stop my bot running from command propmpt
where do i put it
@boreal ravine
class suggestions(commands.Cog):
def __init__(self, bot):
self.bot = bot
@commands.command(description = 'Add a suggestion for this community!')
async def suggest(self, ctx, *,suggestion):
await ctx.channel.purge(limit = 1)
channel = discord.utils.get(ctx.guild.text_channels, name = 'π‘βsuggestions')
suggestEmbed = discord.Embed(colour = 0xFF0000)
suggestEmbed.set_author(name=f'Suggested by {ctx.message.author}', icon_url = f'{ctx.author.avatar_url}')
suggestEmbed.add_field(name = 'New suggestion!', value = f'{suggestion}')
await channel.send(embed=suggestEmbed)
def setup(bot):
bot.add_cog(suggestions(bot))```
gud?
you'd be helping yourself if you go through the !resources
are you copying code...?
@boreal ravine i didnt realize that the code was also running in vsc lol
No :)
you are missing a required kwarg on making the embed instance i think
now i get this error discord.ext.commands.errors.CommandNotFound: Command "ping" is not found
@bot.command(name="ping")
async def ping(ctx: commands.Context):
await ctx.send(f"Pong! {round(bot.latency * 1000)}ms")```
maybe?
help?
What do u need help with?
is that command in a cog @stuck flare ?
No
hi
Else it would have commands.command deco
his comments are !cog and !cogs, i assume he wanted it to be in a cog. hold up.
so um
how do i send a menu
Which is why I am confirming. Coz his followup comments are !cog and !cogs
Select Menu?
It's fine... Just told u haha
dosent metter
yes...```py
class Select(discord.ui.Select):
def init(self):
super().init(custom_id="Some identifier", placeholder="Placeholder", min_values=1, max_values=1, options=[discord.SelectOption(label="Hello", emoji="π³")])
async def callback(self, interaction: discord.Interaction):
await interaction.response.send_message("Hello", ephemeral=True) # to get the selected options, you can use interaction.data
It does... Everyone matters to me, at least (:
i abondonated it
a suggest command
idk how to do it
in commands.Bot thought
view = View().add_item(Select())
await ctx.send(view=view)
Oh that's easy... Lemme tell u
please
Get the channel where u want to send the message with channel = guild.get_channel(id)
Then just do channel.send(suggestion)
!d discord.Guild.get_channel
get_channel(channel_id, /)```
Returns a channel with the given ID.
Note
This does *not* search for threads.
Did u import everything?
async def check_perms(check: str):
fetch_arg = check
db_func = discord.utils.get(bot.get_all_channels(), name=fetch_arg)
channel_id = db_func.id
db_user = bot.get_channel(channel_id)
msg_info = discord.utils.get(db_user.history(limit=100).flatten())
msg = msg_info.content
msg_id = msg_info.id
msg_fetch = db_user.fetch_message(msg_id)
return msg
# Permission Variables
mod_one = check_perms("mod_one")
mod_two = check_perms("mod_two")
mod_three = check_perms("mod_three")
perm_on_member_join = check_perms("perm_on_member_join")
content_on_member_join = check_perms("on_member_join_content")
So, instead of the function returning the message inside a channel, it returns:
<coroutine object check_perms at 0x7fc11dfed830>
Anyone know why it's doing that?
U didn't await something
Ah
oh i frgt menus is an external thing that i need to import from github right
@jagged wigeon
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: HTTPException: 400 Bad Request (error code: 30007): Maximum number of webhooks reached (10)
``` how would i catch that error in a except block ?
you dont need to define the name of the command it was something else , but since you have the command named as ping it would work fine ,restart ur bot or change it to another name and back to that name
yes?
except discord.HTTPException:
thats it?
I told u the way...
Well I have made it before, sooo I can say it is easy once u figure out the logic
I ain't spoonfeeding, if u want that, sorry
wdym
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: HTTPException: 400 Bad Request (error code: 30007): Maximum number of webhooks reached (10)```  it raised the error then send the message
Traceback (most recent call last):
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/disnake/ext/commands/bot.py", line 886, in _load_from_module_spec
spec.loader.exec_module(lib) # type: ignore
File "<frozen importlib._bootstrap_external>", line 843, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "/home/runner/BetaBot/cogs/buttons.py", line 6, in <module>
class Buttons(commands.Cog):
File "/home/runner/BetaBot/cogs/buttons.py", line 17, in Buttons
view = discord.ui.View()
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/disnake/ui/view.py", line 166, in __init__
loop = asyncio.get_running_loop()
RuntimeError: no running event loop
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "main.py", line 16, in <module>
client.load_extension("cogs.buttons")
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/disnake/ext/commands/bot.py", line 958, in load_extension
self._load_from_module_spec(spec, name)
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/disnake/ext/commands/bot.py", line 889, in _load_from_module_spec
raise errors.ExtensionFailed(key, e) from e
disnake.ext.commands.errors.ExtensionFailed: Extension 'cogs.buttons' raised an error: RuntimeError: no running event loop
how do i run it?
await view.start()?
def check_perms(chid: int):
db_user = bot.get_channel(chid)
msg_info = discord.utils.get(db_user.history(limit=100).flatten())
msg = msg_info.content
return msg
# Permission Variables
mod_one = check_perms(890184706669301760)
mod_two = check_perms(890184726688710697)
mod_three = check_perms(890184754169774130)
perm_on_member_join = check_perms(890182787557097552)
content_on_member_join = check_perms(890180502982656030)
well it's now AttributeError: 'NoneType' object has no attribute 'history'
use get_event_loop
get_running_loop raises an error if no loop is running as you can see
it has nothing to do with the view
oh nvm
its disnake's fault
actually
you have to instantiate a view inside a command
or when the bot is running
This happens with me sometimes lol
not before
db_user is None
I get that - but why
guys how can i run a different file from one another file
I don't understand why bot.get_channel failed
i mean i am trying to run a file of my dashboard from my main file
because the bot's cache isnt filled yet
Is there a way to fix that
do those operations after the bot starts
@hasty iron can u plz help me
what framework are you using
quart
i want to run the file from my main file but how
So after the on_ready event?
bot.loop
why do i keep on getting this?
???
getting what
ok so quart has an async function that runs the application that is app.run_task, import your app variable to the bot file, and use bot.loop.create_task(app.run_task())
why are you nesting classes
there is no reason for you to nest classes
ok
but isnt that how menus are added
??
why are you trying to do that
ok wait i got the way
into the app...??
not talking to you
read this
it isnt working :/
Now to monitor my reddit application and make loads of comments and posts to ensure it works as intended.
thats what i referred to but it isnt working
added something similar
thats no where as similar to the example
hmmmm
dont know where they added nested classes in the example
How would I go about converting my account creation date (2020, 6, 9) to an epoch time?
you mean a unix timestamp?
yes
!d datetime.datetime.timestamp
datetime.timestamp()```
Return POSIX timestamp corresponding to the [`datetime`](https://docs.python.org/3.10/library/datetime.html#datetime.datetime "datetime.datetime") instance. The return value is a [`float`](https://docs.python.org/3.10/library/functions.html#float "float") similar to that returned by [`time.time()`](https://docs.python.org/3.10/library/time.html#time.time "time.time").
Naive [`datetime`](https://docs.python.org/3.10/library/datetime.html#datetime.datetime "datetime.datetime") instances are assumed to represent local time and this method relies on the platform C `mktime()` function to perform the conversion. Since [`datetime`](https://docs.python.org/3.10/library/datetime.html#datetime.datetime "datetime.datetime") supports wider range of values than `mktime()` on many platforms, this method may raise [`OverflowError`](https://docs.python.org/3.10/library/exceptions.html#OverflowError "OverflowError") for times far in the past or far in the future.
For aware [`datetime`](https://docs.python.org/3.10/library/datetime.html#datetime.datetime "datetime.datetime") instances, the return value is computed as:
```py
(dt - datetime(1970, 1, 1, tzinfo=timezone.utc)).total_seconds()
``` New in version 3.3.
Changed in version 3.6: The [`timestamp()`](https://docs.python.org/3.10/library/datetime.html#datetime.datetime.timestamp "datetime.datetime.timestamp") method uses the [`fold`](https://docs.python.org/3.10/library/datetime.html#datetime.datetime.fold "datetime.datetime.fold") attribute to disambiguate the times during a repeated interval.
hmmm
class Dropdown(discord.ui.Select):
def __init__(self):
super().__init__(custom_id="Some identifier", placeholder="Placeholder", min_values=1, max_values=1, options=[discord.SelectOption(label="Hello", emoji="π³")])
async def callback(self, interaction: discord.Interaction):
await interaction.response.send_message("Hello", ephemeral=True) # to get the selected options, you can use interaction.data
class DropdownView(discord.ui.View):
def __init__(self):
super().__init__()
self.add_item(Dropdown)
@commands.command()
async def select(self, ctx):
view = DropdownView()
await ctx.send("ok", view=view)
ok now?
why is the command inside the view?
its a cog '_'
yeah clearly from the code you just sent
so...?
owo
hmmmmm
I think you want time module, not datetime
hm
I got the hang of it I just dont know how you can use member.created_at inside the time.time thing or the datetime thing
what
member.created_at returns a datetime object
time.time returns the current time
!d time.time
time.time() β float```
Return the time in seconds since the [epoch](https://docs.python.org/3.10/library/time.html#epoch) as a floating point number. The specific date of the epoch and the handling of [leap seconds](https://en.wikipedia.org/wiki/Leap_second) is platform dependent. On Windows and most Unix systems, the epoch is January 1, 1970, 00:00:00 (UTC) and leap seconds are not counted towards the time in seconds since the epoch. This is commonly referred to as [Unix time](https://en.wikipedia.org/wiki/Unix_time). To find out what the epoch is on a given platform, look at `gmtime(0)`.
Note that even though the time is always returned as a floating point number, not all systems provide time with a better precision than 1 second. While this function normally returns non-decreasing values, it can return a lower value than a previous call if the system clock has been set back between the two calls.
rn i dont have any
my idea is to use the get_member
so I input an int
and it puts the int in the get_member function
member = int(input("Member Id To Move: "))
channel = int(input("Channel Id To Move: "))
member = client.get_guild(713310556572090439).get_member(member)
await member.move_to(client.get_channel(channel))
print("Moving")
dont know if this gonna work
!d discord.ext.commands.MemberConverter
class discord.ext.commands.MemberConverter(*args, **kwargs)```
Converts to a [`Member`](https://discordpy.readthedocs.io/en/master/api.html#discord.Member "discord.Member").
All lookups are via the local guild. If in a DM context, then the lookup is done by the global cache.
The lookup strategy is as follows (in order)...
another question
how can I implement
while True:
member = int(input("Member Id To Move: "))
channel = int(input("Channel Id To Move: "))
member = client.get_guild(713310556572090439).get_member(member)
await member.move_to(client.get_channel(channel))
print("Moving")
so it runs all the time
and doesnt cancel the other listeners
i put it in onready but that didnt work
iirc you cant
bruh