#discord-bots
1 messages ยท Page 431 of 1
or {n}
good to know
thanks 
import urllib
urllib.urlencode("text with spaces")
nvm it works
either ways do you know how to take user input
like user prefix/hello
bot
whats your name
user
lucid
```bot again
welcome lucid ```
I have something for that :P https://dpy.tips/cogs
Cogs respresent a drastic change to how you write bots in discord.py. As such it's important to know how to use them, and the differences between using cogs and not using them that may catch you out.
I'm trying to create a custom help command and im getting a TypeError: help_command must be a subclass of HelpCommand error
The code is
class CustomHelpCommand(commands.HelpCommand):
def __init__(self):
super().__init__()
async def send_bot_help(self, mapping):
return await super().send_bot_help(mapping)
async def send_cog_help(self, cog):
return await super().send_cog_help(cog)
async def send_group_help(self, group):
return await super().send_group_help(group)
async def send_command_help(self, command):
return await super().send_command_help(command)
client = commands.Bot(command_prefix = get_prefix, help_command = CustomHelpCommand)
The error im getting is in line 18
it needs to be an instance of the help command, not the type, so help_command=CustomHelpCommand()
Thank you
Its always stupid little mistakes like that
np, that one has caught me out a bunch of times too
i can never remember if it takes an instance or the type
I need help, what's the code making a bot delete a message when the user for example says the f word... Obviously when the bot had administrator perms
noice
i need halp
any idea how to make dis work?
so i can do collection(x, y).fetch.all()
You didn't initiate the class
yea
its like a lib
sry am a beginner wit classes
like self?
a class inside a class
now self.db doesnot exist
me 2, lol, am tryin to figure this out
never tried da builtin classmethod
func
and decorator
you may be better off asking in a help channel ( #โ๏ฝhow-to-get-help ) since this is a channel for discord bot development
i just need to do:
- can call
collection(x, y).fetch.all() - can call
collection(x, y).fetch.one_by_id(id_var)
no yumyum
is this mongodb
Quick question on cogs
Idk how to describe it
Like you have a class where everything functions
Do all the commands have to be in that class?
Cogs are for better organistation. commands in that particular cog should be in the indented within the class yes
def check(reaction, user):
return user == c.author and str(reaction.emoji) in reaction_list
while True:
try:
reaction, user = await bot.wait_for("reaction_add", timeout=60, check=check)
if str(reaction.emoji) == reaction_list[0]:
await help_page.edit(embed=help_embed)
await help_page.remove_reaction(reaction, user)
print('AAA')
elif str(reaction.emoji) == reaction_list[1]:
print('BBB')
await help_page.edit(embed=help2_embed)
await help_page.remove_reaction(reaction, user)
elif str(reaction.emoji) == reaction_list[2]:
print('CCC')
await help_page.edit(embed=help3_embed)
await help_page.remove_reaction(reaction, user)
else:
await help_page.remove_reaction(reaction, user)
except asyncio.TimeoutError:
await help_page.delete()
break
My 2nd and 3rd reaction are not returning True
hello?
Hey guys what happened to discord.py its archived now
pins
Not exactly, Danny just stopped working on this project. I wish someone equal to Danny to take on this project with the appetite he had when he started it. We love you Danny!
This is good for competition, everyone is making libs now so we will have some variety
idk ยฏ_(ใ)_/ยฏ
I can help
sure, but there's more to open source projects like dpy than just the fact that there's competition
Or you can take some examples from channel history
can u help me via dm?
Im going to sleep sry.
u can dm me later
If I do not forget it for sure
hey guys
my friend sayed that discord.py shutdown is fake any proofs?
like iknow it is real but tell it to him
the official repo is archived.
My point that was until now discord.py has been the discord library for python, now more people are going to make their own, so we will have more variety and perhaps a new take on how to organise it and make an awesome lib
he is still saying it is rumor or som
Well you can only convince people of things if they're willing to be convinced
say goodbye to discord.py
Honestly I hope somebody makes a fork of discord.py that's extremely similar so that people don't have to switch existing code that much
Need a help on discord.py button module
from await guild.bans() can we know when the user was banned (time)
Anyone have an example version of it
No, unfortunately, discord doesn't provide that info
you will have to log it on your own
I think bans are logged in audit log
This is the place for me now ๐
Oh yeah completely went over my head for some reason
Amped to be re-writing dpy ๐ ๐ฅฒ
you can fetch the audit entry of the ban and get its creation time
help?
@stiff nexus
no i want it from await guild.bans()
the /bans endpoint doesn't provide ban timestamps
ok
then how to get from logs?
!d discord.Guild.audit_logs
async for ... in audit_logs(*, limit=100, before=None, after=None, oldest_first=None, user=None, action=None)```
Returns an [`AsyncIterator`](https://discordpy.readthedocs.io/en/stable/api.html#discord.AsyncIterator "discord.AsyncIterator") that enables receiving the guildโs audit logs.
You must have the [`view_audit_log`](https://discordpy.readthedocs.io/en/stable/api.html#discord.Permissions.view_audit_log "discord.Permissions.view_audit_log") permission to use this.
Examples
Getting the first 100 entries:
```py
async for entry in guild.audit_logs(limit=100):
print('{0.user} did {0.action} to {0.target}'.format(entry))
```...
you can specify the action and the user. In this case, the action will be discord.AuditLogAction.ban
hello, I have a problem, the function of the button works well and the menu also, but I want to know is how I do so that the button can be executed again, so that several people can press it and it works, I am new, I hope you help me 
An unofficial third party library of discord.py for discord components.
Is discord.py going to close
because some of my freinds told it is going to close
so please ping and reply me
has closed*
some people are working on forks though. Don't know how reliable they will be. But if you really want to stick with d.py, those are your best bet
can anyone tell me whats wrong in this code...it shows no errors but doesnt work either...when commands r typedhttps://paste.pythondiscord.com/duqiluyubu.py
but i can use it still
should i use discord-py-interactions or dislash for slash commands and others
i dunno you can lmk
it won't be deleted, development has just stopped
fine it must not be closed
not by danny
yes, unless discord makes breaking changes to the API
:<
danny said he wont work on it again
unless a miracle happens
yeah
enhanced-dpy might be your best shot so far
You can still use it yes. However any updates have ceased. If your bot is in more than 75 guilds after April 2022, your bot will not longer work with discord.py
however, if you are under that threshold, it should work fine (assuming discord doesn't decide to mess that up as well)
is it gonna keep update?
enhanced-discord.py is a fork of the original code being lead by dutchy i believe, they're striving to keep it up-to-date
thanks!
https://enhanced-dpy.readthedocs.io/en/latest
This is the best one till date
Oh dutchy, he helped me learn cogs lol
They seem to be working getting 2.0 out and later work on slash commands
Yes
yeah well, enhanced-dpy hasn't had any action for a few months
we'll see what unfolds
if we switch to discord.py slash
Hey guys I have hosted my discord.py in replit.com and I am facing some issues with it
what
whats the issue
Suggest me some alternative
bro
use a vps lol
tell the issues
@nimble kayak the bot gets turned off
ping the server
After 10 mins
with uptime robot
run a webserver to keep it online
It was working nice until yesterday
is what i did when i used replit
use keep_alive
I used uptime bot to make sure it was alive all time
didnt work very well lol
it usually closes but runs after some time
Ya don't know what to do now
Guys, i want to make a function for my bot that fetches the meaning of the word, anyone can suggest any source or something?
urban
I doubt that is the case here
?
What
its an API?
!pypi urbandict
CLI client and a library for urbandictionary.com
how to make slash commands and buttons with enhanced-dpy?
are you sure urban dictionary is the best place to find definitions
Or use the API
it would be better to use a proper website for definitions
What?
definitions on urban dictionary arent usually what you think they are going to be
oh, so what do i use then?
you can use any programming language to interact with an api
ok thanx
Also this ^^
you may be confusing yourself with an API wrapper which are designed for specific languages
how can i make slash commands and buttons with enhanced-dpy?
can someone help me with some code
show the code
i took the token out cus yk
but everytime i run it it runs fine
if i say .ping itll respond with pong
until i say .say and want it to repeat me
just do message.content.replace(".say", "")
that should work
you dont need all the split and list adding bruh
replace with message.content.startswith(".say"): ?
no?
im new
under that
ah ok thanks
np
i dont think python liked that
show error
how do i make it like this so its easier
```py
code
```
I'm getting this while trying to attach my interactions endpoint URL. I get this error, but Discord doesn't send any requests to me. What's wrong?
ur token is invalid
R u tryna use buttons/slash commands?
I'm just trying to figure out how the interactions work. This is the application config screen
Ah, well u will need application.commands scope for slash commands
Indeed. Use enhanced-dpy
Ignoring exception in on_message
Traceback (most recent call last):
File "C:\Users\josue\PycharmProjects\pythonProject1\venv\lib\site-packages\discord\client.py", line 343, in _run_event
await coro(*args, **kwargs)
File "C:\Users\josue\PycharmProjects\pythonProject1\main.py", line 21, in on_message
for word in mes[1:]:
NameError: name 'mes' is not defined
an error came saying "discord.ext import commands" unknown locaion
Scaleios was complaining about requiring HTTPS. Does your endpoint use HTTPS?
Yes. I just... don't get any requests from Discord
Ignoring exception in on_message
Traceback (most recent call last):
File "C:\Users\josue\PycharmProjects\pythonProject1\venv\lib\site-packages\discord\client.py", line 343, in _run_event
await coro(*args, **kwargs)
File "C:\Users\josue\PycharmProjects\pythonProject1\main.py", line 21, in on_message
for word in message[1:]:
TypeError: 'Message' object is not subscriptable
Maybe Discord blacklists domains on the .su TLD?
message.content
wait
i think its cus i had a + instead of a =
nvm
Ignoring exception in on_message
Traceback (most recent call last):
File "C:\Users\josue\PycharmProjects\pythonProject1\venv\lib\site-packages\discord\client.py", line 343, in _run_event
await coro(*args, **kwargs)
File "C:\Users\josue\PycharmProjects\pythonProject1\main.py", line 21, in on_message
for word in message[1:]:
TypeError: 'Message' object is not subscriptable
where
does it show you that im typing?
ive had a few say that they cant
oh wrong channel nvm
Ignoring exception in on_message
Traceback (most recent call last):
File "C:\Users\josue\PycharmProjects\pythonProject1\venv\lib\site-packages\discord\client.py", line 343, in _run_event
await coro(*args, **kwargs)
File "C:\Users\josue\PycharmProjects\pythonProject1\main.py", line 24, in on_message
await message.channel.send(output)
File "C:\Users\josue\PycharmProjects\pythonProject1\venv\lib\site-packages\discord\abc.py", line 1065, in send
data = await state.http.send_message(channel.id, content, tts=tts, embed=embed,
File "C:\Users\josue\PycharmProjects\pythonProject1\venv\lib\site-packages\discord\http.py", line 254, in request
raise HTTPException(r, data)
discord.errors.HTTPException: 400 Bad Request (error code: 50006): Cannot send an empty message

i had to put in before message.content because there was an error saying 'in' expected
Hmm

Guys, i want to maintain the most active users on my server, how can i do that?
@bot.command(pass_context=True)
async def test(ctx, user: discord.Member):
# Remove unnecessary characters
hypesquad_class = str(user.public_flags.all()).replace('[<UserFlags.', '').replace('>]', '').replace('_',
' ').replace(
':', '').title()
# Remove digits from string
hypesquad_class = ''.join([i for i in hypesquad_class if not i.isdigit()])
# Output
test = discord.Embed(title=f"{user.mention}'s Badges", description="test", color=0xff0000)
if "Hypesquad Bravery" in hypesquad_class.lower():
embed.add_field(name="1", value=" ")
elif "Hypesquad Balance" in hypesquad_class.lower():
embed.add_field(name="2", value=" ")
elif "Hypesquad Brilliance" in hypesquad_class.lower():
embed.add_field(name="3", value=" ")
await ctx.channel.send(embed=test)
Traceback (most recent call last):
File "main.py", line 12, in <module>
from discord.ext import tasks
ImportError: cannot import name 'tasks' from 'discord.ext' (unknown location)
```help????
is there a discord server for enhanced-dpy?
import discord
from discord.ext import commands
import aiohttp
from io import *
from discord.ext.commands.converter import Greedy
from discord_slash import cog_ext, SlashContext
class createemoji(commands.Cog):
def __init__(self, bot):
self.bot = bot
@commands.command()
@commands.has_permissions(manage_emojis=True)
async def createemoji(self, ctx, url: Greedy[str], name: Greedy[str]):
self.bot.ses = aiohttp.ClientSession()
async with self.bot.ses.get(url) as r:
try:
if r.status in range(200, 299):
img = BytesIO(await r.read())
bytes = img.getvalue()
emoji = await ctx.guild.create_custom_emoji(image=bytes, name=name)
await ctx.send(f'success create emoji: <:{emoji.name}:{emoji.id}> by {ctx.author}')
await ctx.message.delete()
else:
await ctx.message.delete()
await ctx.send(f'error when making request | response : {r.status}')
except Exception as e:
print(e)
await ctx.send(e)
def setup(bot):
bot.add_cog(createemoji(bot))
discord.ext.commands.errors.ExtensionFailed: Extension 'cogs.avatar' raised an error: ExtensionFailed: Extension 'cogs.createemoji' raised an error: TypeError: Greedy[str] is invalid.```
how to use greedy in discord py?
Is there any official documentation for slash commands??
Greedy can't have str as parameter https://discordpy.readthedocs.io/en/master/ext/commands/commands.html#greedy
Integrate your service with Discord โ whether it's a bot or a game or whatever your wildest imagination can come up with.
Yes
can u gimme the link to it plz?
DMs?
sure
can you give it to me aswell?
when will the message response time be 0.44328s???
with open("users.json", "r") as j:
users = json.load(j)
await update_data(users, member)
with open("users.json", 'w') as j:
json.dump(users, j)
Why is the update_data giving errors?
Oh, sorry. I was AFK. Do u still need it?
how to do like when u edited your cmd the bot also edited the response right?
https://paste.pythondiscord.com/axitapuqap.sql
Why its happening?
yes, and thank you
It means you are simply importing every classes, functions and attributes from config module
why server = commands.Bot.get_guild('123123123123123123') say TypeError: get_guild() missing 1 required positional argument: 'id'
its bot.get_guild(id)
'discord.ext.commands.bot' has no attribute 'get_guild'
show new code
async def test(self, ctx):
server = commands.bot.get_guild('123123123123123123')
channel_id = server.get_channel(123123123123123123)
print(server)
print(channel_id)```
wow
remove commands in commands.bot.get_guild('123123123123123123') and remove the ' '
bot is not defined
u defined bot?
no
show all code. but not the token
Looks like everything is you have to interact with your bot just by json
That's not good things, and it's so confusing
this is the start
import asyncio
import discord
from discord.embeds import Embed
from discord.ext import commands
from var import *
class user(commands.Cog):
def __init__(self, bot):
self.bot = bot
@commands.command(pass_context=True)
async def test(self, ctx):
server = self.bot.get_guild(123123123123123123)
channel_id = server.get_channel(866257647657549845)
print(server)
print(channel_id)```
it should be an int and not a string
ye
now its good. how
You don't need, pass_context=True
i tried add self. but do not work
Because the context will always pass
learn d.py basics
so how to solve?
from discord import Embed,
You can do discord.Embed because the Embed class is in the __init__.py
Can someone help me
but error still there
What error
Guys I'm creating a bot discord only that for the connection between the token and the API it gives me this error:
Traceback (most recent call last):
File "/Users/francescomascolo/Desktop/BOT py/BOT.py", line 20, in <module>
client.run('my token')
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/discord/client.py", line 723, in run
return future.result()
why server = commands.Bot.get_guild('123123123123123123') say TypeError: get_guild() missing 1 required positional argument: 'id'
full error? With your token removed
it is too long to send, it gives me a connection error
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.
Don't put string inside get_guild() function, just put as integer
I removed the toke on purpose so as not to show it
it's still not the full error
It gives me an error with the token and API
same error
async def _8ball(ctx, *,question):
responses = [ 'It is Certain.',
'> It is decidedly so.',
'> Without a doubt.',
'> Yes definitely.',
'> You may rely on it.',
'> As I see it, yes.',
'> Most likely.',
'> Outlook good.',
'> Yes.',
'> Signs point to yes.',
'> Reply hazy, try again.',
'> Ask again later.',
'> Better not tell you now.',
'> Cannot predict now.',
'> Concentrate and ask again.',
"> Don't count on it.",
'> My reply is no.',
'> My sources say no.',
'> Outlook not so good.',
'> Very doubtful.']
await ctx.send(random.choice(responses)) ```
i'm typing !8ball are you good, but it aint showing anything
It's like you need to first register your commands to the API, and whenever the command is invoked, you'll receive an interaction via gateway or webhooks and you just need to respond back to the received interaction.
the bot instance not the class
instance vs class
!paste
Pasting large amounts of code
If your code is too long to fit in a codeblock in discord, you can paste your code here:
https://paste.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.
help
I need an alternative to discord.py, since dpy is dead now, I want to use its alternatives
How to do i add a Database to my bot using Replit?
For dpy, you don't need any web hooks to interact with your bots
well there is enchanced-dpy
not understand, can show me how to wrtie?
self.bot, not commends.Bot
@client.event
async def on_ready():
print("Decide your Destiny")
@client.command(aliases = ['8ball','8-ball',"decideDestiny", "8 ball"])
async def _8ball(ctx, *,question):
responses = [ 'It is Certain.',
'> It is decidedly so.',
'> Without a doubt.',
'> Yes definitely.',
'> You may rely on it.',
'> As I see it, yes.',
'> Most likely.',
'> Outlook good.',
'> Yes.',
'> Signs point to yes.',
'> Reply hazy, try again.',
'> Ask again later.',
'> Better not tell you now.',
'> Cannot predict now.',
'> Concentrate and ask again.',
"> Don't count on it.",
'> My reply is no.',
'> My sources say no.',
'> Outlook not so good.',
'> Very doubtful.']
await ctx.send(random.choice(responses))
i dont get it though, websockets is ideal for event based communication, using websockets is better than sending a request from discords server to your server, and ws is more efficient
here what i am doinng wrong?
it say AttributeError: 'NoneType' object has no attribute 'get_channel'
Put as integer
Not string
pls help
server = self.bot.get_guild(123123123123123123) isn't good?
It's correct now
the bot can't connect with the API
this produce error NoneType
Then it's gone weird
Try using util function then
.
It may be easy for you
Why do you need get_guild() function??
Just use ctx.guild
i need to get a channel where i will send msg, and i need guild of that channel too
Use ctx.guild.get_channel()
Exactly, but discord also gives option to operate it through webhooks. Dpy uses the gateway one btw.
Iirc it was something like you don't need to have a bot to have slash commands. You can just register your commands to discord and receive interactions. If responding back does not require any physical existence of any bot application in the guild, then also they can be responded.
But that's the case like 1 out of 1000's will use. 
But looks like they want us to move to HTTP
also the message intents

You don't need get_guild() function because interaction will always be specific to that instance at which the bot will respond. Just use self.bot.get_channel() function
I used that in this way
i mean, why use http for event based communication when ws is meant to be event based
Yeah so that you don't require a bot application to be in the server
They also provide a different scope for app commands
ws is faster and more efficient iirc
i quitted few weeks ago
ok i will, thanks
Since everyone is trying to implement it, I also made a small implementation (though I don't think it'll work)
But yeah it's fun
but the knowledge will remain 
Can anyone help me.
Also slash commands are too complicated
They have command, options, sub-command, sub-command options, option types, like what 
ask your question
๐
I quitted yesterday 
Yes, many things they have changed there
im learning full stack web dev now
from discord.ext import commands
import random
import os
from asd import keep_alive
client = commands.Bot(command_prefix = "!")
@client.event
async def on_ready():
print("Decide your Destiny")
@client.command(aliases = ['8ball','8-ball',"decideDestiny", "8 ball"])
async def _8ball(ctx,*,question):
responses = [ '> It is Certain.',
'> It is decidedly so.',
'> Without a doubt.',
'> Yes definitely.',
'> You may rely on it.',
'> As I see it, yes.',
'> Most likely.',
'> Outlook good.',
'> Yes.',
'> Signs point to yes.',
'> Reply hazy, try again.',
'> Ask again later.',
'> Better not tell you now.',
'> Cannot predict now.',
'> Concentrate and ask again.',
"> Don't count on it.",
'> My reply is no.',
'> My sources say no.',
'> Outlook not so good.',
'> Very doubtful.']
await ctx.reply(random.choice(responses))
@client.command(aliases = ['help8ball','h',"8ballhelp"])
async def embed(ctx):
embed=discord.Embed(title="8Ball:8ball:", url= "", description="$ is the default prefix. $8 ball is the only runnable command for this bot now", color=discord.Color.red())
await ctx.send(embed=embed)
@client.event
async def on_message(message):
if message.content.startswith("!roll"):
msg = message.content
value = msg.split('!roll ', 1)[1]
roll_value = int(value.split("d")[0])
face_value = int(value.split("d")[1])
slimit = 0
roll_result = []
while slimit < face_value:
roll = random.randint(1, roll_value)
slimit += 1
roll_result.append(roll)
embed = discord.Embed(title="Roll Results", description=f":game_die:{roll_result}:game_die:",color = discord.Color.red())
await message.reply(embed=embed)
keep_alive()
my_secret = os.environ['secret']
client.run(my_secret) ```
hmm why is the 8ball one not working? ๐ฆ
I'm preparing for my exams lol, it's my final year of school
wait nvm
oh, good luck
Any errors?
Thanks 
Lucky Akshu
Not showing errors just when I do
!8ball Are you okay
Or what ever it doesn't reply
I still got another year in this hell hole
Why you are using client commands? Use bot commands

client = commands.Bot(command_prefix = "!")
bcoz of this
did it print "Decide your Destiny" in the terminal?
yeah
What is the function I should make http calls on startup to register app commands? In discord.Client class
Any idea 
Use @client.command(), not client.event for commands, and you don't need startswith() function
wow
Lol
register_commands ig, im the last person you will want to get design advice
๐ ๐ ๐
the projects I make are bad design wise, but code wise my projects are pretty good
I mean an existing function. Like I created a func to register command, now where to execute it.. At run, start, connect or what?
see dislash.py source code
run_command
That handles websocket and I don't feel like I should interfere with those for http requests... Maybe I'll just delay ready and add before that
How do this?
Bot reply with the message
!d discord.Message.reply
await reply(content=None, **kwargs)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
A shortcut method to [`abc.Messageable.send()`](https://discordpy.readthedocs.io/en/stable/api.html#discord.abc.Messageable.send "discord.abc.Messageable.send") to reply to the [`Message`](https://discordpy.readthedocs.io/en/stable/api.html#discord.Message "discord.Message").
New in version 1.6.
No no
did you make a server to receive the data?
Use ctx commands, don't use message.content.startswith()
@bot.command()
async def shop(ctx, *, item):
await ctx.send(ctx.author.mention, item)
Ty
hi, how can i make something catch an error for the error message
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: AttributeError: 'NoneType' object has no attribute 'channel'
so far ii've tried
@client.event
async def on_command_error(ctx,error):
if isinstance(error, commands.AttributeError, NoneType):
await ctx.send("kekw you must be in a vc for this to work")
but it doesn't work

No, I'm just using dpy's existing event. Luckily Danny completed most of the interactions related work and it has all events like on_interaction and Interaction and InteractionResponse and all to work with
๐
When I type bot.latency, It gives ping in Seconds, how can I translate to MS?
Multiply that by 1000
Ty
umm... did i do something?
how are you creating the instance?
remove intents=intesnts in super().__init__
intents is being passed in kwargs
yeah i meant it kwargs.get("intents")
still
you are passing it twice, you can remove intents=intents or kwargs.pop
Guys I have a problem, my discord bot won't connect to the token with the API giving me this error:
ClientConnectorCertificateError: Unable to connect to host discord.com:443 ssl: True [SSLCertVerificationError: (1, '[SSL: CERTIFICATE_VERIFY_FAILED] Certificate verification failed: Failed to get local issuer certificate (_ssl.c: 1129)') ]
sorry i didnt get you. But where should i usethat
Follow discord official docs
can you share the link?
who
Why are you loading other cogs inside another cog?
ah i see
its not a cog
class BotBase(commands.Bot):
they are subclassing commands.Bot
guys please help
can you share the link pls?
Okay I see
Means?
Bot will be offline in other time?
yeah like that
Then use bot activity or status function
Not sure about that
idkยฏ_(ใ)_/ยฏ
Guys I have a problem, my discord bot won't connect to the token with the API giving me this error:
ClientConnectorCertificateError: Unable to connect to host discord.com:443 ssl: True [SSLCertVerificationError: (1, '[SSL: CERTIFICATE_VERIFY_FAILED] Certificate verification failed: Failed to get local issuer certificate (_ssl.c: 1129)') ]
Check your API key
how
Go to discord developer portal
Then go to applications
ok
Then choose your bot, then go to oauth token section
okok
Wdym
ok now?
wat iss that?
Check if you are entering the same token in your code or not
sure, man is thes
the same*
Send your code
the problem is the certificate
but i have downloaded the certificate
and not work

i know
they are also required for ssl connections
I've been exploding for 1 hour I've been researching research but nothing
Bots are meant to be secure always, those are handled by API client as it is
#discord-bots message try this
hi can somebody check why running this
@client.command()
async def youtube(ctx):
link = await togetherControl.create_link(ctx.author.voice.channel.id, 'youtube', max_age=60)
await ctx.send(f"click the link not the play button\n{link}")
if ctx.author.voice == None:
return await ctx.send('Join a VC')
Traceback (most recent call last):
File "/opt/homebrew/lib/python3.9/site-packages/discord/ext/commands/bot.py", line 939, in invoke
await ctx.command.invoke(ctx)
File "/opt/homebrew/lib/python3.9/site-packages/discord/ext/commands/core.py", line 863, in invoke
await injected(*ctx.args, **ctx.kwargs)
File "/opt/homebrew/lib/python3.9/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 'channel'
if the author isn't in a voice channel?
is my homebrew lib just broken lol
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: AttributeError: 'NoneType' object has no attribute 'channel' this hmm 
i love you tysm now i try
ctx.guild.voice_channel.id
Follow official docs
hmm ok tenks
embed.set_author(name = ctx.author.name, icon_url= ctx.author.avatar_url)
``` doesn't work, why is it?
error?
it doesn't send anything
can you send the whole embed/command code
raise CommandInvokeError(exc) from exc
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: AttributeError: 'Member' object has no attribute 'avatar_url'
``` sorry this is the error
Are you on v2 ?
Why discord don't register my slash commands?
I assume you are using the v2, so change member.avatar_url to member.avatar.url
Is version 2 released??
It was out for general testing
pip install -U git+https://github.com/Rapptz/discord.py
IT WORKS TYYYYYYSM
LESSGO
Okay, but that library too is dead now
And archieved
Guys, why is the error coming as, u have been temporarily disconnected because of exceeding rate-limit of discord API
You probably ยซย spamย ยป the api with requests
like how do i prevent it?
Have you a loop or something in your bot ?
users use the bot in a limited way
no big commands, that could crash, normal embeds and messages are being sent
umm, how do i implement built-in dunder function to class (not instances) so like classmethod dunder function maybe?
should've ask in general...
my message is not been recognised as a message object
@client.event
async def on_message(message):
msg = message
os.system("clear")
os.system(f"echo {client.user}")
print(msg.guild.id)
Error
Ignoring exception in on_message
Traceback (most recent call last):
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/client.py", line 343, in _run_event
await coro(*args, **kwargs)
File "main.py", line 55, in on_message
print(msg.guild.id)
AttributeError: 'NoneType' object has no attribute 'id'
guild is None, which means the message was sent in dms
ohk
let me check
how to know if a message is sended in dms
any possible way
if guild is None, it has been sent in dms
guild will be None
like any conditions using if
Is the application id in routes of application commands the bot's ID? https://discord.com/developers/docs/interactions/application-commands#application-command-object
no, the dev app's id
select an application, General Information
and you should see Application ID
Oh
But that's same as bot id?
Means I can just use the bot's ID for registering commands? 
i dont think its the same as the bot's id
Ah nvm bot has an application_id attr
i mean if it was the same anybody could add slash commands to your bot
859446480687333436 and it's the ID I copied from context menu.. They'll are same 
well whatever
Thanks
dont read this, i am stupid
Lol Np 
Guys, when i assign a muted role to somebody, they can still type so what do i do?
change the role's permissions
I DID
everything is toggled off
@hasty iron
if you did it and they can still talk, it wasn't done correctly
can i send a screenshot of the perms?
send the code where you set the permissions
or did you do it manually through role settings?
ok wait
code
@client.event
async def on_message(message):
if message.guild == None:
ctx = message.channel
em = discord.Embed(title = f"Info", description = f"yaml\nI dont accept Dms\n", color = 0xffffff)
em.add_field(name = "Invite Me", value = f"[Here]({invite_link})")
em.timestamp = datetime.datetime.utcnow()
em.set_footer(text = "Chatty - Stopping Bad Words", icon_url = client.user.avatar_url)
await ctx.send(embed = em)
error
It Just Dms Continiously How Can I make It Dm Just Once
@client.command()
async def mute(ctx, member: discord.Member, reason=None):
role = get(ctx.guild.roles, name="muted")
guild = ctx.guild
if role not in guild.roles:
perms = discord.Permissions(send_messages=False, speak=False)
await guild.create_role(name="muted", permissions=perms)
await member.add_roles(role)
await ctx.send(f"{member} has been muted!")
else:
await member.add_roles(role)
await ctx.send(f"{member.display_name} has been muted!")
@client.command()
async def unmute(ctx, member: discord.Member, reason=None):
role = get(ctx.guild.roles, name="muted")
await member.remove_roles(role)
await ctx.send(f"{member.display_name} has been unmuted!")
@spring flax
set a one time use boolean
add a check to see if the author is a bot using message.author.bot which returns a bool
@client.event
async def on_message(message):
if message.guild == None:
ctx = message.channel
em = discord.Embed(title = f"Info", description = f"yaml\nI dont accept Dms\n", color = 0xffffff)
em.add_field(name = "Invite Me", value = f"[Here]({invite_link})")
em.timestamp = datetime.datetime.utcnow()
em.set_footer(text = "Chatty - Stopping Bad Words", icon_url = client.user.avatar_url)
await ctx.send(embed = em)
if message.author == client.user:
return
if message.author.bot:
return
Still Same Error
where is the error?
at the beginning
Anybody bothering to help me out?
they literally told you the answer
for a discord button to work, it should always be in a class?
its not working
what is
u can but u need ffmpeg
oh, thankuu, i just am a big dope
lol
Hey hello, which plan i need to select when i create an aws account
Can you explain what's that or where to learn about it and thamks
Ummm, go to any free youtube course and ffmpeg is used to for audio/video file processign
Ok thamks guys
no more updates
just about to ask that cause i need to move over commands that require an arg to slash 
seems like I have become a bit too rusty
๐งข

msg = await inter.send()
await msg.edit()

Yea
So is there a problem?
Ah yea
otherwise it no work
Yes
Impossible without using third party libs.
Discord.py will no longer update so there will be no slash commands.
Use third party libs
@client.command()
async def youtube(ctx):
if ctx.author.voice == None:
embed = discord.Embed(
title="error",
description="join a vc first",
color=0xE02B2B
)
hi this returns an error in the terminal, i'm not sure how to fix it and i'm kinda new to discord bots i don't really know what im doing with embeds
Try to read the docs. I was not using this lib before so idk how it works.
Send error please.
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: NameError: name 'context' is not defined
sorry internet bit laggy
Do you have any other commands?
um no
that's it
oh i didn't paste in the last bit
@client.command()
async def youtube(ctx):
if ctx.author.voice == None:
embed = discord.Embed(
title="oi what happened",
description="you can't do this",
color=0xE02B2B
)
await context.send(embed=embed)
there is your error...
await ctx.send(embed=embed) not await context.send(embed=embed)
oof.
You have no variable called context
oh well thanks
It's now for support to any thing related to bot development in Python. (I think)
Anyways, finally my damn paypal works. I'm getting my cyan name back.
Even better.
What's the permission named to manage servers?
@commands.has_permissions(manage_server=True)
``` doesnt work for me
```py
Traceback (most recent call last):
File "/home/pi/Downloads/bot/GelbieLevel/main2.py", line 98, in <module>
@commands.has_permissions(manage_server=True)
File "/usr/local/lib/python3.9/site-packages/discord/ext/commands/core.py", line 1779, in has_permissions
raise TypeError('Invalid permission(s): %s' % (', '.join(invalid)))
TypeError: Invalid permission(s): manage_server
manage_guild
embed.add_field(name="Moderatie", value="!help moderatie", inline=False)
IndentationError: unexpected indent
@bot.group(invoke_without_command=True)
async def help(ctx):
embed = discord.Embed(title="Hoe kan ik je helpen!", description="Zie hieronder de modules!")
embed.add_field(name="Moderatie", value="!help moderatie", inline=False)
embed.add_field(name="Public", value="!help public", inline=False)
embed.add_field(name="Informatie", value="!help informatie", inline=False)
await ctx.send(embed=embed)
@help.command()
async def moderatie(ctx):
embed = discord.Embed(title="Moderatie commands", description="Zie hieronder de moderatie commands!")
embed.add_field(name="!warn <Gebruiker> <reden>", value="Persoon een waarschuwing geven.", inline=False)
await ctx.send(embed=embed)
asyncio.run is incompatible with discord.py
you can get loop through bot.loop
!d discord.Client.get_user
get_user(id)```
Returns a user with the given ID.
this requires intents.members btw
!intents
Using intents in discord.py
Intents are a feature of Discord that tells the gateway exactly which events to send your bot. By default, discord.py has all intents enabled, except for the Members and Presences intents, which are needed for events such as on_member and to get members' statuses.
To enable one of these intents, you need to first go to the Discord developer portal, then to the bot page of your bot's application. Scroll down to the Privileged Gateway Intents section, then enable the intents that you need.
Next, in your bot you need to set the intents you want to connect with in the bot's constructor using the intents keyword argument, like this:
from discord import Intents
from discord.ext import commands
intents = Intents.default()
intents.members = True
bot = commands.Bot(command_prefix="!", intents=intents)
For more info about using intents, see the discord.py docs on intents, and for general information about them, see the Discord developer documentation on intents.
discord doesn't expose user IP's so not within discord itself
you could potentially set up a verification systen via an outside website but I imagine it wouldn't be simple
you cant prevent it lol
i am making it using websit
but i want to know how to prevent users from using vpn
you cant
Y does my bot send two messages when type a command?
Can someone please send an example where a bot detects a reaction, nothing is working for me
on_raw_reaction_add
I tried everything on stack over flow, can you please give an example
how to prevent users from using vpn
Smone?
why though?
You can't completely. You could theoretically check their IP against known VPN ranges but a) won't catch every vpn B) they could just disable it while they verify.
more effort than worth and a bit complex for this channel
there are a lot of vpn ips
know vpn ranges wdym?
I use to OP an IRC network and we'd catch most VPN's with the system we had. true tho
What is OP and IRC?
how can i prevent them from using vpn any idea or any module
might be worth asking in their discord https://discord.gg/KkgMBVuEkx
ig you can do that to block most vpn ips
Flask
i mean for the frontend
or fastapi
html/css/js
use the google captcha api
well i need a module to make captcha
!pypi captcha
thanks
I want the code to display mention all the users with the given roles(can be any number) as argument
https://stackoverflow.com/questions/68957866/to-find-all-users-in-the-given-roles-discord-py
can someone help me out?
!d discord.Role.members
members```
Returns all the members with this role.
thats for 1 role
yep
how do i get any number of roles passed as an argument
the user can enter any number of roles, it should fetch users having all those roles
^
you can create sets and then intersect them, it's a weird way to solve it but it should do the work
I dont really know how to use that
im almost done with slash commands
Hey whats gonna happen to discord.py in 2022?
!d set
:/
class set([iterable])``````py
class frozenset([iterable])```
Return a new set or frozenset object whose elements are taken from *iterable*. The elements of a set must be [hashable](https://docs.python.org/3.10/glossary.html#term-hashable). To represent sets of sets, the inner sets must be [`frozenset`](https://docs.python.org/3.10/library/stdtypes.html#frozenset "frozenset") objects. If *iterable* is not specified, a new empty set is returned.
Sets can be created by several means:
โข Use a comma-separated list of elements within braces: `{'jack', 'sjoerd'}`
โข Use a set comprehension: `{c for c in 'abracadabra' if c not in 'abc'}`
โข Use the type constructor: `set()`, `set('foobar')`, `set(['a', 'b', 'foo'])`...
there you go
yep
but can you also go through my code and find out where i went wrong
where is your code?
because it really seems fine to me but doesn't work the way i want it to
i posted it on stack overflow
what in the
Replace name with role:discord.Role.
anyone now my error?
that will take in only 1 role
i mean the problem with my code
Then replace name with roles:list and then make a for loop.
no , it takes in any number of roles as a string which i then convert to a list
!e
import asyncio
async def x(*idk):
print(idk)
loop = asyncio.get_event_looop()
loop.run_until_complete(x)
dam
that still doesn't solve the issue, the code seems to work fine for 1 role entered as argument and few other roles, but doesn't work sometimes
Pass the ID of the role and make sure there's a space between each role ID.
what does role.members return? List?
but that kills the purpose, i want it to take role names as the arguement
yeah list of members in that role
no, I mean datatype
class
List or a custom class?
im not sure, i think its list, i could be wrong
okay what I am sending might be VERY wrong but just try it once
@bot.command()
@commands.has_role('Admins')
async def find(ctx,*, name):
guild=ctx.guild
roles=name.split(",")
role=get(guild.roles, name=roles[0])
members=set(role.members)
for role in roles[1:]:
role = get(guild.roles, name=role.strip(" "))
lm=set(role.members)
members = members.intersection(lm)
l=[f"{role.mention}" for role in members]
print(l)
okay gimme a min
I want to make an event happening every 1th day of month. What is the best way to do it?
!d typing.Any
!d typing
New in version 3.5.
Source code: Lib/typing.py
Note
The Python runtime does not enforce function and variable type annotations. They can be used by third party tools such as type checkers, IDEs, linters, etc.
This module provides runtime support for type hints as specified by PEP 484, PEP 526, PEP 544, PEP 586, PEP 589, PEP 591, PEP 612 and PEP 613. The most fundamental support consists of the types Any, Union, Tuple, Callable, TypeVar, and Generic. For full specification please see PEP 484. For a simplified introduction to type hints see PEP 483.
The function below takes and returns a string and is annotated as follows...
I don't think there is _UnionGenericAlias in typing
ok
guys how to update something in mongo
works like a charmmm thanks a lot!! @coarse compass ๐ ๐
bruhhh then how
niceee, glad to help ๐
any advice pls?
ask in #python-discussion someone there might be able to help ๐
me niether
that's for sure...I mean...should it be a listener in Cogs...or something else
@coarse compass
I mean you can set up a task which checks for the time every minute
I don't think it's good to do sth like
while not datetime.now().day() == 1:
#do nothing
else:
#do my thing
something
that can work
what is that something
Just add some delay so it doesn't lag
slash commands
ok what does that have to with that class
how did that happen :\
@gritty flame sorry then my bad ๐
Wht is the hex for white?
Yo anynody know how to make a bot active all the time?
ok
np np
host it
do you want to implement it like discord.py?
How tho
run it in server
Yeap
I know that i have to host it in a server
not you
yeh in my repo
But idk how
Terribly sorry
also i dont think isinstance will work
does anyone have any examples of a basic ping/pong bot implemented just with discord api (no wrapper)?
using websockets/http requests
?do u jnow how
yeah you have to do if annotation is Union:
alr
get a vps
Color=0xFFF002
this is for gold
how do i find for uh white?
go search it up of google
alr thks
oh wait no
Well white is #FFFFFF
but cann we use this in the code?
you have to do getattr(annotation, '__origin__') first
and then if whatever is Union:
why is this when deployed to heroku, it gets an error, even though when it's run locally it's okay
2021-08-29T13:01:13.573348+00:00 app[worker.1]: The above exception was the direct cause of the following exception:
2021-08-29T13:01:13.573349+00:00 app[worker.1]:
2021-08-29T13:01:13.573356+00:00 app[worker.1]: Traceback (most recent call last):
2021-08-29T13:01:13.573363+00:00 app[worker.1]: File "/app/adit.py", line 270, in <module>
2021-08-29T13:01:13.573453+00:00 app[worker.1]: bot.load_extension(f'cogs.{filename[:-3]}')
2021-08-29T13:01:13.573460+00:00 app[worker.1]: File "/app/.heroku/python/lib/python3.9/site-packages/discord/ext/commands/bot.py", line 678, in load_extension
2021-08-29T13:01:13.573619+00:00 app[worker.1]: self._load_from_module_spec(spec, name)
2021-08-29T13:01:13.573626+00:00 app[worker.1]: File "/app/.heroku/python/lib/python3.9/site-packages/discord/ext/commands/bot.py", line 609, in _load_from_module_spec
2021-08-29T13:01:13.573774+00:00 app[worker.1]: raise errors.ExtensionFailed(key, e) from e
2021-08-29T13:01:13.573802+00:00 app[worker.1]: discord.ext.commands.errors.ExtensionFailed: Extension 'cogs.remove' raised an error: ExtensionFailed: Extension 'cogs.love' raised an error: OSError: cannot open resource
2021-08-29T13:01:13.763731+00:00 heroku[worker.1]: Process exited with status 1
2021-08-29T13:01:13.950720+00:00 heroku[worker.1]: State changed from up to crashed```
0xFFFFF
๐
Hey @serene lynx!
Uh-oh! It looks like your message got zapped by our spam filter. We currently don't allow .txt attachments, so here are some tips to help you travel safely:
โข If you attempted to send a message longer than 2000 characters, try shortening your message to fit within the character limit or use a pasting service (see below)
โข If you tried to show someone your code, you can use codeblocks
(run !code-blocks in #bot-commands for more information) or use a pasting service like:
@commands.command()
async def love(self, ctx, user1: discord.Member, user2: discord.Member):
if user1 == user2:
await ctx.send('user1 and user2 must be different')
else:
love_image = Image.open('imglove.jpg')
asset = user1.avatar_url_as(size=128)
asset2 = user2.avatar_url_as(size=128)
data = BytesIO(await asset.read())
data2 = BytesIO(await asset2.read())
pfp = Image.open(data)
pfp2 = Image.open(data2)
pfp = pfp.resize((177, 177))
pfp2 = pfp2.resize((177, 177))
love_image.paste(pfp, (282, 264))
love_image.paste(pfp2, (794, 264))
draw = ImageDraw.Draw(love_image)
text1 = f'{user1}'
text2 = f'{user2}'
acak = random.randint(1, 100)
hasil1 = ''
hasil2 = ''
hasil3 = ''
hasil4 = ''
if acak == 100:
hasil1 = f'{acak}%'
hasil2 = 'Sempurna'
elif acak <= 33:
hasil1 = f'{acak}%'
hasil2 = 'Maaf kamu kurang beruntung'
elif acak > 33 and acak <= 50:
hasil1 = f'{acak}%'
hasil2 = 'lumayan cocok'
elif acak > 50:
hasil1 = f'{acak}%'
hasil2 = 'cocok banget'
draw.text((281, 468), text1, (0, 0, 0), font=self.font)
draw.text((794, 466), text2, (0, 0, 0), font=self.font)
draw.text((606, 329), hasil1, (0, 0, 0), font=self.font)
draw.text((515, 358), hasil2, (0, 0, 0), font=self.font)
love_image.save('profile.jpg')
try:
await ctx.send(file=discord.File('profile.jpg'))
except Exception as e:
e = sys.exc_info()
print(e)```
Hey
.
why does the first line activate but the second one doesnt? https://gyazo.com/7eeca2a632f38f4bb8956b9908bc1d84
what am i doing wrong i cant figure it out
async def love(self I like this part
when i place the order its tell me an error message on my bot
@bot.command('wanted')
async def wanted(ctx, member: discord.Member = None):
if member == None:
member = ctx.author
wanted = Image.open("wanted.jpg")
asset = member.avatar_url_as(size = 128)
data = BytesIO(await asset.read())
profilepic = Image.open(data)
profilepic= profilepic.resize((597, 720))
wanted.paste(profilepic, (339, 570))
wanted.save("wanted1.jpg")
because on_message_lol isnt a valid event and you arent supposed to register event listeners inside event listeners
0xFFFFF
how do i change this?
.
did u make sure to save after editing
however it doesn't support discord.Client (or I can't get it working)
but it is good
ppl who built their bots on discord.Client (not using a "template" like commands.Bot) can't even use it lol
ok ok
@client.command()
async def bt(ctx):
print("bt command send")
await ctx.send(
"This is a Button!",
componets=[
Button(label='Click Me!')
]
)
interaction = await client.wait_for("button_click", check=lambda i: i.component.label.startswith("Click"))
await interaction.respond(content="Button Clicked!")
why dont work me?
File "/home/container/bot.py", line 153
async def help(ctx):
^
SyntaxError: invalid syntax
async def help(ctx):
embed = discord.Embed(title="Hoe kan ik je helpen!", description="Zie hieronder de modules!")
embed.add_field(name="Moderatie", value="!moderatie", inline=False)
embed.add_field(name="Public", value="!public", inline=False)
embed.add_field(name="Informatie", value="!informatie", inline=False)
await ctx.send(embed=embed)```
!codeblock
Nvm, It was because there was a ) missing at the command above.
@client.command()
async def bt(ctx):
print("bt command send")
await ctx.send(
"This is a Button!",
componets=[
Button(label='Click Me!')
]
)
interaction = await client.wait_for("button_click", check=lambda i: i.component.label.startswith("Click"))
await interaction.respond(content="Button Clicked!")
why this no work for me?
components not componets.
You missed a n.
You are rate limited
All I can tell you is it's not preferable to code Discord bots on repl.it. There's always a high chance it gets blocked and rate limited from the API since you have multiple other people hosting their bots on the same IP as you are hosting your bot.
Thanks. but why this not send a respond?
Do you get any errors?
no
realistically, is someone going to take over dpy? or is it dead?
No one agreed to continue its development, so discord.py is most likely not getting updated anymore. However, it won't be "dead" since it's too large to die just like that.
What package are you using?
type kill 1 in the repl shell, it'll sometimes throw you on a new IP
this will happen every now and then on repl
but wonโt a change to the discord API break the existing code?
yes but that won't happen until April 22
If they change their endpoints, yes.
how often do they do that?
from discord_components import *
There are 3k + some smart people who downloaded instead of forking working on dpy and literally 0.5% will be usable. Just wait or use another, there are loads of libs still in existence. Or change the programming language 
they prob wont do that
huh? i donโt understand what you mean
Just wait or use another, there are loads of libs still in existence. Or change the programming language
the first part i donโt understand
Use hikari, it'll be developed soon completely
!d discord.AuditLogAction.member_disconnect
A memberโs voice state has changed. This triggers when a member is force disconnected from voice.
When this is the action, the type of extra is set to an unspecified proxy object with one attribute:
โข count: An integer specifying how many members were disconnected.
New in version 1.3.
Ignore that, that wasn't relevant to your question
what's the difference between this:
@client.event
async def on_message(message):
if (message.content.startswith('!ping')):
message = await message.channel.send('pong!')
``` and this:
```py
@client.command()
async def ping(ctx):
await ctx.send("pong!")
Nothing.
the first one is an event, the second one is a command
I'm not very sure then.
the output is the same
I believe he meant the output.
oh, the output is the same
events are not good if you are making a bot with over 10 commands
It'll look messy
Use command
Try:
await interaction.respond(
type=InteractionType.ChannelMessageWithSource,
content=f'{res.component.label} clicked')
so I should not use 50 different if statements for every command?
I believe you missed the type attribute.
Hoi
you can use command they are simple and not messy
What are you gonna do if a command requires a argument??
@bot.event
async def on_message(message):
if message.content.startswith("!say"):
what_to_say = message.content.replace("!say", "")
await message.channel.send(what_to_say)
what if he want to mention a member?
!d discord.Message.mentions
A list of Member that were mentioned. If the message is in a private message then the list will be of User instead. For messages that are not of type MessageType.default, this array can be used to aid in system messages. For more information, see system_content.
Warning
The order of the mentions list is not in any particular order so you should not rely on it. This is a Discord limitation, not one with the library.
message.author.mention
if you think on_message events are good for making a command go ahead good luck
why dont work if i click again
That's the message author
Because you have one wait_for.
I didn't say it's good, I just answered you questions ["what to do if it needs an argument", "what to do if you want to mention a member"].
I didn't meant to tell you :/
I was just answering so. 
Can it be changed?
message.channel.send"<@{message.author.id}>"))
interaction = await client.wait_for("button_click", check=lambda i: i.component.label.startswith("Click"))
I believe that package allows you to have an on_button_click event. So you can have
@client.event
async def on_button_click(interaction)
dude tf
it's how I mention
go ahead if you want to use on_message go ahead
!d discord.ext.commands.Context.author.mention
No documentation found for the requested symbol.
!d discord.Member.mention
mention```
Returns a string that allows you to mention the member.
please can someone give me an example of on raw reaction add
message.author = the one who used the message argument or sent the message ๐
๐
thanks
!d discord.on_raw_reaction_add I believe it has an example.
discord.on_raw_reaction_add(payload)```
Called when a message has a reaction added. Unlike [`on_reaction_add()`](https://discordpy.readthedocs.io/en/stable/api.html#discord.on_reaction_add "discord.on_reaction_add"), this is called regardless of the state of the internal message cache.
This requires [`Intents.reactions`](https://discordpy.readthedocs.io/en/stable/api.html#discord.Intents.reactions "discord.Intents.reactions") to be enabled.
!d discord.on_reaction_add
discord.on_reaction_add(reaction, user)```
Called when a message has a reaction added to it. Similar to [`on_message_edit()`](https://discordpy.readthedocs.io/en/stable/api.html#discord.on_message_edit "discord.on_message_edit"), if the message is not found in the internal message cache, then this event will not be called. Consider using [`on_raw_reaction_add()`](https://discordpy.readthedocs.io/en/stable/api.html#discord.on_raw_reaction_add "discord.on_raw_reaction_add") instead.
Note
To get the [`Message`](https://discordpy.readthedocs.io/en/stable/api.html#discord.Message "discord.Message") being reacted, access it via [`Reaction.message`](https://discordpy.readthedocs.io/en/stable/api.html#discord.Reaction.message "discord.Reaction.message").
This requires [`Intents.reactions`](https://discordpy.readthedocs.io/en/stable/api.html#discord.Intents.reactions "discord.Intents.reactions") to be enabled.
Note
This doesnโt require [`Intents.members`](https://discordpy.readthedocs.io/en/stable/api.html#discord.Intents.members "discord.Intents.members") within a guild context, but due to Discord not providing updated user information in a direct message itโs required for direct messages to receive this event. Consider using [`on_raw_reaction_add()`](https://discordpy.readthedocs.io/en/stable/api.html#discord.on_raw_reaction_add "discord.on_raw_reaction_add") if you need this and do not otherwise want to enable the members intent.
which should i use i dont understand
anyone care with AI
on_reaction_add depends on the internal cache for messages, they both are useful depending on the use case but i would say use on_raw_reaction_add to be more safe
!d discord.on_command
discord.on_command(ctx)```
An event that is called when a command is found and is about to be invoked.
This event is called regardless of whether the command itself succeeds via error or completes.
@client.command()
async def call(ctx, user:discord.Member):
if ctx.author.voice == None:
await ctx.author.send(embed=discord.Embed(description=f"Hold on! You cannot call someone if you aren't in a voice channel!", color=0x004cff,timestamp=ctx.message.created_at))
if ctx.author.voice != None:
embed=discord.Embed(description=f" **{ctx.author.display_name}** is calling **{user.display_name}** in frequency:\n`{ctx.author.voice.channel}`", color=0x004cff,timestamp=ctx.message.created_at)
embed.set_author(name=f"@{ctx.author.display_name}", icon_url=ctx.author.avatar_url)
await buttons.send(
content=f"{user.mention}",
embed=embed,
channel=ctx.channel.id,
components=[
ActionRow([
Button(
label="Join Call",
style=ButtonType().Success,
custom_id="callCommand"
)
])
]
)
@buttons.click
async def callCommand(ctx):
print(f"called {ctx.message}")```
I'm trying to make it so when someone "calls" you, a button pops up that says "Join Call" and when you press it, it moves you to the VC of the command executor's voice channel. How would I go about doing that?
Right now the button works but I don't know how to get the voice channel of the person who ran the command.
We need the code.
Yes
em.add_field(name="๐ฐ Total",inline=False, value= walletamt + bankamt)
My bet is that you're storing the wallet and bank values as strings. You need to store them as integers or floats
How can i do that?
by learning python
still need help with this if you guys know how to solve it
I don't know, why are they strings in the first place? ๐
Traceback (most recent call last):
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/jishaku/features/python.py", line 145, in jsk_python
async for send, result in AsyncSender(executor):
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/jishaku/functools.py", line 109, in _internal
value = await base.asend(self.send_value)
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/jishaku/repl/compilation.py", line 140, in traverse
async for send, result in AsyncSender(func(*self.args)):
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/jishaku/functools.py", line 109, in _internal
value = await base.asend(self.send_value)
File "<repl>", line 5, in _repl_coroutine
if last_boost.premium_since is not None:
UnboundLocalError: local variable 'last_boost' referenced before assignment
if ctx.guild.premium_tier != 0:
boosts = f'Level {ctx.guild.premium_tier}\n{ctx.guild.premium_subscription_count} boosts'
last_boost = max(ctx.guild.members, key=lambda m: m.premium_since or ctx.guild.created_at)
if last_boost.premium_since is not None:
boosts = f'{boosts}\nLast Boost: {last_boost} ({discord.utils.format_dt(last_boost.premium_since, style = "F")})'
await ctx.send(boosts)
help??? this came when the guild had 0 boost how do i not get the error?
i think you can handle this by using try/except?
how
i'm finally finished with slash implementation
nice
so now just intents which wont be coming kinda soon
show me website folder ๐
interesting
css without html sus
the html is in templates
can you show me in browser?
ok brb
waiting
@high flame
nice
@hybrid fjord No spoonfeeding
i didnt work on it for a week andi dont plan on working on it for a while
im shit in frontend
ah
??? im not?

Makes site that looks decent, Looks good :D
Opens it in mobile view :(
thats not spoonfeeding..
;-;
how to center a div
lel
I needed to code websites for a year, it was a pain but i did learn from it :)

if u want to do it , give it a shot

