#discord-bots
1 messages · Page 1044 of 1
!d discord.Client.create_guild there's a limitation tho
await create_guild(*, name, icon=..., code=...)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Creates a [`Guild`](https://discordpy.readthedocs.io/en/master/api.html#discord.Guild "discord.Guild").
Bot accounts in more than 10 guilds are not allowed to create guilds...
python -m pip install git+https://github.com/rapptz/discord.py make sure u have git installed as well
pip uninstall discord
pip install git+https://github.com/Rapptz/discord.py
note theres some breaking change
or just pip install -U git+https://github.com/Rapptz/discord.py
what diff about hikari?
cache things are better + im way more comfortable with it
so, i needed to know if i put reactions on messages, how many would i be able to track at a time without issues ?
i forgot the controls of gaming 💀
using on_reaction_add/on_raw_reaction_add , as many you want,
using wait_for("reaction_add"), one at a time
whats the diff
on reaction add and on raw reaction add
Btw docs link for buttons?
Ofc of d.py v2.0
whats the best way to go about making a translator without the hassle of writing some command each time.
google translate api?
!docs discord.ui.Button
class discord.ui.Button(*, style=<ButtonStyle.secondary: 2>, label=None, disabled=False, custom_id=None, url=None, emoji=None, row=None)```
Represents a UI button.
New in version 2.0.
or some translating api
back end is complete, but i havent worked with discord
!docs discord.ui.View
class discord.ui.View(*, timeout=180.0)```
Represents a UI view.
This object must be inherited to create a UI within Discord.
New in version 2.0.
i wanna make it comfortable for the user
the reaction_add event needs Member intents, it gives you 2 args, message and user, reaction being reaction: discord.Reaction and user being user: discord.User | discord.Member
the raw_reaction_add event gives you a single payload which is payload: discord.RawReactionActionEvent @regal pulsar
@slate swan btw theres some examples
https://github.com/Rapptz/discord.py/tree/master/examples/views
ah
i see
thats why i need to know about this
you mean a translator command?
@bot.slash_command(aliases=[“tl”])
async def translate(inter: discord.Applicationcommandinteraction, *, txt: str):
txt = await translate_function(txt)
await inter.response.send_message(txt, ephimeral = True)
no no. wait
translate function is a function that returns the translated text
that you need to code in
then you just do
/translate gracias amigos
and it’ll send thanks friends
in an ephimeral so only you can see it
i have a few options to work with. I set a default language for the user, they would choose. Then all they write is the command. Give them option to manually change as well. Other thing, I wanted to do reactions for the country flags but i am not sure how man i could track
no
/trentofrench
like that or either whatever they have set as default
or /trfrench to automatically detect and so convert to french, command being /tr
@bot.slash_command(aliases=[“tl”])
async def translate(inter: discord.Applicationcommandinteraction, *, txt: str):
lang = read json for users language
txt = await translate_function(txt, language = lang)
await inter.response.send_message(txt, ephimeral = True)
@bot.slash_command()
async def setlang(inter: Applicationcommandinteraction, *, lang: str):
set users language in json/db
hmm
thanks worked
Hm, a question
np
hey guys, can anybody get me started on embed buttons, as in, the buttons that appear below embeds, and how can i call a function when the button is pressed
i havnt worked with buttons but i assume its similar to selec menus
but this is useful so thanks for that
you create a button instance and set a name/emoji
is it discord.Interaction or smth?
then add it to a view
right
class discord.ui.Button(*, style=<ButtonStyle.secondary: 2>, label=None, disabled=False, custom_id=None, url=None, emoji=None, row=None)```
Represents a UI button.
New in version 2.0.
!d discord.ui.View
class discord.ui.View(*, timeout=180.0)```
Represents a UI view.
This object must be inherited to create a UI within Discord.
New in version 2.0.
ty
np
np
can i ask something in DM if you dont mind
?
Select menu in v2.0?
yep what is it
sure
Hm, I was thinking of something else but anyways, there's a loophole to that
hmm
😔
there's an example in the github repo of discord.py, lemme get the link real quick
k
.src ttt 😔
💀 never knew that disnake allowed attaching disnake.File s to embeds directly
sadge
есть русские
yeah they do have a kwarg for local files
dude, stop
didnt use it in a while, so wasnt aware
im using disnake for like after 2 months now~
why are you even-
im making a bot for a friend, and he uses that library so yea
88 errors
😳 run the code check lmao, don't worry about linting xD
but
actually it doesn't work
that isn;t tic tac toe
anyways
see?
hi guys i am creating a command and in this command when i run it it has to create a room and add the people mentioned, only it adds the user who used the command, how can i fix my code?
code (if there are gaps in the code, the translator does this):
async def real1v1 (ctx, member: discord.Member, arg, product, *, stars):
embed = discord.Embed (title = f "New realistic 1v1 wager for {arg}", description = f "** Team 1: {product} vs Team 2: {stars} **", color = discord.Color.red ())
guild = ctx.guild
member = ctx.author
member2 = ctx.author.member
admin_role = get (guild.roles, name = "RoleTestAdmin")
overwrites = {
guild.default_role: discord.PermissionOverwrite (read_messages = False),
member: discord.PermissionOverwrite (read_messages = True),
member2: discord.PermissionOverwrite (read_messages = True),
admin_role: discord.PermissionOverwrite (read_messages = True)
}
channel = await guild.create_text_channel (f'Team1-Team2 ', overwrites = overwrites)
#await channel.send (f "{product} {stars}")
embed.set_footer (text = f "{ctx.guild.name}")
await ctx.send (embed = embed)```
what is tic tac toe then?
like
x and o
type in the box's number where you want to place you x and o s
Selectoption link for d.py?
!d discord.SelectOption click on the blue title
class discord.SelectOption(*, label, value=..., description=None, emoji=None, default=False)```
Represents a select menu’s option.
These can be created by users.
New in version 2.0.
its that, just have the index there for easy access, remove the True from a = TTT(3, True) to play without the random choice
anyways, if u want to make like a ttt which might actually be better, cuz that one i sent is not readable in anyway. ask in #game-development

getting this error
intents = discord.Intents.default()
intents.message_content = True
intents.members = True
client = commands.Bot(",")
code ^
!d discord.ext.commands.Bot
class discord.ext.commands.Bot(command_prefix, *, help_command=<default-help-command>, tree_cls=<class 'discord.app_commands.tree.CommandTree'>, description=None, intents, **options)```
Represents a discord bot.
This class is a subclass of [`discord.Client`](https://discordpy.readthedocs.io/en/master/api.html#discord.Client "discord.Client") and as a result
anything that you can do with a [`discord.Client`](https://discordpy.readthedocs.io/en/master/api.html#discord.Client "discord.Client") you can do with
this bot.
This class also subclasses [`GroupMixin`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.GroupMixin "discord.ext.commands.GroupMixin") to provide the functionality
to manage commands...
pass in the intents, just defining intents isnt gonna work
and how?
don't you need to type prefix=","?
oh my god
my brain
command_prefix=",", intents=intents
need some help, please
it's alright hehe
...
bot = commands.Bot(command_prefix=",", intents=intents)
haha right
nvm meh's quicker 😔
I'm speed
i tried to make a command to get a definition from urbandictionary.com, and now i'm trying to make it so that when the user reacts with a right/left arrow, it goes to the previous/next definition, and i ended up screwing the entire command up. if anyone'd like to go through the torture of going through my code, i'd appreciate it - https://paste.pythondiscord.com/xazafocipa
the response from the urbandictionary api is an array of objects
and yes, i realize that requests is blocking and i'll be replacing it soon
reaction, user = await self.bot.wait_for("reaction_add", check=check)
^
SyntaxError: 'await' outside async function
class view(View):
def __init__(self):
super().__init__(timeout=None)
@button(label = "1", custom_id = '1')
async def counter(self,button: Button, interaction: Interaction):
label = str(button.label)
label += 1
button.label = str(label)
await interaction.send(content="123")
@client.command()
async def test(ctx):
await ctx.send("mf", view = view())
code ^
which lib are you using?
Ye
await outside async function
why am i so dumb, ty
its the same code but i get this on button click
Brooo wtf read error
To quack*
TypeError: Parameters to Generic[...] must all be type variables
?
Code
Jsk
huh?
Nvmd
u can't assign using = in function calls
not even walrus, its sad
interaction doesn't have an attribute author
f' '
!fstrings
Creating a Python string with your variables using the + operator can be difficult to write and read. F-strings (format-strings) make it easy to insert values into a string. If you put an f in front of the first quote, you can then put Python expressions between curly braces in the string.
>>> snake = "pythons"
>>> number = 21
>>> f"There are {number * 2} {snake} on the plane."
"There are 42 pythons on the plane."
Note that even when you include an expression that isn't a string, like number * 2, Python will convert it to a string for you.
its Interaction.user
ok
how can i send interraction reponse for button?
!eval
Name = 'jh'
print(f'My nane is {Name}')
@loud junco :white_check_mark: Your eval job has completed with return code 0.
My nane is jh
We can clearly see he copied
My nane
I need members name and discriminator
um?
show ur code, u need to use the interaction u took as arg for ur function, not the actual class lmao
thats the repr of the Interaction.user
user doesn't have an attribute name
interaction.response.send_message()
huh did you just type Interaction.user directly?
Imagine
being sparky
Bro they are objects
use interaction.user
interaction is not defined
why do u have nested callbacks

2 messages
Copy paste indents issue
https://paste.pythondiscord.com/bizoladefo
num +=1
UnboundLocalError: local variable 'num' referenced before assignment```
i'm confused (as usual) - how am i referring to it before assigning?
object has no attribute 'name'
What
how should I do it then
dont nest it.... do u even know what nested means?
@client.command()
@commands.has_permissions(administrator=True)
async def ticket(ctx):
button1 = Button(label = "Ticket", style = discord.ButtonStyle.green)
button2 = Button(label = "Close", style = discord.ButtonStyle.red)
category = discord.utils.get(ctx.guild.categories, name="Tickets")
async def button_callback(interaction: discord.Interaction):
ticket_channel = await interaction.guild.create_text_channel(name="Ticket", category=category)
async def button2_callback(interaction: discord.Interaction):
await interaction.channel.delete()
button2.callback = button2_callback
view2 = View()
view2.add_item(button2)
await ticket_channel.set_permissions(interaction.user, read_messages=True, send_messages=True, read_message_history=True)
await ticket_channel.edit(permissions_synced=True)
await ticket_channel.send(embed=embed, view=view2)
view = View()
button1.callback = button_callback
view.add_item(button1)
embed = discord.Embed(title="New ticket from {}#{}".format(Interaction.user.name, Interaction.user), description= "Click the Red Button below to delete this ticket.", color=discord.Color.orange())
await ctx.send(embed = discord.Embed(title = "Ticket", description = "Click the Green Button below to create a ticket.", color=discord.Color.orange()), view = view)```
Birds nest
a
a
^ - nested
no
Lol
a
a
ye
that is, python cares about indentation
Indentation
Indentation is leading whitespace (spaces and tabs) at the beginning of a line of code. In the case of Python, they are used to determine the grouping of statements.
Spaces should be preferred over tabs. To be clear, this is in reference to the character itself, not the keys on a keyboard. Your editor/IDE should be configured to insert spaces when the TAB key is pressed. The amount of spaces should be a multiple of 4, except optionally in the case of continuation lines.
Example
def foo():
bar = 'baz' # indented one level
if bar == 'baz':
print('ham') # indented two levels
return bar # indented one level
The first line is not indented. The next two lines are indented to be inside of the function definition. They will only run when the function is called. The fourth line is indented to be inside the if statement, and will only run if the if statement evaluates to True. The fifth and last line is like the 2nd and 3rd and will always run when the function is called. It effectively closes the if statement above as no more lines can be inside the if statement below that line.
Indentation is used after:
1. Compound statements (eg. if, while, for, try, with, def, class, and their counterparts)
2. Continuation lines
More Info
1. Indentation style guide
2. Tabs or Spaces?
3. Official docs on indentation
in the created message it creates a button to create a channel
and in the created channel it sends a message with a button to close the ticket

?
can you see now?
^
Sry gtg
I need a username of the person who interacted
not the ones who used the command
How to send the button interaction privately?
@commands.command()
@commands.has_permissions(ban_members=True)
async def un(self, ctx, user: discord.User):
userh = self.client.fetch_user(user)
await ctx.guild.unban(userh)
await ctx.send(f"{user.mention} has been unbanned!")```
this unban cmd is not working
Like which is having the option for “dismiss this message”
use the ephemeral kwarg
Command raised an exception: AttributeError: 'function' object has no attribute 'id'
removed that and getting this error
@slate swan?
!d discord.ui.Select
class discord.ui.Select(*, custom_id=..., placeholder=None, min_values=1, max_values=1, options=..., disabled=False, row=None)```
Represents a UI select menu.
This is usually represented as a drop down menu.
In order to get the selected items that the user has chosen, use [`Select.values`](https://discordpy.readthedocs.io/en/master/interactions/api.html#discord.ui.Select.values "discord.ui.Select.values").
New in version 2.0.
code
reaction, user = await self.bot.wait_for("reaction_add", check=check)
how can i pass custom arguments to the check?
right now there's only reaction and user, i'd like to pass another
there's probably like a really straightforward solution and i'm too dumb to find it
you can't cuz you don't even call it
@regal pulsar dm
@regal pulsar help me
class View1(View):
em1 = client.get_emoji(970556505973739540)
def __init__(self):
super().__init__(timeout=None)
@button(custom_id='3', style = '3', emoji=':1779_check:')
async def counter(self,interaction: Interaction, button: Button, ctx):
member = ctx.author
await interaction.response.send_message(await member.ban)
@button(custom_id = '2', style = '2', emoji=':1326_cross:')
async def counter1(self,interaction: Interaction, button: Button):
await interaction.response.send_message("Cancelled ban cmd")
@client.command()
@commands.has_permissions(ban_members=True)
async def ban(ctx, member : discord.Member, *, reason=None):
await ctx.send(f"Are you sure you want to ban {member.mention}", view = View1())
``` this is my code but i cant ban the user
error ^
the error says pretty much already
import disnake
from disnake.ext import commands
clientToken = ""
clientPrefix = "!"
clientIntents = disnake.Intents.default()
clientIntents.message_content = True
clientIntents.members = True
serverId = 973645962666975344
bot = commands.Bot(command_prefix = clientPrefix, intents = clientIntents)
@bot.event
async def on_ready():
print(f"{bot.user.name} | online")
# Get Server by ID
server = bot.get_guild(serverId)
# Get Member-Names in List
global memberList
memberList = []
for member in server.members:
memberList.append(member.name)
@bot.command()
async def members():
for member in memberList:
print(member)
bot.run(clientToken)```
i was trying to switch from discord.py to disnake, but i get an error that says the ctx is missing. even though i dont wanna use ctx at all. does anyone know how to fix this?
Command raised an exception: NotFound: 404 Not Found (error code: 10013): Unknown User```
how to make error for this
async def members(ctx):
and there's no way this worked in dpy
why would i add ctx to my command if I dont need it for the logic? I'll get another error!
cuz dpy/disnake passes it to you anyways
i'll get another error!
what error
I have no clue how to fix it
pass a context ~
wait wtf
@button(custom_id='3', style = '3', emoji=':1779_check:')
async def counter(self,interaction: Interaction, button: Button, ctx):
member = ctx.author
await interaction.response.send_message(await member.ban)``` why is a ctx there?
the style is also wrong, needs to be ButtonStyle or an integer
Style is in integer
its a string~
But still it works
!e print(type("3"))
@slate swan :white_check_mark: Your eval job has completed with return code 0.
<class 'str'>
well, remove ctx from that function ..
if you want the user who added that interaction use interaction.user
I just want the user to be banned on clicking the button
use the ban method either on the member, or use the guild's ban method, whats the point of sending a ban method-
!d discord.Member.ban
await ban(*, delete_message_days=1, reason=None)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Bans this member. Equivalent to [`Guild.ban()`](https://discordpy.readthedocs.io/en/master/api.html#discord.Guild.ban "discord.Guild.ban").
!d discord.Guild.ban
await ban(user, *, reason=None, delete_message_days=1)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Bans a user from the guild.
The user must meet the [`abc.Snowflake`](https://discordpy.readthedocs.io/en/master/api.html#discord.abc.Snowflake "discord.abc.Snowflake") abc.
You must have the [`ban_members`](https://discordpy.readthedocs.io/en/master/api.html#discord.Permissions.ban_members "discord.Permissions.ban_members") permission to
do this.
And how can I ping the user whom I banned?
yeah then just do await inter.guild.ban(inter.user)
python bot.py
Traceback (most recent call last):
File "bot.py", line 12, in <module>
import helpers
File "/home/runner/poketwo-6/helpers/__init__.py", line 1, in <module>
from . import checks, constants, context, converters, pagination
File "/home/runner/poketwo-6/helpers/context.py", line 5, in <module>
class ConfirmationView(discord.ui.View):
AttributeError: module 'discord' has no attribute 'ui'
exit status 1```
anyone?
mention property
how to import helpers
7. Keep discussions relevant to the channel topic. Each channel's description tells you the topic.
you have to upgrade to discord.py 2.0 to use the views.
i mean how do i mention that user after Banned
await interaction.response.send_message(await ban, content=f"Banned ")
you will have to create a followup
await ban?
what?
ok
Wtf is this shit
python bot.py
Traceback (most recent call last):
File "bot.py", line 12, in <module>
import helpers
File "/home/runner/poketwo-6/helpers/__init__.py", line 1, in <module>
from . import checks, constants, context, converters, pagination
File "/home/runner/poketwo-6/helpers/converters.py", line 5, in <module>
from durations_nlp import Duration
ModuleNotFoundError: No module named 'durations_nlp'```
how to i put this tree in my game
how can i edit an embed based on the reaction that a user adds to it?
ss
me or the other dude ;-;
u
embed
i dont have any code related to editing based on reactions, just made the bot add the ◀️ and ▶️ reaction on the embed
okay
async def ud(self, ctx, *, term):
try:
r = requests.get(f"https://api.urbandictionary.com/v0/define?term={term}").json()
except:
return await ctx.send("that word doesn't even exist what are you doing")
num = 0
definition = r["list"][num]['definition']
word = r["list"][num]['word']
example = r['list'][num]['example']
thumbsup = r['list'][num]['thumbs_up']
thumbsdown = r['list'][num]['thumbs_down']
author = r['list'][num]['author']
if '[' in example or ']' in example:
example = example.replace('[', '')
example = example.replace(']', '')
if '[' in definition or ']' in definition:
definition = definition.replace('[', '')
definition = definition.replace(']', '')
e = discord.Embed(title=word, color=discord.Color(0xf9f03b))
try:
e.add_field(name="Definition: ", value=definition, inline=False)
except:
await ctx.send("That definition is too long for me to send")
e.add_field(name="Example: ", value=f'*{example}*', inline=False)
e.add_field(name="👍", value=thumbsup, inline=True)
e.add_field(name="👎", value=thumbsdown, inline=True)
e.set_footer(text=f"Written by: {author}")
e.set_thumbnail(url='https://media.discordapp.net/attachments/960947264770150442/961946894559481957/unknown.png')
e.set_author(name=ctx.author.name, icon_url=ctx.author.avatar_url)
ms = await ctx.send(embed=e)
await ms.add_reaction("◀️")
await ms.add_reaction("▶️")```
i know requests is blocking, im gonna switch it out soon
forgot to add the num = 0 line
because i would like num to be 1 when the user clicks next and -1 vice versa
its okay i just needed that 2 last lines to see
...so how do i edit the embed based on the reactions
like page?
yes - when the num variable becomes 1 then all the values (definition, example, author, etc) will come from the next item in the array
sry can't help i don't know so much about embed i tryed to find something but cna't help i'm really sorry
anybody else mind helping - i'd like to edit an embed based on the reactions it gets
do u know how to i add some pic in my game visual studio not for discord bot like object
that pic to be object
like this i wanna to be tree object
not for discord bot
then this isn't the right channel
how to get a guild id on a on_ready event
U can't
what else can i do
what guild id do you want to get?
what's the context?
async def members(ctx)
also you should probably learn python before making this 💀
I take it you didn't actually bother to read the message they sent after
i did not
im on mobile it scrolls down when i send a message
its a required arg that it needs for the command to work
everything after can be added by you
can someone remind me of how to do this:
this is not correct i assume but it should give a idea of what I want to be done. BOTH_ROLE_IDS is a list variable
this is waht i have now if any(BOTH_ROLE_IDS) not in member._roles:
I think this may raise an error because BOTH_ROLE_IDS not in member._roles would evaluate to a boolean initially
if any(role_id not in member._roles for role_id in BOTH_ROLE_IDS):
looks good to me
you're syntax looks slightly muddled although I haven't used any discord library in a very long time so I don't really know what you are trying to do either
💀
To be honest I haven't actually used python in quite a long time
dont use discordutils
you need to get/fetch member and role
then use
member.remove_roles(role)
i have a command to mute someone, it gives a muted role and removes everything else
don't do that
how to remove everythong else
no
ok
just put mute role on top of all roles
like this muted role permissions will overwrite other ones
ohhhhh
hi
hey Sparky
@slate swan
hey 👋
the syntax ong
show full traceback
Ok wait
@commands.check(is_bot_owner)
@client.command(name="eval", aliases=["exec", "execute", "codexe"])
async def _eval(ctx, *, code):
code = clean_code(code)
local_variables = {
"discord": discord,
"commands": commands,
"bot": client,
#"Token": T,
"client": client,
"ctx": ctx,
"channel": ctx.channel,
"author": ctx.author,
"guild": ctx.guild,
"message": ctx.message,
}
stdout = io.StringIO()
try:
with contextlib.redirect_stdout(stdout):
exec(
f"async def func():\n{textwrap.indent(code, ' ')}",
local_variables,
)
obj = await local_variables["func"]()
result = f"{stdout.getvalue()}\n-- {obj}\n"
except Exception as e:
result = "".join(format_exception(e, e, e.__traceback__))
pager = Paginator(
timeout=180,
use_defaults=True,
entries=[result[i : i + 2000] for i in range(0, len(result), 2000)],
length=1,
prefix="```py\n",
suffix="```",
)
await pager.start(ctx)
@slate swan
show imports
Ok wait
Heyo, working on modifying this code to only write bans with "alt" in the reason (not words like "shalt" either). I tried to use re.find('pattern', ban.reason) to run the check, but it says that "re" has no attribute "find"
current code: ```py
import discord
from discord.ext import commands
import os, re, datetime, json
from requests import get
from dotenv import load_dotenv
just showing imports here
@client.event
async def on_ready():
print("Hello Wrold lets kick ass and Wahoo basketball")
await client.change_presence(activity=discord.Game("waba"))
try:
g = client.get_guild(507364684924452896)
await banlist(g)
except Exception as e:
print(e)
async def banlist(g):
try:
bans = await g.bans()
banids = [banentry.user.id for banentry in bans]
f = open("banlist.txt", "w")
f2 = open("banlist-formatted.txt", "w")
for id in banids:
if re.find('\balt\b', ban.reason):
f.write(str(id) + '\n')
for ban in bans:
if re.find('\balt\b', ban.reason):
f2.write("User: " + str(ban.user.name) + '/' + str(ban.user.id) + " Reason: " + str(ban.reason) + '\n')
except Exception as e:
print("Something happened" + str(e))
finally:
f.close()
f2.close()
use with open
What do you mean?
Well actually, let me rephrase, what position would it go in with open?
you have a ton of errors in imports
install those modules first
They're telling you why
module is not fouhnd
you don't have it installed it
instead of open("file")
use with open("file", "r/w") as f:
data = f.read()
Thanks!
Mm, what's the issue then?
i dont understand what you're trying to do
Basically output a list of all current guild bans
The code has worked before, the only thing being changed is the regex stuff
How it looks when ran without the regex part
how to make my bot print ist ?
Does anyone know why this does not work
how to make when ctx.author send command to bot add reaction and when ctx.author react on it bot delete message
does anyone knows a bot that gives roles to the person sitting the vc?
?
be more specific
what does "not work" mean? does the command not execute?
is "Anime_hug_gif" a list?
pls
You can easily script that yourself
I’ve already helped you with this, use add_reaction and wait_for
how to make a command which will work in a specific server with given id
Where are you sending the message?
You put all that stuff after the part where you send the message
i suppose the easiest way for a beginner would to use an if-statement at the start of the command
Im only telling you what to use, not giving completed code
k i know that for wait_for and add_reaction but i don't know next
And check if the reaction returned by wait for is the same reaction returned by add_reaction
If so, delete the message
-_-
Easy as that
i need add_reaction(<what here?>)
!d discord.Message.add_reaction
await add_reaction(emoji, /)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Adds a reaction to the message.
The emoji may be a unicode emoji or a custom guild [`Emoji`](https://discordpy.readthedocs.io/en/master/api.html#discord.Emoji "discord.Emoji")...
finnaly
I also linked you to this yesterday
Right
Remember ctx.send returns the sent message
Which you need to add a reaction to
Needs to be in a string
And that should be your first argument
It’s not gonna work just sitting there by itself
also add_reaction needs to be called on a message instance
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...
english is not my first language so i cna't understand that
It has everything you need
can't*
Sending message, adding reaction, and waiting for a reaction
@client.event
async def on_ready():
print("Hello Wrold")
await client.change_presence(activity=discord.Game("waba"))
try:
g = client.get_guild(507364684924452896)
await banlist(g)
except Exception as e:
print(e)
async def banlist(g):
try:
bans = await g.bans()
banids = [banentry.user.id for banentry in bans]
f = open("banlist.txt", "w")
f2 = open("banlist-formatted.txt", "w")
for id in banids:
if re.search('\balt\b', ban.reason):
f.write(str(id) + '\n')
for ban in bans:
if re.search('\balt\b', ban.reason):
f2.write("User: " + str(ban.user.name) + '/' + str(ban.user.id) + " Reason: " + str(ban.reason) + '\n')
except Exception as e:
print("Something happened" + str(e))
finally:
f.close()
f2.close()
``` Alright so, found out I was just stupid when using re.find instead of search because of Go, but now it's saying that: `local variable 'ban' referenced before assignment`
Do I need to define 'ban' and if so, what do I define it as?
understand but don't understand as code
Then look at the example
Looks like you’re using “ban” before the for loop in which its defined
Hmm, so how should I define it to have it come before the loop?
guys in a command how can i check that content of the second parameter?
wdym
lets say i have
@bot.command()
async def pog(ctx, poe)
how can i check the content of poe in the code?
Because right now I'm not quite sure where I'm using ban at before the for loop
it's a variable
Yes

it's a variable and i wanna something to happen if the variable had something
do you know even python basics?
No need to be rude about it
yes?
wasn't trying to be rude
@slate swan you can assume that variable always has something in it
Because if not, discordpy throws an error
Unless you specify a default value
Why not use [...]pog(ctx, *, arg) and then
if re.search('contentpattern', arg):
stuff here
But I'm a regex abuser so 
I don’t think that’s what they’re asking for
i'll explain,
the command sets a log channel and everything is right
what i wanna do is check if the logchannel argument is "None" For example and do the rest of the code, i tried stuff multiple times and yeah
Oh? My apologies
Give it a default value of “None”
Then check if that variable is none inside your code
alright, thanks
async def main():
async with bot:
async for i in (
'connect4',
'dev',
'Dev',
'economy',
'help',
'profile',
'utility',
'info',
'image',
'fun',
'SubredditFetcher',
'hangman',
):
await bot.load_extension(f'cogs.{i}')
async def main():
^
IndentationError: unexpected unindent```
how to run the cogs in main.py ?
Is forking the python discord bot , editing and creating your own bot copyright infringment or something?
Bump
show the code b4 that
there is a lot
Just asking???
@bot.command(name="lock",
brief="Locks channel(s).",
help="Lock current/all channel(s)"
)
@commands.has_permissions(manage_channels = True)
async def _lock(self, ctx, channel=None):
if ctx.guild.id == 841155872259833886:
overwrite = ctx.channel.overwrites_for(ctx.guild.default_role)
try:
if channel == None and overwrite.send_messages != False:
await ctx.channel.set_permissions(ctx.guild.default_role, send_messages = False)
await ctx.send("Locked.")
if channel == None and overwrite.send_messages == False:
await ctx.send("This channel is already locked.")
if channel == "all":
await ctx.send(f"This will **lock** *all* channels. Type `{confirm}` to confirm.")
def check(m):
return m.channel.id == ctx.channel.id and m.author.id == ctx.author.id
try:
msg = await self.bot.wait_for("message", timeout=30, check=check)
except asyncio.TimeoutError:
return await ctx.send("Time's up. Aborted.")
if msg.content.lower() != confirm:
return await ctx.send("Aborted.")
await ctx.send("Locking all channels...")
await self.send_m(ctx=ctx, check=False)
await ctx.send("Locked all channels ✅.")
you can use it as its MIT but you need to show the original license
I mean, if their license specifies that you cant edit the code, then you cant (breaking the rules)
Hello.
@paper sluice
Hi
Hey
ya i can't tell, u have some sort of indentation issue. Make sure ur indents are normal
ohk
i was thinking of a eof error but nvm
that raises a syntax error
just make your editor convert them lol
yup
amen
with flask?
No
or fastapi?
Fastapi
mhm nice
now ill wrap it
And pipelines for the api and such
lovely
Yea it’s gonna be full blown cause yes
i need to wrap the ani api and then im going to try out ursina
We decent python devs
I should after i can create it
i was thinking of making an api with flask but i dropped the idea

I made one in flask using data structures
I do too
and i learned a bit of css and html along the way with templates
I made a cool web thing with flask
!ot
Off-topic channel: #ot2-never-nester’s-nightmare
Please read our off-topic etiquette before participating in conversations.
ah nice
ash mad she dont have any cool projects
Ok yes go to an ot channel
😔
oh cool
I have enough work already, thanks
strains to relate
Ok
thats how my code structured it as well
Then why is it breaking
i have a command to add the guild id and the logschannel and im trying to make a command that pops it from the json file
Oh
idk tbh
Read the docs
use mongoDB then
SQLBolt provides a set of interactive lessons and exercises to help you learn SQL
mongoDB is trash imo
Ikr
agreed
SQL is where it’s at
Databases are good to know
Before I could even think about web dev I needed to learn databases
i meant databases generally never used them
since they are only used in real-world apps
knowing sql and html is such a good skill
same
Yes
whats to learn about html-
i guess i'll spend time doing that so
since people seriously always asked me to do when i faced issues with json db's
hm, I remember middle school, when the school taught us to create a video conferencing app with html ❤️
I learned by myself
im in second year middle school and they still teach us about inputs and outputs and python basics but our teacher doesn't know how to print("hello world")
and?
it will raise an error anyways
!e
import __hello__```
@slate swan :white_check_mark: Your eval job has completed with return code 0.
Hello world!
Ok

I've only really used sql and firebase
I like myself some firebase
Mbn
Cool school
My school teaches variable for 3 months
And they dont even teach None
Imagine the suffering im going through
that's such a relief thank you doc
can someone ping me
@regal pulsar
if you ping yourself it also works
just found out ;/
Im trying to alert the bot when the message content is less than 3 characters, how do i do this?py if message.content > 3:
len(message.content)>3
> is "more than"
oh poop, mb
<
How do I hack someone bot
You don't
i wanna make a slash command with disnake
and i want it to be
/verify username:
how do i take what the author says for username to turn it into a variable
No
a command like /verify username <username> or /veify <username>?
/verify <username>
Commonsense
?
are you using discord.py or disnake?
or other libraries?
disnake
ok
im new to slash commands
@commands.slash_command()
async def verify(self, inter, member: disnake.Member):
...
anyone know why my help cmd isnt working
from discord.ext import commands
import discord
import os
client = commands.Bot(command_prefix='-',help_command = None, intents=discord.Intents.all())
@client.event
async def on_ready():
print("bot:user ready == {0.user}".format(client))
client.remove_command("help")
@client.command(description = "Shows This Embed")
@client.group()
async def help(ctx):
if ctx.invoked_subcommand != None:
return
embed = discord.Embed(title = 'Categories', description = "Shows This Embed")
for command in client.walk_commands():
description = command.description
if not description or description is None or description == "":
description = "No description provided"
embed.add_field(name = f"-{command.name}", value = description, inline = False)
await ctx.send(embed=embed)
@help.command()
async def download(ctx):
#ill send an embed here```
@native wedge
you can't use both .command() and .group() decorator on a single command
also, you should never name your function as "help"
wait, but i dont want to be the discord username, i want it what the user says
like
/username Gamer123
Yo how to add a reaction to a message?
and then make a variable based of that
!d discord.Message.add_reaction
await add_reaction(emoji, /)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Adds a reaction to the message.
The emoji may be a unicode emoji or a custom guild [`Emoji`](https://discordpy.readthedocs.io/en/master/api.html#discord.Emoji "discord.Emoji")...
it must be a str?
@commands.slash_command()
async def verify(self, inter, username: str):
...
@supple thorn I saw ur pfp on new mr beast vid
Where
New mr beast reacts video
https://youtu.be/GjMmsEwIcl0 03 sec
Yes
See
helb
How do I handle it if after a connection interruption my Bot is still connected a channel but if you check the is_connected() method it returns false? How do I handle this case?
connection interruption as in disconnection from gateway?
well dpy should automatically handle that
from disnake import CommandInteraction
from disnake.ext.commands import Bot
import os
from private.config import token
bot = Bot()
@bot.event
async def on_ready():
print("The bot is ready!")
@bot.slash_command(
name="ping",
description="A simple ping command."
)
async def ping(inter: CommandInteraction) -> None:
await inter.send(f"Pong! {bot.latency * 1000:.2f}ms")
bot.run(token)```
my ping command doesn't appear, any help?
I've been trying to nail down the issue with the voice connection, it disconnects and does not resume when reconnected if the disconnection is more than a minute so I'm trying to troubleshoot how to make that happen and it is proving a tricky proposition
Try opening an issue in the dpy repo, its more of an internals issue
dpy or disnake? I know disnake is a fork so not sure if there is a separation of responsibilities or something or even any idea how that division works
in terms of git issues
If you're using disnake open an issue for that on https://git.disnake.dev/disnake, I'll take a look into recreating it
Will do 🙂
ideally the lib should definitely be reconnecting, so assuming I can recreate the issue that definitely needs looking into soon
you need to sync the tree for any slash command related updates
steps to recreate - start playing to a voice client, disconnect for more than a minute and reconnect, it will not resume playing after the connection is reestablished
I assume 60 seconds is the cutoff since that is the default time in dpy
but shorter interruptions it will continue playing
longer interruptions it will not
How can I make my description like this
await inter.response.send_message
I am testing implementation for a 24/7 music bot but when there is an interruption it will stop and will simply sit idle thereafter'
I have tested it repeatedly both in natural case where the internet cuts out overnight due to upgrade (I have starlink) and artificial where I manually disconnect my ethernet cable from my dev PC, both produce similar results
unless you set a specific guild it will take an hour to show up
In a List
how do i do that?
is there a limit to the amount of running views a bot can have? I have my bot in a 70k person discord server (its a ticket bot) and the close buttons stopped working after hundreds of tickets were made..
(the buttons are persistent)
Guys is this possible to make slash commands visible to members if they have certain role (I know how to do this) or if their user id is in a list??
ye
from discord.ext import tasks
@tasks.loop(minutes= 120)
async def blabla():
#Do something
@client.event
async def on_ready():
blabla.start()```

Is there a way to get a list of all the people with a specific role?
.
people= []
for i in guild.members:
if role_id in [x.id for x in i.roles]:
people.append(i)```
no
!d discord.Role.members
property members```
Returns all the members with this role.
thank you
@slate swan
nah i dont think so
from discord.ext import tasks
@tasks.loop(hours=2) ## can also do this yk
async def blabla():
#Do something
@client.event
async def on_ready():
blabla.start()
thats just calling different kwargs and you should wait_until_ready
!d discord.Role.members
property members```
Returns all the members with this role.
!d discord.ext.commands.Bot.wait_until_ready
await wait_until_ready()```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Waits until the client’s internal cache is all ready...
oh ;/
😅
Hey @coral vessel!
You either uploaded a .txt file or entered a message that was too long. Please use our paste bin instead.
my python bot won't run here the log via replit
also my bot run just fine via VS Code
https://paste.pythondiscord.com/vogupobowe
New line?
from disnake import CommandInteraction
from disnake.ext.commands import Bot
import os
from private.config import token
bot = Bot()
username = ""
@bot.event
async def on_ready():
print("The bot is ready!")
@bot.slash_command(
description="Links your Geometry Dash account to Discord"
)
async def link(inter, username: str):
await inter.response.send_message(username)
bot.run(token)```
Doesn't discord automatically disconnect bots that in the VC idling for too many hours?
im trying to make it so it replies with what the user says is username
any idea why it gives the error in the image i sent
If you’re receiving html errors in your python code, that means an API timeout
@coral vessel 
only replit shows html of that iirc
I don’t think so. They only move into afk channels if any.
Has to be that tho
Happens to my friend
not really, there could be multiple reasons but the most common is a timeout
Ah, prolly that happens only in DM calls. Since I once tried to call a friend of mine and discord disconnected me when I was on mute in the call for like 15-20 min and the other person didn't join
replit is bad, thats the error
it can be but anyways
Yea but the code can’t be causing an html error
And yea, Discord Party Mode sucks and is annoying
It does get annoying
any help?
I agree
I agree
(I havent tried it but anyways it looks annoying to the eye)
You line breaks. You know \n
i like it
Eh, it seems fun at start but I hate the effect when there is confetti on the top of the cursor when I am typing in the text bot
plain old discord typing gets boring
Lmao I just set the confetti to max lets see how annoying it can get before I turn it down to 0
les go
party mode made my client have a stroke
I think it means you need to add a description for the username parameter. I don’t use disnake so I don’t know how to do it but someone else here might
Is that new or something
its for discords 7th bday
Ngl it would have made more sense if they did it for their 10th anniversary
no
it would be better if everyone got nitro for 3months
discord won't do that
Meh discord likes feeding nitro codes to self bots via YT video
so then they get no money and they go broke
Microsoft will buy discord b4 its 10th bday
OT anyways
. also my command doesn't register
from how long have you not updated disnake?
idk but its been a while
how do i update it
pip install -U disnake and rerun the code it should work
idk where this CommandInteraction thing is coming from~
A tutorial to help you make better Discord bots.
ah, its just an alias for disnake.ApplicationCommandInteraction
😭 you are using an ancient version of python as it says
update your python, then disnake
hi guys i am creating a command and in this command when i run it it has to create a room and add the people mentioned, only it adds the user who used the command, how can i fix my code?
code (if there are spaces in the code, the translator does this):
async def real1v1 (ctx, member: discord.Member, arg, product, *, stars):
embed = discord.Embed (title = f "New realistic 1v1 wager for {arg}", description = f "** Team 1: {product} vs Team 2: {stars} **", color = discord.Color.red ())
guild = ctx.guild
member = ctx.author
member2 = ctx.author.member
admin_role = get (guild.roles, name = "RoleTestAdmin")
overwrites = {
guild.default_role: discord.PermissionOverwrite (read_messages = False),
member: discord.PermissionOverwrite (read_messages = True),
member2: discord.PermissionOverwrite (read_messages = True),
admin_role: discord.PermissionOverwrite (read_messages = True)
}
channel = await guild.create_text_channel (f'Team1-Team2 ', overwrites = overwrites)
#await channel.send (f "{product} {stars}")
embed.set_footer (text = f "{ctx.guild.name}")
await ctx.send (embed = embed)```
@native wedge py -m pip install -U disnake
im trying to code an anti-bot for my server
it sends message to the channel when user joins
but its not working when user writes the answer
num = ""
num2 = ""
@bot.event
async def on_member_join(member):
global num
global num2
num = random.randrange(1, 11)
num2 = random.randrange(1, 11)
channel = bot.get_channel(973669891284533258)
await channel.send(f"{member.mention}")
await channel.send("You have to enter the answer for access the rest of server.")
await channel.send(f"`{num} + {num2}`")
guild = member.guild
channel2 = bot.get_channel(973676840424185926)
await channel2.send(f'{member.mention} joined, now we are {guild.member_count}.')
@bot.event
async def on_message(message):
await bot.process_commands(message)
global num
global num2
if message.channel.id == 973669891284533258:
if message.content == int(num) + int(num2)
kullanici = message.author
role = discord.utils.get(kullanici.guild.roles, name="Member")
await kullanici.add_roles(role)
await message.channel.purge()
await kullanici.send("Welcome to the server")```
can sombody help me please?
class discord.Intents(**kwargs)```
Wraps up a Discord gateway intent flag.
Similar to [`Permissions`](https://discordpy.readthedocs.io/en/master/api.html#discord.Permissions "discord.Permissions"), the properties provided are two way.
You can set and retrieve individual bits using the properties as if they
were regular bools.
To construct an object you can pass keyword arguments denoting the flags
to enable or disable...
Both in developer portal and in your code?
oh
but when user answers the question it is not doing anything
(thats turkish version of code)
i think there's something to make the bot wait for a response
!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...
let me research
well i tried it
and looks like i have to use it on on_member_join part
but i cant
num = ""
num2 = ""
@bot.event
async def on_member_join(member):
global num
global num2
num = random.randrange(1, 11)
num2 = random.randrange(1, 11)
channel = bot.get_channel(973669891284533258)
await channel.send(f"{member.mention}")
await channel.send("You have to enter the answer for access the rest of server.")
await channel.send(f"`{num} + {num2}`")
def check(m):
return m.content == int(num) + int(num2) and m.channel == channel
msg = await bot.wait_for('message', check=check)
guild = member.guild
kullanici = message.author
role = discord.utils.get(kullanici.guild.roles, name="Member")
await kullanici.add_roles(role)
await message.channel.purge()
await kullanici.send("Welcome to the server")
channel2 = bot.get_channel(973676840424185926)
await channel2.send(f'{member.mention} joined, now we are {guild.member_count}.')```
because code will look like that
and message is not defined here
what should i do now @zealous jay
also thanks for helping
I guess getting the message and check if its right?
anyone know how i would retrieve a deleted message
so far i have the message id and the channel that it was in
and can i tell who has deleted it
Deleted message: {'t': 'MESSAGE_DELETE', 's': 83, 'op': 0, 'd': {'id': 'xxx', 'channel_id': 'xxx', 'guild_id': 'xxx'}}```
can i fetch the message still or is it too late once it's been deleted 🤔
Hey guys, I'm getting this error
aiohttp.client_exceptions.ClientConnectorCertificateError: Cannot connect to host discord.com:443 ssl:True [SSLCertVerificationError: (1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:997)')]
I'm on Mac, I think it's something to do with the certificate, but I'm not entirely sure how to modify this stuff on macOs
my goal is to post all the deleted messages to a dedicated channel for review purposes
i think the certs are in a package called certfi
Once it's deleted, it's to late
What do I do?
You can't make a new request to fetch it
so you would have to log all messages and go back and find it ?
Your best bet would be to make a message cache being id:object, then receiving MESSAGE_DELETE look for the ID in your cache. Otherwise use the partial object
I might be understanding you wrong though, are you just trying to get a full message object?
makes sense .. yeah i just want to be able to show the message content and maybe time and author
Welp, yea you will have to make a cache then
is the user that initiated the delete not part of the MESSAGE_DELETE ?
The person who deleted the message is not given with MESSAGE_DELETE
You'd have to fetch the auditlog, if it's None then that means the message's author deleted the message
oh, thanks, that helps
what does the partial message come from ? would that include the content?
Partial message is given in some events, not sure off the top of my head for which, except MESSAGE_DELETE, it doesn't include the content of the message
ok thanks 👍
What does this error mean
Yes it’s supposed to be in a json file
Well u need a dict
So what should I call the dict?
So what should I call the dict?
Hi how do i send some data to a discord webhook? from my script?
how can i make error handlings for slash commands? Like when someone doenst have the required permissions?
You can use an if statement to check if the user has enough perms or use try … except to catch the error
snipe command?
so could i use
try:
Code...
except Expection as e:
await ctx.send(e)```
?
That should work, although i would recommend to just check the perms
@bot.slash_command()
async def test(inter):
pass
@test.error
async def on_test_error(inter, error):
if isinstance(error, commands.MissingRequiredPermissions):
await inter.send(“No perms”)
if member.roles.cache.has('role-id-here'): //code
or if member.permissions.has(Permissions.FLAGS.ADMINISTRATOR )
it worked
np
Oh wow
Do you have message intents in your code and the dashboard turned on?
what ?
it's just that when the old version 1.7.3 everything works as I put the new one, nothing works
just for audit purposes
after installation discord.py version 2.0 bot stopped responding to commands and events. what to do?
to make up for the fact that the server audit log just says "Deleted Message"
what does sync_permissions=True do when creating the bot
do you get the on_ready event at least ?
why ? What will it give ?
it should indicate that the bot was successfully added on the gateway end
it just runs if you have a listener for that particular event
how do you those form things
the other possibility is if you have an on_message event but you dont have await bot.process_commands(message) at the end - that will prevent a lot of things from firing
@livid hinge
import discord
bot = discord.Bot()
@bot.event
async def on_ready():
print("ok")
@bot.slash_command()
async def hi(ctx):
await ctx.send(f"Hello!")```
what's the problem?!
you have a bot.run right ?
there is
does it print "ok"
yes
here I do not understand everything in general, there are no errors, but he does not respond to any command
when there was an old version 1.7.3 everything worked with the new one nothing works
do you see anything in the log when you run your command? does the slash command show up in discord
no
no to both ?
@livid hinge maybe my python version is too new ?
what ?
when you added the bot, did you do both "bot" and "application.commands" here?
i mean did you answer no to both questions above (nothing printed in console as well as slash command not showing up when you type./)
i wouldnt think that would be an issue as long as you're able to install and import it
AAAAAAAAAAAAAAAAAAAAAAA why is it not where it is not said !!?!?!?!?!?!?
this is on the Bot -> URL Generator page in the developer console for your app
@livid hinge I didn't know that
then you copy the url at the bottom and go there to get it added to your guild with these permissions
@livid hinge How to add a discord bot correctly so that everything works ??
So can I just check the boxes everywhere then ? So that everything works in case of something
thank you it worked that was the problem
how would i make smth like this
@livid hinge And for buttons and voice command, do you need some unique checkboxes when adding?
oh great 🎉
there are a number of checkboxes for voice, yeah - not sure about buttons
the most basic thing when adding a bot is which checkboxes are needed ?
which of these 100% will be needed in good operation?
thats one of them - the other is making sure you have the right "privileged intents" checked on the Bot page for reading messages, getting members' info, and presence updates, and finally passing in all the necessary intents when you create the bot.. like where you have
bot = Bot()``` you might need to do something like
```py
bot = Bot(intents=discord.Intents.all())```
also if you check the wrong boxes it will start asking for additional input values like redirect URI and webhooks and stuff
@livid hinge By the way, the bot still does not respond to events
what kind of event ?
@bot.event
async def on_message(message):
if message.author == bot.user:
return
if message.content.startswith('Hello') | message.content.startswith('hello') | message.content.startswith('Hi') | message.content.startswith('hi') | message.content.startswith('Привет') | message.content.startswith('привет') | message.content.startswith('прив') | message.content.startswith('Прив'):
await message.channel.send(random.choice(["Привет","привет","прив","Прив","Hello","hello","Hi","hi","ПОКА!!"]))```
it responded to on_ready at least, right
Earlier I asked how to get a list of all the members of a specific role and someone suggested I use
discord.Role.members```
I've been looking at this, https://discordpy.readthedocs.io/en/master/api.html#role, and I don't understand how I actually set a specific role for the bot to check. I've also tried looking things up but can't seem to find any examples relating to what I want to be done
yes
thats a case where you need the message content enabled under "privileged intents"
what's the best way to check if your bot is in a guild if you have their id?
RuntimeError: Event loop is closed```
would i have to fetch each one to check
I'm working to create a welcome bot for when new people join a server. I'm making it for a couple friends (each has their own discord server). On my test server it's easy enough to hard code the general channel's ID, but if the bot is being used on multiple servers/guilds, how do I send the welcome message to the general channel of JUST the server that has that new member?
you could do something like
is_in_guild = any(g.id == 12345 for g in bot.guilds)```
discord.Role is a class, you need to fetch a discord.Role object to access the members property
okay, i'll give that a try thanks
@livid hinge after I added what you wrote, it started showing errors
you could do so with discord.utils.get
I'm talking about this
the Intents.all() ?
role = discord.utils.get(ctx.guild.roles, id=roleId)```
this will return a discord.Role object, which you can then use to access the members property
Okay thank you very much
its going to do that if you dont have all the intents turned on from the Bot page if you use Intents.all()
looks like this
I'm not familiar with objects very much... how exactly do I incorporate this with the actual discord.Role.members line now?
role.members
look at the assigned variable name
Hello everyone
it should have logged a more useful error further up @brave forge
also perhaps take a read on https://realpython.com/python3-object-oriented-programming/
@quaint forum
Ill check it out thanks again
I noticed that my bot is too slow to load with intents, any idea how to make it run faster ?
What I mean is that on_ready takes longer to run with intents than without
I turned it on and it's still an error
RuntimeError: Event loop is closed
Exception ignored in: <function _ProactorBasePipeTransport.__del__ at 0x000002A0D0D7E310>```
change Intents.all() to Intents.default()
@livid hinge and he swears at bot.run
thats what i would expect to see if you dont have all these switches turned on
Is it possible to get a user avatar in the current guild instead of the user avatar
@livid hinge bot.run('token', intents= True)
intents dont go there, they go to the Bot constructor I think
True
and True is probably not a valid intent value
@brave forge just delete everything about intents, it seems to be causing more problems than it solves
that is , do not add auto answers to the bot ?
@livid hingestop it turns out that the bot will not be able to respond to events at all ?
it will, its just you've missed a step in developer portal
that is?
stop cross-posting, you opened a help channel and i've told you what is wrong with your code and you aren't doing what i've said
Hi how do i send some data to a discord webhook? from my script?
we're not allowed to help with projects that break TOS of discord and other products
it's a music bot
yes, a music bot which streams copyrighted music from services that have no affiliation with discord
!ytdl
Per Python Discord's Rule 5, we are unable to assist with questions related to youtube-dl, pytube, or other YouTube video downloaders, as their usage violates YouTube's Terms of Service.
For reference, this usage is covered by the following clauses in YouTube's TOS, as of 2021-03-17:
The following restrictions apply to your use of the Service. You are not allowed to:
1. access, reproduce, download, distribute, transmit, broadcast, display, sell, license, alter, modify or otherwise use any part of the Service or any Content except: (a) as specifically permitted by the Service; (b) with prior written permission from YouTube and, if applicable, the respective rights holders; or (c) as permitted by applicable law;
3. access the Service using any automated means (such as robots, botnets or scrapers) except: (a) in the case of public search engines, in accordance with YouTube’s robots.txt file; (b) with YouTube’s prior written permission; or (c) as permitted by applicable law;
9. use the Service to view or listen to Content other than for personal, non-commercial use (for example, you may not publicly screen videos or stream music from the Service)
wait what, it's against tos to scrape youtube for any data?
breaking tos whenever you watch a video with a friend in starbucks looks like 
Hey @empty kernel!
It looks like you tried to attach file type(s) that we do not allow (.pdf). We currently allow the following file types: .gif, .jpg, .jpeg, .mov, .mp4, .mpg, .png, .mp3, .wav, .ogg, .webm, .webp, .flac, .m4a, .csv, .json.
Feel free to ask in #community-meta if you think this is a mistake.
Trying to better understand discord bots. I made this diagram and I'm just looking for thoughts/feedback on major mistakes. It's more of an overview, so I'm not looking to add tons of details, just wondering if I've got the gist of it right? or where my mistakes are?
Looks about right - I do have to say you're overcomplicating it a bit
There's really nothing much to "understand" about discord bots, really
As someone new to bots, I kinda disagree, but I assume once I've spent enough time with it, then it'll be easier 🙂
What about on_message_delete() event. You pass message as an argument, get the message, message author if you need to and send it in x channel
channelID = client.get_channel(submissionChannelID)
role = discord.utils.get(channelID.guild.roles, id=winnerRoleID)
print(role)
pastWinners = role.members
print(pastWinners)```
Im trying to get all the members of a certain role, it is getting the role, but it is not printing out all the users. It prints out an empty list. Also, another thing is that it just completely ends the script. Would someone with knowledge on the subject help me out



