#discord-bots
1 messages · Page 447 of 1
@client.command()
async def afk(ctx, mins: int):
await ctx.send(...)
await ctx.author.edit(...)
await asyncio.sleep(mins * 60)
await ctx.send(...)
await ctx.author.edit(...)
can someone tell me how to get the voice channel in which the command user currently is instead of hardcoding the channel name
ctx.author.voice.channel
ok thanks.
remember ctx.author.voice might be none so you should check if it is not none before getting the channel
oh , ok
if it gets make error by saying Pls join a Voice channel
Learning discord.py?
yes
do you know python?
not much but learning

how can i make my bot join the voice channel the user is currently ?
bruh
what if someone mentions it in middle of afk
ohk
you would have to use a database if you need an afk command
or save it in a cache
Then learn python first then dpy
yeah , like using asyncio.sleep would help in telling the user that the afk is over , but wont help if you want the bot to reply if someone pings the user
you can do wait_for as a task. so like ```py
bot.loop.create_task(bot.wait_for("message", check=lambda message: message.author != bot.user and message.guild == ctx.guild and ctx.author in message.mentions))
wont it be too many api requests ?
um, no, wait_for waits an event to be dispatched, not making api requests
i wrote this code to make my bot join the voice channel i am currently , but i doesnt join , please tell what did i do wrong
`@client.command()
async def join(ctx):
channelName = ctx.author.voice.channel
print(channelName)
voiceChannel = discord.utils.get(ctx.guild.voice_channels, name=f"{channelName}")
voice = discord.utils.get(client.voice_clients, guild=ctx.guild)
await voiceChannel.connect()`
oh
ohk
channelName should be ctx.author.voice.channel.name
@bot.command()
async def permissions(ctx, member:discord.Member=None):
member = member or ctx.author
await ctx.send(list(ctx.channel.overwrites_for(member)))
I'm trying to make a command that lists the member's permission for a channel, I've tried a lot of ways like permissions_in and permissions_for, but all of them return some guild permissions, like admin. I'm the server owner yes but I just watn channel perms
still doesnt work.
error?
import discord
from discord.ext import commands
user_notfound = None
class unban(commands.Cog):
def __init__(self, bot):
self.bot = bot
@commands.command()
@commands.has_permissions(ban_members=True)
async def unban(self, ctx, *, member):
global user_notfound
user_notfound = member
banned_users = await ctx.guild.bans()
member_name, member_disc = member.split('#')
description = f'''
**Information :**
Author : {ctx.author}
User : {member}```'''
for banned_entery in banned_users:
user = banned_entery.user
if (user.name, user.discriminator) == (member_name, member_disc):
embed = discord.Embed(
title=f"{user} Has Been Unban", description=description, color=ctx.author.colour, timestamp=ctx.message.created_at,)
embed.set_footer(text=f'command used by : {ctx.author}',
icon_url=str(ctx.author.avatar_url))
await ctx.guild.unban(user)
await ctx.send(embed=embed)
await ctx.message.delete()
return
await ctx.send(member + 'not found')
await ctx.message.delete()
@unban.error
async def unban_error(self, ctx, error):
if isinstance(error, commands.errors.CommandInvokeError):
await ctx.send(f'{user_notfound} not found')
await ctx.message.delete()
def setup(bot):
bot.add_cog(unban(bot))
how to put user_notfound variable into function init?
self.user_notfound = "value"
okey i try
can you print voice and voiceChannel?
import discord
from discord.ext import commands
user_notfound = None
class unban(commands.Cog):
def __init__(self, bot):
self.bot = bot
self.user_notfound = None
@commands.command()
@commands.has_permissions(ban_members=True)
async def unban(self, ctx, *, member):
global self.user_notfound
self.user_notfound = member
banned_users = await ctx.guild.bans()
member_name, member_disc = member.split('#')
description = f'''
**Information :**
Author : {ctx.author}
User : {member}```'''
for banned_entery in banned_users:
user = banned_entery.user
if (user.name, user.discriminator) == (member_name, member_disc):
embed = discord.Embed(
title=f"{user} Has Been Unban", description=description, color=ctx.author.colour, timestamp=ctx.message.created_at,)
embed.set_footer(text=f'command used by : {ctx.author}',
icon_url=str(ctx.author.avatar_url))
await ctx.guild.unban(user)
await ctx.send(embed=embed)
await ctx.message.delete()
return
await ctx.send(member + 'not found')
await ctx.message.delete()
@unban.error
async def unban_error(self, ctx, error):
if isinstance(error, commands.errors.CommandInvokeError):
await ctx.send(f'{self.user_notfound} not found')
await ctx.message.delete()
def setup(bot):
bot.add_cog(unban(bot))
but outside function
doesnt print anything with .name but prints without .name in channelName
self.user_notfound is currently accessible to your whole class
what is the difference between users and members ?
Member is a subclass of Userr
print voice and voiceChannel not channelName
ok
You can read about it here
Member is discord.Guild member, while user is your user account
!d discord.Member
class discord.Member```
Represents a Discord member to a [`Guild`](https://discordpy.readthedocs.io/en/stable/api.html#discord.Guild "discord.Guild").
This implements a lot of the functionality of [`User`](https://discordpy.readthedocs.io/en/stable/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/stable/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/stable/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.
thanks
still doesnt print anything
is there any reason some urls of images cant load in an embed? cuz i need a lot of birb pictures
discord bug
Is it true that Discordpy will die in 2022?
development has already stopped
It's already dead
it's in the pins
you can still use it
we now have Pycord, an alternative of dsc.py
Check their urls, they should not be an embeddable link but a .gif/.png/or a valid extension link
what is a birb
how do I make cog help to work in lower case??
it works nly if I type help Moderation
Somebody there can help me, with this error.
What exactly is the function to the right of point 2 in a function?
@client.command()
async def add(ctx, num1, num2):
await ctx.send(f"The sum is {sum(num1, num2)})")``` where is my dumb butt going wrong
num1: int
bot._BotBase__cogs = commands.core._CaseInsensitiveDict()
Add this line below your bot constructor. This makes the dictionary of your cog names case insensitive.
commands.core = discord.ext.commands.core module
typehint both to int
The syntax is exactly the same as discord py?
hm
What exactly is the function to the right of point 2 in a function?
Was that to me or?
typehinting?
@gloomy pewter https://docs.python.org/3/library/typing.html
maybe this can help
No, does that mean to change or what?
change what?
which constructor?
@client.command()
async def add(ctx, num1, num2):
num1 = int(input("Enter a numer"))
num2 = int(input("Enter another numer"))
result = num1 + num2
await ctx.send(f"The answer is {result}")``` so this should work?
no
!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.9)"). 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.9)") 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.9)") containing those arguments is returned instead. Please check the [documentation](https://discordpy.readthedocs.io/en/stable/api.html#discord-api-events) for a list of events and their parameters.
This function returns the **first event that meets the requirements**...
well im dumb af
remove those parameters and only keep ctx
i c
Data type may be
why do you need user input when you have arguments for the command in the first place
constructor means where you declared your Bot class, like ```py
bot = commands.Bot(...)
also don't dm
Isn't that right?
nevermind what i said
async def add(ctx, num1 : int, num2 : int):
await ctx.send(num1 + num2)```
because im dumb and im trying to make this work
sry
then do something like add 1 1
Which int is to change the data type?
i have no clue what you are trying to say
typehinting here basically tells python that the argument is an interger
putting a string would give an error
Okey thanks @spring flax
or you could do await ctx.send(int(num1) + int(num2)) if you want to handle the errors
someone know?
welp
בולבול 
the id of the message is invalid
i wanted to make it so that you have enter a number then another one then it gave the answer which i was able to do but it required me to enter it in terminal as well sadly
@opaque trailwhat i need to do?
Typehints do nothing in python except for readability for developers and makes linters and type checkers happy. It's discord.py which uses those typehints @gloomy pewter
In normal python: ```py
def foo(a: int):
return a
foo('test') # this will work fine
In discord.py, same will raise errors
yes because you're using input() for whatever reason
what?
@client.command()
async def add(ctx, num1: int, num2: int):
await ctx.send(f"The answer is {num1 + num2}")``` but this work i can just do .add num1 num2- thanks for that @spring flax
then what do i use
this is okay
replace the message id in the players command
this
is fine then
so like
me : .add
bot : Enter the first number
me : 1
bot : Enter the second number
me : 1
bot : the answer is : 2
you can also use wait_for to make the user say whether he wants to add divide multiply or subtract, and then give the two numbers
OH
!d discord.ext.commands.Bot.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.9)"). 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.9)") 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.9)") containing those arguments is returned instead. Please check the [documentation](https://discordpy.readthedocs.io/en/stable/api.html#discord-api-events) for a list of events and their parameters.
This function returns the **first event that meets the requirements**...
there are examples in the docs to do what you want
ic ic ok
Thank you
how can i delete bot message? i tried to do this
msg = send_bot_message()
await msg.delete()
?
await after.delete()?
that should work
of course
if not try await after.message.delete()
You mean await ctx.send(..., delete_after=...)?
what?
.
how can i loop this thing?
so make 2 wait_for's and add message content
?
heh?
help
put in a loop?
im new and dont understand
your token may be wrong
but how
which line
is wrong
for, while loop
which line is it
!rtfm on_webhook_update @slate swan
Breh
the token that you have put into the line at the bottom is not a token
"token"
@shy schooner like this?
like that right
:v
!d discord.on_webhooks_update
discord.on_webhooks_update(channel)```
Called whenever a webhook is created, modified, or removed from a guild channel.
This requires [`Intents.webhooks`](https://discordpy.readthedocs.io/en/stable/api.html#discord.Intents.webhooks "discord.Intents.webhooks") to be enabled.
There :D
how many times do you want to loop that stuff
to much
@slate swan use this event
ok
infinity
just put it in
while True:
# do anything you want
bare in mind this will loop for ever and can only be exited with break opperator
token is wrong
yh
How do I save guild Id for something
@shy schooner
i'm lost
what db
while True:
await asyncio.sleep(15)
await msg.delete()
await ctx.send....
do you have a solid understand of basic python
there's no for while loop :v
i need help with token
regenerate it
It is "learn python please
"
:D
😄 😔
like this? i need to fix an command and i'm not so good at this
Insert your envvar in replit's console whatever, and put it's key value as an str in on.environ dict
where is indentation
How can i get vps stats with vultr api in form of a command?
If you're not good at this, you should first complete the basics of python and oop before using dpy
replit will make everything public so
is better
I don't tell people to not use replit anymore 
Everybody does that
Have a look at this: #discord-bots message
.

free services are always bad
Depends, free trials are not that bad, and heroku is actually good for api and web related stuff but not discord bot
I myself have a free 1 yr azure subscription 👀
and it's free
does heroku update json files for database
yes, their file system is ephemeral
and json is not meant to be used as a database
if you need to store secrets and don't update that file later, it will work
Json files? It is bad practice. Heroku deletes all your files created by the application every 24 hours, it is in the terms and conditions.
can the bot send hidden msg without slash commands ?
With an interaction, yes
so sql is better?
slash command is type of interaction, but there are more like buttons and selects and context menu commands
without an interaction like i wanna send the missing perms error msg hidden
In normal commands: Not possible
alr
I do not know whether to tell you 1000 times better, Be the client of the server to save data.
a discord bot using discord.py does not have a method or function get_channel, you are probably wanting to use fetch_channel
!d discord.Client.get_channel
get_channel(id)```
Returns a channel with the given ID.
https://cdn.discordapp.com/attachments/343944376055103488/883691306185015346/unknown.png
how can i get this output ?
shit i was looking at the commands.Bot class this whole time
For a moment I literally thought Xenon sent a Rythm embed lol 
You mean embeds?
!d discord.Embed
class discord.Embed(**kwargs)```
Represents a Discord embed.
`len(x)` Returns the total size of the embed. Useful for checking if it’s within the 6000 character limit.
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/stable/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.
Use a hyperlink, in the title and description.
oh this is embed thx
got it running
yay
Hyperlinks/markdown don't work in title 
in title, you have an additional kwarg url=
is that title just bold text in the desc?
If it does not work test in the title of a field
oh
Field names also don't support most of the markdown iirc, it's just description and field values
== Raw embeds (1/1) ==
{'description': '```py\n'
'\n'
'class discord.Embed(**kwargs)```\n'
'Represents a Discord embed.\n'
'\n'
'`len(x)` Returns the total size of the embed. Useful for '
'checking if it’s within the 6000 character limit.\n'
'\n'
'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/stable/api.html#discord.Embed.Empty '
'"discord.Embed.Empty").\n'
'\n'
'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.',
'title': 'discord.Embed',
'type': 'rich',
'url': 'https://discordpy.readthedocs.io/en/stable/api.html#discord.Embed'}
@client.event
async def on_message():
if message.content.startswith('!add'):
channel = message.channel
await channel.send("Please enter a number")``` ok ive tried alot of things but i cant get past this can someone tell me what might be next
Yeah it's the url kwarg in embed's title for hyperlinks and description supports markdown
'title': 'discord.Embed'
message isn't defined
oh i did define it but i removed, lemme add it back
pass in a message
@client.event
async def on_message(message):
if message.content.startswith('!add'):
channel = message.channel
await channel.send("Please enter a number")
msg = await client.wait_for('message')
await channel.send(message)```
like that u man?
mean*
yes
you need to add the check kwarg in wait_for()
now this does this
no message is now an object, to need to await ctx.send(message**.content**)
define the check funciton
@client.event
async def on_message(message, ctx):
if message.content.startswith('!add'):
channel = message.channel
await channel.send("Please enter a number")
def check(m):
return m.content == #what do i add here to make it so that it can only be an integer
msg = await client.wait_for('message', check=check)
await ctx.send(message.content)```
@shy schooner sorry for the ping but any clue?
np
!d str.isdigit
str.isdigit()```
Return `True` if all characters in the string are digits and there is at least one character, `False` otherwise. Digits include decimal characters and digits that need special handling, such as the compatibility superscript digits. This covers digits which cannot be used to form numbers in base 10, like the Kharosthi numbers. Formally, a digit is a character that has the property value Numeric\_Type=Digit or Numeric\_Type=Decimal.
def check(msg):
return msg.author == ctx.author and msg.channel == ctx.message.channel
on_message event doesnt take context
@lone aurora ^
@lone aurora
ill try em all ig.. thank you all ;))
eh this didnt work
def normal_check(m):
return m.author == ctx.author and m.channel == ctx.channel and int(m.content)
try this
Hey! I am trying to set an embed color to be my bot's current displayed color, but it doesn't seem to work - it keeps returning #000000.
I think the way that's supposed to be used is self.client.user.color, as the documentation says. This does return #000000 when it's supposed to be returning #d69420 (hey don't mind me, it's a nice color).
Trying to get a user's color with ctx.author.color does work, and it does return a color which is my displayed user color.
What exactly am i doing wrong?
My code:
@commands.command()
async def avatar(self, ctx, *, user: discord.Member = 'author'):
if user == 'author':
user = ctx.author
ae = discord.Embed( # testing
colour = discord.Color.default(), # i have to input the bot's color here
title = 'title',
description = 'description'
)
ae.add_field(name='field1',value='value1')
await ctx.send(user.color) # debug, returns the working color
await ctx.send(self.client.user.color) # debug, returns #000000 (why)
await ctx.send(user.avatar_url) # returns the avatar
await ctx.send(embed=ae) # test embed
Both are basically same things, and they want the content to be digits
edited
wdym
int() raises exception, it don't return False on conversion failure
!e int('test')
@slate swan :x: Your eval job has completed with return code 1.
001 | Traceback (most recent call last):
002 | File "<string>", line 1, in <module>
003 | ValueError: invalid literal for int() with base 10: 'test'
!e py print(int('test', base=30)) hahaha
@lament mesa :white_check_mark: Your eval job has completed with return code 0.
796469
how am i able to make my discord bot as FAST as possible
anything helps, trying to shave off every millisecond
try introducing caching to your database (if you have one)
built in functions
um which functions? Can you please give an example?
what do you mean caching? i do have a db but isnt that crazy advanced
@client.command()
async def add(ctx, num1:int, num2:int):
if (not num1):
await ctx.send("Please do **.add <number 1> <number 2>**")
if (not num2):
await ctx.send("Please do **.add <number 1> <number 2>**")
await ctx.send(f"__{num1}__ + __{num2}__ = **__{num1 + num2}__**")``` eh am i doing something wrong (yes i gave up on trying to make it ask for 2 numbers)
It depends ```py
list(map(do_something, data)) # Faster, if you dont want the result to be a list remove list()
[do_something(i) for i in data] # this is also fast but relatively slow```
caching db means loading your database into python variables like dictionaries and all instead of making new calls and connections on every fetch
Oh I see. I thought latter one is faster lol
Caching means saving data in the ram so it will be faster to access it
try asking in #python-discussion
anyone? ._.
You can also cache api requests
There are advanced caching methods like redis
cache api requests... redis... google time
anybody?
whats the point
Try ctx.guild.me.color
oh i just realised.
This always returns
Colour.default()
u can get ctx on on_message but there is no point
bot's color is it's top role color. You sure it isn't black?
is client.user a thing? Should it not be self.client.color?
it used only for commands extensions
alright, will try
!d discord.Client.user
user```
Represents the connected client. `None` if not logged in.
oops, not the request i meant caching the response given by the api
like dpy does
:)
You are trying to do a User.color kind of thing
AFAIK Client does not have a color property
but a ClientUser does
Ah I see.. how do we put that in cache btw? I think there's no direct or external method for this
@client.command()
async def add(ctx, num1:int, num2:int):
if not Arguments:
await ctx.send("Please do **.add <number 1> <number 2>**")``` where am i going wrong now ;(((
what is Arguments
Oh hey, that worked! Thanks!
There is a difference between a User(or ClientUser).color, and Member.color
isnt arguments for like num1 and num2?..
oh
i just want to do it so that if the user doesn't provide num1 and num2, it sends an error msg
Anytime 😄
@client.command()
async def add(ctx, num1:int = None, num2:int = None):
if not num1 or not num2:
await ctx.send("Please do **.add <number 1> <number 2>**")
Typehint it to typing.Optional[int] and check if not num1 and not num2
there should be, since it returns top role color and user don't have any roles
Yeah exactly
Which is why I think the docs that it always returns a default color (0)
Yes
import requests
cache = {}
def get_user_data(id):
if id in cache:
return cache[id]
else:
response = requests.get('api_url')
# Maybe check the response status to see if its 200
data = response.json()
cache[id] = data
return data
oops I mean in dpy's internal cache (ConnectionState)..
even a list can be used to cache the data
@client.command()
async def add(ctx, num1:int, num2:int):
await ctx.send(f"__{num1}__ + __{num2}__ = **__{num1 + num2}__**")
if not num1 or not num2:
await ctx.send("Please do **.add <number 1> <number 2>**")```
umm this isnt working either, just shows an error on terminal saying that num1 and num2 are missing
Yeah all the stuff for subclassing list I was asking yesterday was for caching only 
need to check the source for that
Oh just need to know there's a direct/external way for that, I don't think there is. Thanks :)
@client.command()
async def add(ctx, num1:int, num2:int):
await ctx.send(f"__{num1}__ + __{num2}__ = **__{num1 + num2}__**")
if MissingRequiredArgument:
await ctx.send("Please do **.add <number 1> <number 2>**")``` i tried this still not working
didnt i send u the code?
i tried that too
also if u want use that u need error handler
ic
@client.command()
async def add(ctx, num1:int, num2:int):
await ctx.send(f"__{num1}__ + __{num2}__ = **__{num1 + num2}__**")
@add.error
async def add_error(ctx, error):
if isinstance(error, commands.MissingRequiredArgument):
await ctx.send("Please do **.add <number 1> <number 2>**")
may not work as i havent used the library for long
that should work
wow, thanks a ton man
i was about to go look for it myself.. but then i saw u alr did it
legend
Should I create a bot that anyone who wants can host it and use it? Modmail one
class NIR(NoBotIdeas) I too need some ideas other than bots 
if u want
My poor net
one more thing, ive been trying to find a way for this but i haven't found anything on it yet- is it possible to make cmds case insensitive?
I'm already doing one project related to this
But it's boring now
case_insensitive=True
set case_insensitive = True in your bot constructor
hm
guys the one who press the button , whats his name
i mean
i want to make if someone press the button
to mention his name
what button?
reactions? or new buttons thing
component
new butt
Which library are you using? 
discord components
No idea for that 
sorry
its okay
anyone else ??
Um I have no idea about that lib, but maybe interaction.user?
ok im dumb is it supposed to be like this
@client.command()
async def cmds(ctx, case_insensitive=True):```
or this
```py
@client.command()
async def cmds(ctx):
case_insensitive=True```
interaction.user.mention u think ?
No, in your bot constructor
Sure
bot = commands.Bot(command_prefix='!', case_insensitive=True)```
Or command-specific:
```py
@bot.command(case_insensitive=True)```
Lol you can just search their docs or I think they also have a support server
if I want to make a bot that fetch give them from a site so that at the time a content is posting it on my discord server how to do it? if you have a bot that does this with another site I invite you to send me the code pls
You'd need to somehow wait for a response from some Api
no I believe
Imagine camelCase 🤮
function names should be snake_case
Like the amazing words written by lemon: "And camelCase is not for Python, never ever, never everrrr, and comments are important...."
Oh shit sorry
comments are important
Yeah it's part of the song lmao
It goes like: And comment are important, as long as they're maintained, if comments are misleading it'll drive people insane
as long as they're maintained.. (which I can't
)
oh yea camel case in python
Just try to be emphatic, just tyr to be a friend, it's really not that hard just adhere to, PEPPP88
You remember whole lyrics
I LISTEN TO THE SONG EVERY DAY Nah it's just pure luck
I see luck
If I do:
role = ctx.guild.get_role(ctx.guild.id)``` This would return everyone role right?
yes
i have some good js comments, shall i send it in dm
def PoopInMyMouth(POOPERMoUNTH, PoopValue):
for i in range(10324):LF
print(PooppperMounthm, Poopvalue)
what is wrong with my code guys!! it no work
Sure
I hate the fact I'll be learning js in school, but for web development
LMFAO i learnt C last year and the teacher left mid year
israeli teachers
Our school taught us basic variable types like int and str, and next chapter was numpy and pandas 
I am from Israel too
he was a pretty cool teacher 😦
Ignoring exception in on_message
Traceback (most recent call last):
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/client.py", line 351, in _run_event
await coro(*args, **kwargs)
File "/home/runner/omfg/cogs/level.py", line 49, in on_message
result = await self.find_or_insert_user(message.author)
File "/home/runner/omfg/cogs/level.py", line 23, in find_or_insert_user
await cursor.execute('Select * from users where user_id = ?', (member.id,))
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/aiosqlite/cursor.py", line 37, in execute
Traceback (most recent call last):
File "main.py", line 3, in <module>
Traceback (most recent call last):
File "main.py", line 3, in <module>
Traceback (most recent call last):
File "main.py", line 3, in <module>
Traceback (most recent call last):
File "main.py", line 3, in <module>
Traceback (most recent call last):
File "main.py", line 3, in <module>
import discord
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/__init__.py", line 23, in <module>
from .client import *
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/client.py", line 27, in <module>
import asyncio
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/asyncio/__init__.py", line 21, in <module>
from .base_events import *
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/asyncio/base_events.py", line 296
future = tasks.async(future, loop=self)
^
SyntaxError: invalid syntax
is it because im in main?
oh what the hell?
you should try reinstalling python or reinstalling the asyncio package
hmm im in replit?
asyncio is a pre-installed python package
yes i know
i meant delete it and download it again
w- what?
👌
async is a reserved keyword
yes but its a problem with the asyncio package
yeah
that error usually show up when you install pip install discord instead of discord.py
update python
yea try that
i'm using pycord in replit
just make sure that you're above 3.8
i have the latest version guys
try reinstalling if possible in repl.it
it must be possibl
e
the error says /python3.8/site-packages/
but replit have the latest version or no?
latest is 3.9.7
no, replit is still 3.8.7 (maybe)
:/
is much better
well yea but he is trying to host it 24/7
yeah
and my pc can't handle vsc
fix the bug in vscode then paste the code into replit :v
he cant fix the bug
its not related to his code
ok
its related to the python installation
ok
send code
wait
but its a problem with his asyncio package? he should reinstall his python venv or somehow reinstall the asyncio package, i do not know how that is possible on repl.it but thats the only way
try to make a new repl.it project and paste your code there that might work
i think that replit installs python for users
yes, but you can access the console
continuing to mess around with the avatar command and um...
where does it even see 2 arguments?
event is not defined
try to update discord.py
its not event, its ctx.author
!d discord.Embed.set_image
set_image(*, url)```
Sets the image for the embed content.
This function returns the class instance to allow for fluent-style chaining.
Changed in version 1.4: Passing [`Empty`](https://discordpy.readthedocs.io/en/stable/api.html#discord.Embed.Empty "discord.Embed.Empty") removes the image.
oh yea sorry
i added event because is for the one who press the button
ae.set_image(url="your url")
oh, brilliant !!
that barely makes any sense but ok
but you didnt define it?
so what to do rn
@opaque trailcan y help me to define it
!d discord.Member.guild
The guild that the member belongs to.
discord.User does not have a guild
i forget all thing
uhh should event be the interaction event?
any good free tier for music bot hosting? in aws
it's possibel with webhooks ?
i guess you can do webscraping?
I supose yes
nice grammer
Guys, is there a way to save avatars of members
why?
!d discord.Asset.save
await save(fp, *, seek_begin=True)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Saves this asset into a file-like object.
ohh
for channel in ctx.guild.text_channels.items():
if str(channel.type) == 'text':
text_channel_list.append(channel)``` Does anyone know how to fix too many values to unpack?
why dont you just
text_channel_list = ctx.guild.text_channels
```?
It also says theres too many values to unpack:/
you still have the for loop. delete the for loop. just use the code i sent
I removed the for loop already
this works different in each guild
It still doesnt work
send the new code and the whole traceback..
bro @opaque trail
what do you mean work different
in some guilds it works and in some id does not
I got punged
@opaque trail
class FunctionServerInfo(commands.Cog):
def _init_(self, client):
self.client = client
@commands.command(pass_context = True)
async def serverinfo(self, ctx):
embed = Embed(title = "Server information",
colour = 0xFF5733,
timestamp = datetime.utcnow())
text_channel_list = ctx.guild.text_channels
embed.set_thumbnail(url=ctx.guild.icon_url)
fields = [("Owner", ctx.guild.owner, False),
("Created At", ctx.guild.created_at.strftime("%d/%m/%Y %H:%M:%S"), False),
("Region", ctx.guild.region, True),
("Member Count", str(len([m for m in ctx.guild.members if not m.bot])) + " Humans | " + str(len([m for m in ctx.guild.members if m.bot])) + " Bots | " + str(len(ctx.guild.members)) + " Total", False),
("Channel Count", str(len(ctx.guild.text_channels)) + " Text Channels | " + str(len(ctx.guild.voice_channels) )+ " Voice Channels | " + str(len(ctx.guild.voice_channels) + len(ctx.guild.text_channels)) + " Total", False ),
("Text Channels", "[" + str(len(ctx.guild.text_channels)) + "]", text_channel_list, False),
("Roles" + "[" + str(len(ctx.guild.roles)-1) + "]", ", ".join([str(r.mention) for r in ctx.guild.roles if r.name != "@everyone"]), False),
("Emojis" + "[" + str(len(ctx.guild.emojis)) + "]", ", ".join([str(emoji) for emoji in ctx.guild.emojis]), False)
]
for name, value, inline in fields:
embed.add_field(name=name, value=value, inline=inline)
await ctx.send(embed = embed)
def setup(client):
client.add_cog(FunctionServerInfo(client))```
obviously, replace
await ctx.guild.create_role(...)
by
mutedRole = await ctx.guild.create_role(...)
your Text Channels field has 4 values?
Lemme show ya how it looks
In embed.fields.5.value: Must be 1024 or fewer in length.
Bruhh
Do u know how to fix that?
yes
read the error.
mutedRole = await ctx.guild.create_role(name="Muted", permissions=discord.Permissions(8))
is psutil blocking?
@client.command(pass_context=True)
async def start(ctx):
try:
channel_id = ctx.author.voice.channel.id
channel = client.get_channel(channel_id)
vc_members = channel.members
vc_member_list = []
for member in vc_members:
vc_member_list.append(member.mention)
vc_member_list.random.shuffle()
embed = discord.Embed(title="Teams")
embed.add_field(
name="Team A",
value=
f'{vc_member_list[0]} \n {vc_member_list[3]} \n {vc_member_list[4]} \n {vc_member_list[7]}',
inline=True)
embed.add_field(
name="Team B",
value=
f'{vc_member_list[1]} \n {vc_member_list[2]} \n {vc_member_list[5]} \n {vc_member_list[6]}',
inline=True)
await ctx.send(embed=embed)
except:
await ctx.send("Wait for 8 people in the queue.")
can someone help with this code in general? theres a few things i wanna fix
i use psutil.virtual_memory() and psutil.cpu_percent()
just run these functions in executor?
alr
why permisiions 8 it gives admin perms thats whai 00
its admin
then change it, thats what you typed before that?
lol
lol
muted role have admin perms
bro i am new but dont u know permisiions integer
nice bot
it works now
why is this not working?
greyEmbed.set_image(image="finalim.jpg")```
set_image needs to be a url
how can i insert images from directory then?
you could either upload it to the web and then provide the url, or do this:
file = discord.File("finalim.jpg", filename="finalim.jpg")
greyEmbed.set_image(url="attachment://finalim.jpg")
await ctx.send(file=file, embed=embed)
but then the image will come outside of embed
is finalim a static image?
how am i able to make my bot as FAST as possible. anything helps, trying to save milliseconds
Is Discord.py updated with the latest API changes?
no
☹️
discord.py has ended updates
@client.command()
async def kill(ctx):
if client.is_owner:
channel = client.get_channel(874657555656368138)
await ctx.send("Turning off. See you on the other side!")
await channel.edit(name="Server Status: Unknown")
await asyncio.sleep(1)
await client.close()
else:
pass
Current code.
Problem: Anyone can run the command. Even if not owner.
Question: Am I missing something? Im looking for a 2nd pair of eyes.
I have owner specified in this client = commands.Bot(command_prefix="c!", owner_id=693661517824131172)
maybe try using @commands.is_owner()
so it would be like this ```py
@bot.command()
@commands.is_owner()
async def kill(ctx):
im trying to sell my skills with discord bot development. im in school rn and its of of the few programming skills i feel comfortable with. were would you recommend i start?
and it anyone wants a discord bot just dm me
How much dpy do u know?
Well, can I get some more context? A lot can be used differently but different people 😅
how to find the audio bitrate of my bot??
im asuimg i cant send the link of the one im working on rn cause it would be self promo
Your bot doesn't have an audio bitrate, a voice channel does
Ah. Well then if it's fine with you, then sure. But never stop learning
i meant the how do i know the quality of my bot's music?
I still don't know many things in dpy itself and I learn something new everyday
Well it depends on how you get and play the music
can i show the code?
But that's something I'm clueless about since I never tried it
Sure, maybe someone will know
depends on the songs bitrate
only stuff you can regulate
Makes sense
Is there a way to check if the bot was manually disconnected by a user ?
if your using youtubedl then it probable has a bitrate value in the object
You can probably detect packet loss as well but not sure how useful that would be.
We're not allowed to help with ytdl anyway
is it possible to create a command for like unscramble without making a .json file?
like for example:
i would do b!unscramble (b! being my prefix)
the bot would respond with a random scrambled word like:
etintap
and if i were to say the correct answer (patient) then it would say "you answered correctly!" and if i said it wrong then it would say "you were wrong. you have 1 more try left~"
the reason i dont want to use .json files is because i dont know HOW to use .json files
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)
kk xd
im aware but im just giving out ideas
and btw, u remember me, i was making a bot with custom replies??
ah yh got yah
I do haha
you leaked a token?
nope ig
your youtube one
Yea make sure you keep your token and google api key in another file.
oh yes
Also, against tos code like that one aren't allowed here anyway
this is the code, https://paste.pythondiscord.com/yetoxecepa.py
i added reload stuff and a backup command too :))
Someone*
Cool
In my bot every command works
ty lol
But only warn and mute never does even every new command i add!
Hey @slate swan!
It looks like you tried to attach a Python file - please use a code-pasting service such as https://paste.pythondiscord.com
My file is too long
How can I check if a message being sent is a channel mention? for example #help-apple
you can use the textchannel convertor
How do u disable a option when it is selected?
can u send docs for it?
!d discord.TextChannel
class discord.TextChannel```
Represents a Discord guild text channel.
`x == y` Checks if two channels are equal.
`x != y` Checks if two channels are not equal.
`hash(x)` Returns the channel’s hash.
`str(x)` Returns the channel’s name.
@dense walrus
does discord.Member.add_roles work like a list of type Role
[roles object] or [role id]
!d discord.Member.add_roles
await add_roles(*roles, reason=None, atomic=True)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Gives the member a number of [`Role`](https://discordpy.readthedocs.io/en/stable/api.html#discord.Role "discord.Role")s.
You must have the [`manage_roles`](https://discordpy.readthedocs.io/en/stable/api.html#discord.Permissions.manage_roles "discord.Permissions.manage_roles") permission to use this, and the added [`Role`](https://discordpy.readthedocs.io/en/stable/api.html#discord.Role "discord.Role")s must appear lower in the list of roles than the highest role of the member.
channel = await self.bot.wait_for('message', check=check)
how can I ensure its a text channel mention / id?
!d discord.ext.commands.TextChannelConverter
class discord.ext.commands.TextChannelConverter```
Converts to a [`TextChannel`](https://discordpy.readthedocs.io/en/stable/api.html#discord.TextChannel "discord.TextChannel").
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)...
because i have [role object] and it says AttributeError: 'list' object has no attribute 'id'
@dense walrus
put a * before the list of roles.
ok
member.add_roles(*roles)
How can I use it exactly in my check function?
def check(msg):
try:
await commands.TextChannelConverter.convert(msg.content)
return True
except commands.BadArgument:
pass
oh yea sorry
i am not sure.
i guess you can
bot.loop.run_until_complete(commands.TextChannelConverter.convert(msg.content))
and that will make it sync
if the check function needs to be async just use asyncio.get_event_loop().create_task(async-func(args))
or this
you could alternatively, put it outside of your check function
message = await self.bot.wait_for('message', check=check)
try:
channel = await commands.TextChannelConverter.convert(message.content)
except commands.BadArgument:
await ctx.send("The channel argument is invalid, please try again")
return
but its up to you
you could, but you should do asyncio.get_event_loop(), you should get the bot's event loop instead using bot.loop
yeah but then it won't wait for the next message, it will just cancel the wait
exactly
but the user might be confused
actually that's fine ig
if you do it this way
exactly that, get_server is not an attribute of the discord.Bot object
what can i use then
i think you mean get_guild
server isn't even a term used now
and ids are always integers
it's guild
now it gives same error for create_invite
so just do bot.get_guild instead
remove quotes from the IDs
don't use () lol
what
server = bot.get_guild(883453532878028860)
link = bot.create_invite(server)
await print(link)
Oh okay, my bad
Thanks
huh
i think i tried it before, and was wondering why it didn't come 
@slate swan
let me try
yeah. and it's not bot.create_invite btw
i'm high lmao
wait
how i am gonna use it then
it's guild
not bot
as the class Guild has a create_invite method
get a textchannel from the guild
nah invites are created for channels not guilds themselves
so get the guild and then a channel
ah yeah
so i need to get channel before creating the url?
huh 
I get this error when trying to use await channel.send(embed=embed
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: TypeError: Object of type Message is not JSON serializable
your Guild object is called server
oh i forgot
i was just saying guild since thats what theyre called lmao
what about **fields
Ikr!
undefined name **fields
your embed is a message, it should be a discord.Embed
well, it's not
embed = discord.Embed(title=title,
description=f"1️⃣ {option1}\n2️⃣ {option2}",
color=0xff6f00)
**fields are optional, the double asterisk indicates that. In the docs you can see what arguments you can use. I screenshotted them for you this time
sevrer is also not necessary as an argument btw
weird
can you send a chunk of your code?
yeah sec
where you define the embed and where you send it
send the full traceback
what
this is a function
async def create_poll(self, channel, title, option1, option2):
embed = discord.Embed(title=title,
description=f"1️⃣ {option1}\n2️⃣ {option2}",
color=0xff6f00)
msg = await channel.send(embed=embed)
await msg.add_reaction('1️⃣')
await msg.add_reaction('2️⃣')
I use this function inside of a command
no point
yeah point
class discord.Invite```
Represents a Discord [`Guild`](https://discordpy.readthedocs.io/en/stable/api.html#discord.Guild "discord.Guild") or [`abc.GuildChannel`](https://discordpy.readthedocs.io/en/stable/api.html#discord.abc.GuildChannel "discord.abc.GuildChannel") invite.
Depending on the way this object was created, some of the attributes can have a value of `None`.
`x == y` Checks if two invites are equal.
`x != y` Checks if two invites are not equal.
`hash(x)` Returns the invite hash.
`str(x)` Returns the invite URL...
Are you by chance using a third party extension for discord.py that adds stuff like slash commands or buttons?
nah
slash commands 🤮
ahah yea
its a coroutine, you have to await it
I will try to create the embed in the command function, not from another function
Pretty sure its not the problem but ill try
why i am getting too many errors 😢
whats awaserver
nah didn't work
that's so weird
Can you send full traceback
u talking to me or him?
You
Traceback (most recent call last):
File "C:\Users\Yarin\AppData\Local\Programs\Python\Python37\lib\site-packages\discord\ext\commands\bot.py", line 935, in invoke
await ctx.command.invoke(ctx)
File "C:\Users\Yarin\AppData\Local\Programs\Python\Python37\lib\site-packages\discord\ext\commands\core.py", line 863, in invoke
await injected(*ctx.args, **ctx.kwargs)
File "C:\Users\Yarin\AppData\Local\Programs\Python\Python37\lib\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: TypeError: Object of type Message is not JSON serializable
no dont await the channel definition, await the create_invite method method
you also put awa infront of server somewhere
reeeee
It doesnt seem full tho
I printed the type(embed) and it's <class 'discord.embeds.Embed'>, so I meann
oh wait
save and restart? should be fine
it doesn't works
oh wait
@agile goblet tysm
Traceback (most recent call last):
File "C:\Users\Yarin\AppData\Local\Programs\Python\Python37\lib\site-packages\discord\ext\commands\core.py", line 85, in wrapped
ret = await coro(*args, **kwargs)
File "c:\Users\Yarin\Desktop\xxx\xxx\xxx-bot\cogs\commands\admin.py", line 57, in poll
await self.create_poll(channel, title, option1, option2)
File "c:\Users\Yarin\Desktop\xxx\xxx\xxx-bot\cogs\commands\admin.py", line 64, in create_poll
msg = await channel.send(embed=embed)
File "C:\Users\Yarin\AppData\Local\Programs\Python\Python37\lib\site-packages\discord\abc.py", line 938, in send
message_reference=reference)
File "C:\Users\Yarin\AppData\Local\Programs\Python\Python37\lib\site-packages\discord\http.py", line 156, in request
kwargs['data'] = utils.to_json(kwargs.pop('json'))
File "C:\Users\Yarin\AppData\Local\Programs\Python\Python37\lib\site-packages\discord\utils.py", line 316, in to_json
return json.dumps(obj, separators=(',', ':'), ensure_ascii=True)
File "C:\Users\Yarin\AppData\Local\Programs\Python\Python37\lib\json\__init__.py", line 238, in dumps
**kw).encode(obj)
File "C:\Users\Yarin\AppData\Local\Programs\Python\Python37\lib\json\encoder.py", line 199, in encode
chunks = self.iterencode(o, _one_shot=True)
File "C:\Users\Yarin\AppData\Local\Programs\Python\Python37\lib\json\encoder.py", line 257, in iterencode
return _iterencode(o, 0)
File "C:\Users\Yarin\AppData\Local\Programs\Python\Python37\lib\json\encoder.py", line 179, in default
raise TypeError(f'Object of type {o.__class__.__name__} '
TypeError: Object of type Message is not JSON serializable```
I changed path names if you don't mind @vagrant brook
no problemo
typehint channel to discord.Channel and typehint title to string
I can't see whats wrong lmao
checking
if its a command it will pass all arguments as strings unless said otherwise
you meant discord.TextChannel right?
I think it could be some lib that youre using messing up
show the full command or is that it
@commands.command()
@commands.guild_only()
async def poll(self, ctx):
def check(m):
return m.author == ctx.message.author and m.channel == ctx.message.channel
await ctx.send("Enter the channel you want the poll to be in")
msg = await self.bot.wait_for('message', check=check)
try:
converter = commands.TextChannelConverter()
channel = await converter.convert(ctx, msg.content)
await msg.add_reaction('✔️')
except commands.BadArgument:
await ctx.send("The channel argument is invalid, please try again")
return
await ctx.send("Enter the title of the poll")
title = await self.bot.wait_for('message', check=check)
await title.add_reaction('✔️')
await ctx.send("Enter the first option")
option1 = await self.bot.wait_for('message', check=check)
await option1.add_reaction('✔️')
await ctx.send("Enter the second option")
option2 = await self.bot.wait_for('message', check=check)
await option2.add_reaction('✔️')
await self.create_poll(channel, title, option1, option2)
await ctx.send(f"Poll created in {channel.mention}")
async def create_poll(self, channel: discord.TextChannel, title: str, option1, option2):
embed = discord.Embed(title=title,
description=f"1️⃣ {option1}\n2️⃣ {option2}",
color=0xff6f00)
msg = await channel.send(embed=embed)
await msg.add_reaction('1️⃣')
await msg.add_reaction('2️⃣')
Does anyone know how to make a channel within a category
When I do it, it just makes the channel and category separate
!d discord.Guild.create_text_channel pass in category=CategoryChannel, or discord.CategoryChannel.create_text_channel
await create_text_channel(name, *, overwrites=None, category=None, reason=None, **options)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Creates a [`TextChannel`](https://discordpy.readthedocs.io/en/stable/api.html#discord.TextChannel "discord.TextChannel") for the guild.
Note that you need the [`manage_channels`](https://discordpy.readthedocs.io/en/stable/api.html#discord.Permissions.manage_channels "discord.Permissions.manage_channels") permission to create the channel.
The `overwrites` parameter can be used to create a ‘secret’ channel upon creation. This parameter expects a [`dict`](https://docs.python.org/3/library/stdtypes.html#dict "(in Python v3.9)") of overwrites with the target (either a [`Member`](https://discordpy.readthedocs.io/en/stable/api.html#discord.Member "discord.Member") or a [`Role`](https://discordpy.readthedocs.io/en/stable/api.html#discord.Role "discord.Role")) as the key and a [`PermissionOverwrite`](https://discordpy.readthedocs.io/en/stable/api.html#discord.PermissionOverwrite "discord.PermissionOverwrite") as the value.
Note
Creating a channel of a specified position will not update the position of other channels to follow suit. A follow-up call to [`edit()`](https://discordpy.readthedocs.io/en/stable/api.html#discord.TextChannel.edit "discord.TextChannel.edit") will be required to update the position of the channel in the channel list...
print the channel variable
k
Oh i see why now
show me!
Thanks!
anyone here wanna make a bot with me? im rewriting my whole bot since its just a mess that needs rewriting
hm idk why it didnt throw an error when typehinting string
because the create_poll function aint a command ig
typehinting is regular python tho
it is lmao
Smh using discord on iphone 5 is a pain
Lets say you have a method like this:
async def command(ctx, channel, integer)
With discord its very important to typehint since just doing that will make every argument except for ctx a string.
doing this:
async def command(ctx, channel: discord.TextChannel, integer: int)
Will make channel and integer, a textchannel and integer respectively
But create_poll isn't a command
Yes
discord.py only converts typehints for commands
In regular python they do nothing other then add readability
typehints to commands
for commands
@commands.command(aliases=["whois"])
async def userinfo(self, ctx, member: discord.Member):
roles = [role for role in member.roles][1:]
embed = discord.Embed(
description = f'**User Infomation - **{member.mention}',
colour=member.color,
timestamp=ctx.message.created_at
)
embed.set_thumbnail(url = member.avatar_url)
embed.set_footer(text=f'Requested by {ctx.author}', icon_url=ctx.author.avatar_url)
embed.add_field(name='ID:', value=f'`{member.id}`')
embed.add_field(name='Nickname:', value=member.display_name)
embed.add_field(name='Created at:', value=member.created_at.strftime('%a, %#d %B %Y, %I:%M %p UTC'))
embed.add_field(name='Joined at:', value=member.joined_at.strftime('%a, %#d %B %Y, %I:%M %p UTC'))
embed.add_field(name=f'Roles ({len(roles)})', value=" ".join([role.mention for role in roles]))
embed.add_field(name='Top Role:', value=member.top_role.mention)
embed.add_field(name = 'Bot:', value = member.bot)
how would i make the member = ctx.author when you only do #whois
You tried Andy, give up, you are bad helper
i tried so many forms and it does not work
Nova you barely know how to typehint 
:(
wtf does TypeVar mean 
async def userinfo(self, ctx, member: discord.Member=None):
if member == None:
member = ctx.author
member = member or ctx.author
^
I suck at coding. My bad.
Could swear they did but I guess I was wrong lmao
OH I FORGOT TO PUT discord.member=None
let me try it
Capital M.
You can copy that behaviour with my runtime type transformer tho! :)))
No problem. 
Wouldn't trust your type transformer knowing you can barely typehint

Why you booli me
Cause your PR for 0x42 had like 5 or 6 something type errors
I had to fix every one of them
cuz I don't live life in hardcore mode
Novia, why are you scared of green color?
await ctx.guild.create_text_channel("Logs", overwrites = overwrites, category = "Management")
Do u know why this isn't working?
Who who, I like green
Can we just use ids in methods like Guild.ban/unban or is it required to make a discord.Object with the ID first?
how will i get nessage athour tag

Yeah you need a discord.CategoryChannel instance, not a string
Ohh that, that's an opcode
!d discord.Member.discriminator
discriminator```
Equivalent to [`User.discriminator`](https://discordpy.readthedocs.io/en/stable/api.html#discord.User.discriminator "discord.User.discriminator")
You need some sort of object that has an ID
Means just doing ban(1234) won't work..
Its subroutine borke my fetch and execution of opcodes and idk how to fix :(
Yea, since the http method gets passed user.id rather then user
So you need an object with an ID at the very least
Oh okay, Thanks
No. However, await ban(ctx.guild.get_member(1234)) will work.
why make emulator just make it real 
I'm not like steve or someone, you know
Yo?
can you make a chip-8 game on discord though
Yeah that basically returns the Member object, basically a Snowflake..
Idk why I remember just putting IDs used to work... Deja Vu 
Probably, who knows
can you make discord on discord though
Blanket can do it
no
Blanket do it
Your smart
no
also why does this command do not work
@commands.command(aliases=['guildinfo', 'guild'])
async def serverinfo(self, ctx):
em = discord.Embed(
title=f'{ctx.guild.name}',
colour = ctx.author.color
)
em.set_thumbnail(url=f'{ctx.guild.icon_url}')
em.add_field(name='Owner', value=f'{ctx.guild.owner}')
em.set_field(name='Region', value=f'`{ctx.guild.region}`')
em.add_field(name='Member Count', value=f'{ctx.guild.member_count}')
em.set_footer(icon_url=f'{ctx.guild.icon_url}', text=f'Guild ID: {ctx.guild.id}')
await ctx.send(embed=em)
@bot.command()
async def ifstate(ctx):
optionembed = discord.Embed(title='Please choose an option', description="hug, high 5", color=c.purple())
await ctx.send(embed=optionembed)
available_options = ["hug"]
available_options2 = ["high 5"]
def check(msg):
return msg.author == ctx.author and msg.content in available_options
options = await bot.wait_for("message", check=check)
hugembed = discord.Embed(title=f"You just got yourself a", description=f"{options.content}" + " little dude",
color=c.purple())
hugembed.add_image(url='https://media.giphy.com/media/DjczAlIcyK1Co/giphy.gif')
await ctx.send(embed=hugembed)
def check(msg):
return msg.author == ctx.author and msg.content in available_options2
options = await bot.wait_for("message", check=check)
high5embed = discord.Embed(title=f"Nice what a strong", description=f"{options.content}" + " dude",
color=c.purple())
high5embed.add_image(url='https://giphy.com/clips/true-and-the-rainbow-kingdom-true-and-the-rainbow-kingdom-yetis-terrific-tales-TdFjwc7qDTUFEDX7i1')
await ctx.send(embed=high5embed)
im getting commands.CommandInvokeError
Make a friends system, make a dm command, make a servermsg command that sends a dm to all the users that joined a "server" on your own bot's database.
But keep in mind one thing - once you finish that bot, it's going to get banned immediately. 
It won't work cuz it says add_image has no attribute to embed
!d discord.Embed.set_image
set_image(*, url)```
Sets the image for the embed content.
This function returns the class instance to allow for fluent-style chaining.
Changed in version 1.4: Passing [`Empty`](https://discordpy.readthedocs.io/en/stable/api.html#discord.Embed.Empty "discord.Embed.Empty") removes the image.
why is it going to get banned immediatly
I've read that yesterday
wait
i dont see how it breaks any tos
oh discord
nm im stupid
Read the part of the servermsg command.
Just make discord using discord, in shell
Cli based discord 🧠
Naw just make bot read messages and send content to API which displays everything on a website
Or, make Discord using WhatsApp.
Isn't that similar to "WidgetBot"?
raise CommandInvokeError(exc) from exc
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: TypeError: set_image() missing 1 required positional argument: 'self'
there is already a cli discord
wtf really
O
yay discord tui
raise CommandInvokeError(exc) from exc
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: TypeError: set_image() missing 1 required positional argument: 'self'
yay is a AUR helper
i use arch btw
arch is my daily driver
🤢

Show code. I forgot what is that error.
you need an instance of Embed
not the class itself
hm?
Oh right that's the error.
embed.set_image(url=url)
embed being an discord.Embed obj
a*
English is my -1th language btw
1th? That made me so mad. 
Astonishing
nova is bad at both anime picks and english
the Optional actually does nothing, in discord.py if the argument is not given it gives it a value of None
so define embed = discord.Embed
name = "Management"
name1 = "Logs"
await ctx.guild.create_category_channel(name, overwrites=None, reason=None, position=None)
await ctx.guild.create_text_channel(name1, overwrites=None, reason=None, position=None)``` Does anyone know how to join these 2
The category and channel are created separately
Yes, call it too
typehinting doesn't matter, it doesn't change how a function behaves
I wanna put the channel under the category
its only there for linters and doc purposes
Assign create_category_channel then use create_text_channel method on it
no
category = create category channel here
await category.create_text_channel(. . .)
dont listen to nova
Static typing is future
oh my f'ing god
nova just writes bad code
and it works
anyways listen to whatever you like
Why you say static typing is future when you won't even turn on pyright
Faulty ellipsis

if you like linters and colors then typehint
because im typing dynamically 😎
it can also tell users which argument type to pass in
@bot.command()
async def ifstate(ctx):
optionembed = discord.Embed(title='Please choose an option', description="hug, high 5", color=c.purple())
await ctx.send(embed=optionembed)
available_options = ["hug"]
available_options2 = ["high 5"]
embed = discord.embed
def check(msg):
return msg.author == ctx.author and msg.content in available_options
options = await bot.wait_for("message", check=check)
hugembed = discord.Embed(title=f"You just got yourself a", description=f"{options.content}" + " little dude",
color=c.purple())
embed = discord.Embed
embed.set_image(url='https://media.giphy.com/media/DjczAlIcyK1Co/giphy.gif')
await ctx.send(embed=hugembed)
def check(msg):
return msg.author == ctx.author and msg.content in available_options2
options = await bot.wait_for("message", check=check)
high5embed = discord.Embed(title=f"Nice what a strong", description=f"{options.content}" + " dude",
color=c.purple())
embed = discord.Embed
embed.set_image(url="https://giphy.com/clips/true-and-the-rainbow-kingdom-true-and-the-rainbow-kingdom-yetis-terrific-tales-TdFjwc7qDTUFEDX7i1")
Helpppppp
am telling you, stop torturing yourself
i just create aliases for stuff like Callable[..., Coroutine[Any, Any, Any]]
when i do "import DiscordEconomy" it says no module named discord
😩
Errorrr

