#discord-bots

1 messages · Page 514 of 1

gloomy coral
#

yes i do

untold token
gloomy coral
#

omg silliest error ever!!!!!!!!!

outer basalt
#

anyone familiar with subclassed dropdown and view?

gloomy coral
#

i didnt write now =datetime.now()

#

LOL

#

@untold token

upbeat otter
#

@sly hamlet convert the answer to a list first, then use random.choice on it

untold token
#

Bruh

#

Lol

untold token
#

Show your error handler

gloomy coral
#

its actually rlly full

#

i have an error logs file

#
Unclosed client session
client_session: <aiohttp.client.ClientSession object at 0x7f5f1869d850>
Unhandled exception in internal background task 'member_update'.
Traceback (most recent call last):
  File "/usr/local/lib/python3.8/dist-packages/discord/ext/tasks/__init__.py", line 101, in _loop
    await self.coro(*args, **kwargs)
  File "/root/chad/cogs/vote.py", line 34, in member_update
    dt_string = now.strftime("%-H")
NameError: name 'now' is not defined```
#

searcged for dt_string

untold token
#

Ah

upbeat otter
#

Guys, how do I see the code for @unkempt canyon bot 🥲

#

i forgot the command 🥲

untold token
#

!src

unkempt canyonBOT
upbeat otter
#

thenx

gloomy coral
#
    @tasks.loop(seconds=20)  # repeat after every 20 seconds
    async def member_update(self):
        now = datetime.now()
        dt_string = now.strftime("%-H")
        if int(dt_string) == 7:
            date = datetime.strftime(datetime.now(), "%a, %d/%m/%Y")
    
            data = [date, len(self.bot.users)]
            with open("databases/members.csv", 'a+', newline='') as csvfile:
                writer = csv.writer(csvfile)
                writer.writerow(data)

            date = datetime.strftime(datetime.now(), "%a, %d/%m/%Y")

            data = [date, len(self.bot.guilds)]
            with open("databases/servers.csv", 'a+', newline='') as csvfile:
                writer = csv.writer(csvfile)
                writer.writerow(data)

            await asyncio.sleep(3600)```
#

Why is this not making csv files and writing?

#

I checked, time is 7

rustic venture
maiden fable
#

Banned from Discord or Guild...?

rustic venture
#

guild

maiden fable
#

!d discord.Guild.bans

unkempt canyonBOT
#

await bans()```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).

Retrieves all the users that are banned from the guild as a [`list`](https://docs.python.org/3/library/stdtypes.html#list "(in Python v3.9)") of [`BanEntry`](https://discordpy.readthedocs.io/en/master/api.html#discord.BanEntry "discord.BanEntry").

You must have the [`ban_members`](https://discordpy.readthedocs.io/en/master/api.html#discord.Permissions.ban_members "discord.Permissions.ban_members") permission to get this information.
hasty iron
#

just use discord.Guild.fetch_ban

maiden fable
#

U gotta iterate through these

hasty iron
#

no you dont

maiden fable
hasty iron
#

iterating can be super slow

rustic venture
vocal plover
#

just fetching all bans can take 20 seconds for me KEKW

maiden fable
slate swan
#

you miss the () ig

rustic venture
#

how?

hasty iron
unkempt canyonBOT
#

await fetch_ban(user)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).

Retrieves the [`BanEntry`](https://discordpy.readthedocs.io/en/master/api.html#discord.BanEntry "discord.BanEntry") for a user.

You must have the [`ban_members`](https://discordpy.readthedocs.io/en/master/api.html#discord.Permissions.ban_members "discord.Permissions.ban_members") permission to get this information.
rustic venture
#

so in the (id?)

#

or empty

hasty iron
#

??

slate swan
#

user object inside the bracket

hasty iron
#

it takes in a snowflake

maiden fable
#

Or u can do discord.Object(id)

vocal plover
#

if you have a user or member available, like ctx.author, you can use that

placid skiff
maiden fable
#

How a banned user can invoke a command @vocal plover

vocal plover
#

im tired ok

maiden fable
#

Lmao

placid skiff
vocal plover
#

in theory you could be banned during the execution of a command, thus making fetch_ban(ctx.author) return a value

#

realistically it wouldnt happen but i imagine at the scale of dyno, for example, it has happened a few times

slate swan
#

possible if discord.Guild aint ctx.guild but a pre defined one , or anything like that

placid skiff
rustic venture
#

nahh i have userinfo and want to say Banned: True or False

discord.Guild.fetch_ban(discord.Object(id))

tawdry perch
#

how do you start a task in not cogs?

placid skiff
hasty iron
#

fetch_ban doesnt return None

#

it raises NotFound

slate swan
rustic venture
hasty iron
#

and what is an "asyncio loop"

placid skiff
tawdry perch
#

what is the correct way?

slate swan
tawdry perch
#

I'm trying to help someone to make it work in non cogs

placid skiff
#

So when it raises not found the fetch returns something? Lol

hasty iron
#

thats not an asyncio loop

#

thats just creating a task

slate swan
tawdry perch
#
self.tempm.start()
``` because this is what starts the task in cogs, but what about bot?
hasty iron
#

its still bad to do stuff inside the on_ready

hasty iron
#

even if its not a task

rustic venture
#

mhh ;D

maiden fable
slate swan
#

¯_(ツ)_/¯

hasty iron
#

an asyncio task is no different

#

it can be executed twice

tawdry perch
maiden fable
tawdry perch
#

where is that added in?

rustic venture
hasty iron
#

no

gaunt herald
#

I made discord bot in pycharm how can i keep alive it?

tawdry perch
rustic venture
maiden fable
#

Out side

#

Like u run your bot with bot.run

hasty iron
tawdry perch
#

so just task_name.start?

placid skiff
tawdry perch
brazen seal
#

no

rapid bison
#

hi

maiden fable
rustic venture
#
embed.add_field(name='Banned', value=f'{}', inline=False)

can someone say what i should write here, i want to check if the user is banned from my disc or not

dim cedar
#

can any one help me?

#

please

fair axle
#

how do i check what channel a user has used a slash command in?
(i am using the dislash module)

slate swan
#

what is the context on dislash?

fair axle
# fair axle how do i check what channel a user has used a slash command in? (i am using the ...

my code so far(does not work):

@inter_client.slash_command(guild_ids=test_guilds,
                            description="E",
                            options=[Option("E", "E", required=True)])
async def lulxdhaha(inter, question):
    channel = inter.guild.get_channel(894148199265210380)
    if channel == "[#894148199265210380](/guild/267624335836053506/channel/894148199265210380/)":
        #code here
    else:
        await inter.send("Use the bot commands channel to run this command", ephemeral=True)
waxen granite
#
    @commands.command(help = "Set welcome text.\n*PERM_NEEDED = ADMINISTRATOR*", aliases= ["swt"])
    @commands.check_any(commands.is_owner(), commands.has_permissions(administrator = True))
    async def setwelcometext(self, ctx, *, text = None):
        guild = str(ctx.guild.id)
        try:
            welcomechannel = self.Welcome[guild]
        except KeyError:
            welcomechannel = {}
        welcomechannel["welcome text"] = text
        self.Welcome[guild] = welcomechannel
        self.saveFile(self.Welcome, "welcome.json")
        await ctx.send(f"Welcome text set to **{text}**.")```
how do i member.mention in this text? 
and it should convert to mention the member when triggered
slate swan
fair axle
#

that?

slate swan
fair axle
slate swan
#

then define channel to the bot commands channel

fair axle
#

done

waxen granite
slate swan
#

i do but idk how i would do that too

waxen granite
#

oh

fair axle
#

@slate swan thanks that worked :)

#

bye

waxen granite
#

new question.

steel oasis
#

would this command work?

await ctx.send(embed=embed), ctx.send(embed=skywar)
steel oasis
#

Why?

maiden fable
#

U can instead use embeds

#

send(embeds=[embed, skywar])

slate swan
#
await ctx.send(embed=embed)
await ctx.send(embed=skywar)
``` this would tho
steel oasis
#

so i'd have to do

await ctx.send(embed=embed)
await ctx.send(embed=skywar)
#

alright

slate swan
maiden fable
#

Thanks for ignoring me 🥲

slate swan
#

LMAO

vocal plover
slate swan
maiden fable
slate swan
#

oh , never knew it was a thing

maiden fable
#

Haha it's okay

slate swan
#

why do i get this???????????????

#

I want to make my discord bot log every server it joins then post the invite link to my server

#

How can I do that?

valid perch
#

!d discord.on_guild_join

unkempt canyonBOT
#

discord.on_guild_join(guild)```
Called when a [`Guild`](https://discordpy.readthedocs.io/en/master/api.html#discord.Guild "discord.Guild") is either created by the [`Client`](https://discordpy.readthedocs.io/en/master/api.html#discord.Client "discord.Client") or when the [`Client`](https://discordpy.readthedocs.io/en/master/api.html#discord.Client "discord.Client") joins a guild.

This requires [`Intents.guilds`](https://discordpy.readthedocs.io/en/master/api.html#discord.Intents.guilds "discord.Intents.guilds") to be enabled.
slate swan
#

its not suggested to generate the invite link for that server tho

valid perch
#

You can take that one step further by clicking on the docs, clicking the guild it gives you and looking at how to make an invite

waxen granite
#

is there a way to save a part of the code somewhere and get it from that and continue the command?

#

when the cmd is invoked

slate swan
slate swan
#

ye

waxen granite
slate swan
#

i tried

slate swan
#

but i get warnings

#

I don't know where to start

#

oh it fixed now

#

nvm

waxen granite
slate swan
#

Oh okay

#

Thanks

placid skiff
# slate swan How can I implemented it into my code?

It is an event
How you use depends on how you declared the bot

class Bot(discord.ext.commands.Bot):
   # Your Code here

   #somewhere
   async def on_guild_join(guild)

or

my_bot = discord.ext.commands.Bot(prefix="+")

@my_bot.event:
async def on_guild_join(guild)
placid skiff
slate swan
#

yes

placid skiff
#

Weird... Run pip freeze command on your shell

slate swan
#

ok

#

ok what it did do

placid skiff
#

Write pip freeze then send

#

Paste the screen or the output here

slate swan
#

PS C:\Users\unkno\Desktop\Python Discord Bot> pip freeze
WARNING: Ignoring invalid distribution -ip (c:\python39\lib\site-packages)
absl-py==0.14.1
aiohttp==3.7.4.post0
astunparse==1.6.3
async-timeout==3.0.1
atomicwrites==1.4.0
attrs==21.2.0
backcall==0.2.0
cachetools==4.2.4
certifi==2021.5.30
chardet==4.0.0
charset-normalizer==2.0.6
clang==5.0
colorama==0.4.4
cycler==0.10.0
decorator==5.1.0
discord.py==1.7.3
flatbuffers==1.12
gast==0.4.0
google-auth==1.35.0
google-auth-oauthlib==0.4.6
google-pasta==0.2.0
grpcio==1.41.0
h5py==3.1.0
idna==3.2
iniconfig==1.1.1
ipython==7.28.0
jedi==0.18.0
keras==2.6.0
Keras-Preprocessing==1.1.2
kiwisolver==1.3.2
Markdown==3.3.4
matplotlib==3.4.3
matplotlib-inline==0.1.3
multidict==5.1.0
neat==0.4.1
numpy==1.19.5
oauthlib==3.1.1
opt-einsum==3.3.0
packaging==21.0
parso==0.8.2
pickleshare==0.7.5
Pillow==8.3.2
pluggy==1.0.0
prompt-toolkit==3.0.20
protobuf==3.18.0
py==1.10.0
pyasn1==0.4.8
pyasn1-modules==0.2.8
pygame==2.0.1
Pygments==2.10.0
pyparsing==2.4.7
pytest==6.2.5
python-dateutil==2.8.2
requests==2.26.0
requests-oauthlib==1.3.0
rsa==4.7.2
six==1.15.0
Snake==0.2
tensorboard==2.6.0
tensorboard-data-server==0.6.1
tensorboard-plugin-wit==1.8.0
tensorflow==2.6.0
tensorflow-estimator==2.6.0
termcolor==1.1.0
toml==0.10.2
torch==1.9.1
traitlets==5.1.0
typing-extensions==3.7.4.3
urllib3==1.26.7
wcwidth==0.2.5
WebOb==1.8.7
Werkzeug==2.0.1
wrapt==1.12.1
yarl==1.6.3

slate swan
#

ok

placid skiff
#

Lolz

maiden fable
#

I also got that today. It happens when incomplete uninstallation or something

slate swan
#

soooooooooo what do i do?

placid skiff
#

What you want to do?

slate swan
#

fix the error?

placid skiff
#

Are you using PyCharm IDE?

slate swan
#

i tried

#

idk im using vscode

placid skiff
#

I m not familiar, in pycharm i have a library root where i chan check all the package i have installed

placid skiff
waxen granite
#

lets say hellow welcome to server, @member if i want this to be my text

#

will this work with member obj?

placid skiff
#

Use the Event on_member_join

waxen granite
fair axle
#

oops i kinda filled the screen sorry

waxen granite
#

but i am trying to get the text for it

slow fog
#

It looks like you didn't define the reason

slate swan
fair axle
slow fog
#

oh

placid skiff
#

Your bot doesn t have permission to ban

waxen granite
#

ye but what is in some guild anyone want to mention the member in the sstart of the line. or somewhere in middle

fair axle
placid skiff
#

Check better and rerun your code

fair axle
#

aaaaaaahhhhhh

waxen granite
placid skiff
dim cedar
#

can anyone help me?

waxen granite
placid skiff
#

What is this text?

hasty iron
#

have like

#

uh

#

ill give an example

#

!e ```py
text = 'hello {member}
print(text.format(member="me"))

#

oops

#

!e ```py
text = 'hello {member}'
print(text.format(member="me"))

unkempt canyonBOT
#

@hasty iron :white_check_mark: Your eval job has completed with return code 0.

hello me
hasty iron
#

like that

placid skiff
#

Exactly

slate swan
#

How tf do I make a discord invite

dim cedar
waxen granite
#

so i can replace me with f"{member.mention}"?

#

that should work

hasty iron
#

?

#

do you get the example or no

waxen granite
#

yes

hasty iron
#

i used format, not an fstring

#

you're going to make people input text like that text in the example

slate swan
#

Please help

hasty iron
#

when somebody joins, grab the text and call format on it

waxen granite
#

text.format(member=f"{member.mention}"

#

like this

hasty iron
#

why the fstring?

placid skiff
unkempt canyonBOT
#

await create_invite(*, reason=None, max_age=0, max_uses=0, temporary=False, unique=True, target_type=None, target_user=None, target_application_id=None)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).

Creates an instant invite from a text or voice channel.

You must have the [`create_instant_invite`](https://discordpy.readthedocs.io/en/master/api.html#discord.Permissions.create_instant_invite "discord.Permissions.create_instant_invite") permission to do this.
hasty iron
#

member.mention is already a string

waxen granite
#

hm

lament mesa
#

or use string.Template

#

!d string.Template

unkempt canyonBOT
#

class string.Template(template)```
The constructor takes a single argument which is the template string.
dim cedar
placid skiff
slate swan
slate swan
hasty iron
#

what

placid skiff
#

Lol just create a link yourself for your guild (click on your server -> invite -> create link -> set it permanent -> copy it)
Go to your code, create a variable invite and assign it to that link

slate swan
#

All I want it to do is make a invite then send it to my discord server

#

Every time it joins a server

dim cedar
hasty iron
placid skiff
dim cedar
dim cedar
#

pls

rustic venture
#
embed.add_field(name='Banned', value=f'{}', inline=False)

can someone say what i should write here, i want to check if the user is banned from my disc or not

slate swan
placid skiff
dim cedar
placid skiff
rustic venture
#

And How i do that? can you call me the line?

rustic venture
hasty iron
#

!d discord.Guild.fetch_ban

unkempt canyonBOT
#

await fetch_ban(user)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).

Retrieves the [`BanEntry`](https://discordpy.readthedocs.io/en/master/api.html#discord.BanEntry "discord.BanEntry") for a user.

You must have the [`ban_members`](https://discordpy.readthedocs.io/en/master/api.html#discord.Permissions.ban_members "discord.Permissions.ban_members") permission to get this information.
hasty iron
#

that raises NotFound if the user isnt banned

placid skiff
manic wing
#

!d discord.NotFound

unkempt canyonBOT
#

exception discord.NotFound(response, message)```
Exception that’s raised for when status code 404 occurs.

Subclass of [`HTTPException`](https://discordpy.readthedocs.io/en/master/api.html#discord.HTTPException "discord.HTTPException")
slate swan
#

WTF why does my bot respond to command that i never coded????????????

sweet merlin
#

how do i ban people with id?
i tried to make a anti phising bot

slate swan
#

i didnt do this

hasty iron
slate swan
#

how can i change it?

sweet merlin
hasty iron
#

you can remove it by passing help_command=None to your Bot's constructor

slate swan
#

ok

rustic venture
sweet merlin
#

help_command=None

hasty iron
rustic venture
#

öhh

rustic venture
#

no? ;D

slate swan
#

but how do i change the command not to none but to my own that is same but writes different stuff

hasty iron
terse owl
hasty iron
#

thats one of the things you should know before using dpy

slate swan
rustic venture
#

i know xd i learn but i want to finish this

sweet merlin
hasty iron
terse owl
#

@sweet merlin

rotund nova
#

how i can fix that?

placid skiff
terse owl
rustic venture
sweet merlin
#

whats the problem?

terse owl
#

I don't know

slate swan
rotund nova
placid skiff
sweet merlin
#

ya

sweet merlin
placid skiff
#

And that makes hard to help you

rotund nova
sweet merlin
dim cedar
#

can anyone help me ?

rotund nova
#
@client.command(name='apomoc')
async def suggestion(ctx, *, message=' '):
    if isinstance(ctx.channel, discord.DMChannel):
        channel = client.get_channel(894168474425917450) 
        apomoclogs = discord.Embed(title="Potrzebna pomoc!", description=f"Informacje o graczu:\nNazwa użytkownika: {ctx.author.mention}\nID: {ctx.author.id}\nProblem: {message}")
        apomocthx = discord.Embed(title=f"Dziękujemy {ctx.author}!", description="Dziękujemy, że pomagasz nam w rozwinięciu serwera NightCity.pl! Jeżeli masz problem, a musisz załączyć zdjęcia to pisz do naszej administracji otwierając Ticket lub na wiadomości pv!", color=0x00FF00)
        await channel.send(embed=apomoclogs)
        await ctx.author.send(embed=apomocthx)
    else:
        await ctx.send("Zrób to w wiadomości prywatnej!")
``` bot send message player on channel
waxen granite
#

is there a way to enforce reactions by users on msg from an msg which has reactions?

rotund nova
#
        channel = client.get_channel(894168474425917450) 
dim cedar
sweet merlin
dim cedar
dim cedar
#

to see clearer

sweet merlin
# dim cedar

i think replit doesnt work with that google trans library version(?)

dim cedar
#

and the main problem is enother thing

dim cedar
sweet merlin
#

hmm i dont know sorry

waxen granite
#

how do i get all the member with a certain role?

rotund nova
#

@sweet merlin maybe u help me if u start

waxen granite
#

like .inrole @brisk nebulaame it rerturns the list of people who has rolename

sweet merlin
rotund nova
#
        await channel.send(embed=apomoc)
dim cedar
#

d!embed

#

e!embed

#

how to create a embed?

sweet merlin
#

the error thing

dim cedar
#

d!discord.embed

rotund nova
#

bot dont send embed on channel?

sweet merlin
#

oh

sweet merlin
rotund nova
#

no

placid skiff
#

I just noticed that yesterday i closed the IDE without waiting for the commit to finish 😭

dapper cobalt
unkempt canyonBOT
#

class discord.Embed(*, colour=Embed.Empty, color=Embed.Empty, title=Embed.Empty, type='rich', url=Embed.Empty, description=Embed.Empty, timestamp=None)```
Represents a Discord embed.

len(x) Returns the total size of the embed. Useful for checking if it’s within the 6000 character limit.

bool(b) Returns whether the embed has any data set.

New in version 2.0.

Certain properties return an `EmbedProxy`, a type that acts similar to a regular [`dict`](https://docs.python.org/3/library/stdtypes.html#dict "(in Python v3.9)") except using dotted access, e.g. `embed.author.icon_url`. If the attribute is invalid or empty, then a special sentinel value is returned, [`Embed.Empty`](https://discordpy.readthedocs.io/en/master/api.html#discord.Embed.Empty "discord.Embed.Empty").

For ease of use, all parameters that expect a [`str`](https://docs.python.org/3/library/stdtypes.html#str "(in Python v3.9)") are implicitly casted to [`str`](https://docs.python.org/3/library/stdtypes.html#str "(in Python v3.9)") for you.
dapper cobalt
sweet merlin
rotund nova
#

...

slate swan
#

i put it at start

placid skiff
#

Paste the code

slate swan
#
import discord
from discord.ext import commands
bot = commands.Bot(command_prefix='z')

help_command=None

@bot.command()
async def hello(ctx):
    await ctx.reply('Hello!')



@bot.command()
async def HMAAW(ctx, *args):
    await ctx.send('{} arguments: {}'.format(len(args), ', '.join(args)))


@bot.command()
async def SendMessage(ctx, *, arg):
    await ctx.send(arg)


@bot.command()
async def ReplyToMe(ctx, *, arg):
    await ctx.reply(arg)




@bot.command()
async def Help(ctx):
    await ctx.reply(
    "1. command = hello"
    "2. command = HMAAW"
    "3. command = SendMessage"
   "4. command = ReplyToMe")



bot.run('my token here')
sweet merlin
#

there is something error in your cogs birthday(?)

placid skiff
sweet merlin
slate swan
#

oh

#

ty

#

thanks

dapper cobalt
#

May I ask you, how long have you been using Python?

#

The cog is not loaded.

#

!d discord.ext.commands.Bot.load_extension

unkempt canyonBOT
#

load_extension(name, *, package=None)```
Loads an extension.

An extension is a python module that contains commands, cogs, or listeners.

An extension must have a global function, `setup` defined as the entry point on what to do when the extension is loaded. This entry point must have a single argument, the `bot`.
sweet merlin
dapper cobalt
#

bot.unload_extension tried to unload an extension that was never loaded.

#

One moment.

unkempt canyonBOT
#

cogs/cog_manage.py line 42

await asyncio.sleep(0.5)```
hasty iron
unkempt canyonBOT
#

cogs/cog_manage.py line 64

value=e```
dapper cobalt
hasty iron
#

then that defeats the whole point of sending it

dapper cobalt
dapper cobalt
#

The code was made by me for me, but I decided to make this public repo. Though, it was mainly feeding my needs since my PC isn't very good at handling switching from tab to tab the whole time, so I couldn't really switch from Discord, to the host's console on the browser, to my IDE.

hasty iron
dapper cobalt
#

Btw, I've got a question. Do you know how to make it send the full traceback? I've tried to find a solution for quite a while but couldn't find any.

hasty iron
#

you can use traceback.format_exception

dapper cobalt
#

e.format_exception?

hasty iron
#

!d traceback.format_exception

unkempt canyonBOT
#

traceback.format_exception(exc, /, [value, tb, ]limit=None, chain=True)```
Format a stack trace and the exception information. The arguments have the same meaning as the corresponding arguments to [`print_exception()`](https://docs.python.org/3.10/library/traceback.html#traceback.print_exception "traceback.print_exception"). The return value is a list of strings, each ending in a newline and some containing internal newlines. When these lines are concatenated and printed, exactly the same text is printed as does [`print_exception()`](https://docs.python.org/3.10/library/traceback.html#traceback.print_exception "traceback.print_exception").

Changed in version 3.5: The *etype* argument is ignored and inferred from the type of *value*.

Changed in version 3.10: This function’s behavior and signature were modified to match [`print_exception()`](https://docs.python.org/3.10/library/traceback.html#traceback.print_exception "traceback.print_exception").
cinder horizon
#

how do i get the bot to add a member.mention for a discord.Embed title or footer?

dapper cobalt
#

I've seen this before, and kept asking my self what am I going to define traceback as, or is it already defined somehow.

hasty iron
#

you do traceback.format_exception(type(e), e, e.__traceback__)

cinder horizon
dapper cobalt
#

Embed titles and footers don't take any markdown or mentions.

cinder horizon
hasty iron
dapper cobalt
dapper cobalt
ripe jackal
#

Hello, please someone help me. I want to make the command when user find a bug, to type ".bug", then the bot to send himPlease explain the bug, then he need to explain the bug, after that the bot needs to send him Please provide pictures/videos of this bug and the user needs to send picture/video. But the problem here is that the bot does not understand it and don't send it. This is the code: ```python
@client.command()
async def bug(ctx, desc=None, rep=None):
user = ctx.author

await ctx.author.send('Please explain the bug')
responseDesc = await client.wait_for('message', check=lambda message: message.author == ctx.author, timeout=300)
description = responseDesc.content

await ctx.author.send('Please provide pictures/videos of this bug')
responseRep = await client.wait_for('message', check=lambda message: message.author == ctx.author, timeout=300)
replicate = responseRep.content

embed = discord.Embed(title='Bug Report', color=discord.Color.green())
embed.add_field(name='Description', value=description, inline=False)
embed.set_image(name='Replicate', value=replicate, inline=True)
embed.add_field(name='Reported By', value=user, inline=True)

adminBug = client.get_channel(892013869088788490)
msg = await adminBug.send(embed=embed)
await msg.add_reaction(":white_check_mark:")```
#

and this is the error discord.ext.commands.errors.CommandInvokeError: Command raised an exception: TypeError: set_image() got an unexpected keyword argument 'name'

dapper cobalt
unkempt canyonBOT
#

set_image(*, url)```
Sets the image for the embed content.

This function returns the class instance to allow for fluent-style chaining.

Changed in version 1.4: Passing [`Empty`](https://discordpy.readthedocs.io/en/master/api.html#discord.Embed.Empty "discord.Embed.Empty") removes the image.
ripe jackal
#

but how do i add the name then?

hasty iron
#

the name of what to what?

#

also replicate = responseRep.content this wont work for images/videos

#

you'll need to look at Message.attachments

dim cedar
#

hey how to use subproccess to instal any module?

ripe jackal
slate swan
#

you cant

waxen granite
#

is there a way to get a list of loaded and unloaded cogs?

dim cedar
ripe jackal
#

thanks, i will try to see what i can do

slate swan
#

i was talking to yxrdanoww_#9953

ripe jackal
dim cedar
#

how to use subproccess to instal any module?

slate swan
#

holy fak the pings

dapper cobalt
#

!e

import traceback
names = [1, 2]
try:
  print(names[5])
except Exception as e:
  print("\n".join(traceback.format_exception(type(e), e, e.__traceback__)))
unkempt canyonBOT
#

@dapper cobalt :white_check_mark: Your eval job has completed with return code 0.

001 | Traceback (most recent call last):
002 | 
003 |   File "<string>", line 4, in <module>
004 | 
005 | IndexError: list index out of range
cinder horizon
#
message = ctx.channel.get_message(<msg.id>)
```OR
```py
message = bot.get_message(894180307878707200)
```?
dapper cobalt
#

@hasty iron Got it, thanks! scoopy_dance

hasty iron
#

!d discord.TextChannel.get_partial_message

unkempt canyonBOT
#

get_partial_message(message_id, /)```
Creates a [`PartialMessage`](https://discordpy.readthedocs.io/en/master/api.html#discord.PartialMessage "discord.PartialMessage") from the message ID.

This is useful if you want to work with a message and only have its ID without doing an unnecessary API call.

New in version 1.6.
heavy radish
#

Heyy, I equalited it to None but it still requires a role

boreal ravine
cinder horizon
solar pike
hasty iron
#

await it

solar pike
#

i did

slate swan
#

i don't understand.. eng,py,dicobot...

#

oMG

solar pike
#

🤣

hasty iron
night bear
#

show the full code would be better to point out what’s wrong

solar pike
#

amm like the cmd is in main py so if one enters the cmd it goes to other py to run it

slate swan
#

으아각!

#

모르게써!

solar pike
#

that is not happning

solar pike
slate swan
#

번역해서 idont under stand....

solar pike
#

k

manic wing
#

then you haven’t looked hard emptying

#

enough*

#

you need to do async def _balance

river kindle
#

hey guys, I'm trying to create an "anti ping" command for example if I get pinged 3 times or more the bot deletes the message

this is the code, but it does not work

massping = 3
  
@ client.event
async def on_ping (ctx, message, massping):
  if message.content.startswith ('@ ₪ • LovesCoding', +3):
    await ctx.send (f "Hey {member.mention} Don't mess with the owner.")
    await ctx.message_delete ()```
manic wing
#

you’re essentially defoning it twice

#

name is like an alias

boreal ravine
#

@slate swan jeez korean

slate swan
#

yes

boreal ravine
#

prooo

slate swan
#

im korean

boreal ravine
#

hm

heavy radish
#
  File "/home/runner/My-BOT/COGs/help.py", line 16, in mga
    channel = commands.get_channel(890186572501250098)
AttributeError: module 'discord.ext.commands' has no attribute 'get_channel
``` ??
#

Anyone help

slate swan
#

try setting name to something except "balance"

manic wing
heavy radish
#

I can't use Bot as its a cog

#

or can I?

valid perch
#

ctx.bot 🤷‍♂️

#

You can also pass arguments and store bot as a variable on the class

heavy radish
#

Yeaaa

valid perch
slate swan
#

dope

half briar
#
sc = FFmpegPCMAudio("audio.mp3")
    voi = vc.play(sc)```
#

Bot not play audio

#

Why

runic hull
#

hello everyone idk if its disocrd.py or just py but i would like my code to create a file, send it in dm with my bot and then take data from another file to put it in the one that was created

slate swan
#

how to know if a message sender is a user

#

and not a bot

#

can someone help me out?

manic wing
#

returns bool

#

!d discord.Member.bot

unkempt canyonBOT
#

property bot```
Equivalent to [`User.bot`](https://discordpy.readthedocs.io/en/master/api.html#discord.User.bot "discord.User.bot")
placid skiff
warm flame
#

guys is there a way for me to add spaces inbetween?

#

its to pact in

valid niche
warm flame
valid niche
#

u\200b is a ZWS

#

And \n is newline

warm flame
#

i dont think that works with fields

valid niche
#

Why not?

#

Have you tried it?

warm flame
#

because you cant put an empty value in fields

valid niche
#

ZWS isn’t an empty value

warm flame
#

what are those

valid niche
#

u\200b

warm flame
#

both

valid niche
#

As I already said before

valid niche
#

It’s a zero width space

warm flame
#

and how u use them?

valid niche
#

u\200b

#

That’s literally what you write

warm flame
#

in the value?

#

or name?

placid skiff
#

in the print (or send) just write u/ and the value

valid niche
#

Wherever you need to have an empty bit

#

And I already told you where to put it

placid skiff
#

It's the escape to write utf-8 characters

warm flame
placid skiff
#

...

valid niche
warm flame
#

in the value or name???

placid skiff
#

It depends on you

valid niche
#

Wherever you want your enter to be

placid skiff
#

It can go wherever you wamt

warm flame
#

bro ive been coding for 3 hours my brain isnt working anymore

placid skiff
#

Want*

valid niche
warm flame
#

deadline moment

valid niche
#

If your brain is mush no matter what you aren’t going to make sensible code

valid niche
#

Because that should never be the case

warm flame
#

no i had a deadline for smth else

slate swan
#

whats the best free python app or website on phone?

warm flame
warm flame
#

so like this?

sweet pilot
#

is there an event to subscribe for getting users that who accept the terms for a server

valid niche
warm flame
#

aight

placid skiff
#

Embeds.set_thumbnail(url)

dapper cobalt
#

!d discord.Embed.set_image

unkempt canyonBOT
#

set_image(*, url)```
Sets the image for the embed content.

This function returns the class instance to allow for fluent-style chaining.

Changed in version 1.4: Passing [`Empty`](https://discordpy.readthedocs.io/en/master/api.html#discord.Embed.Empty "discord.Embed.Empty") removes the image.
valid niche
hasty iron
#

ok

placid skiff
lilac latch
#

Hey I wanna ask how to restrict the bot to dms only or server only?

placid skiff
valid niche
sweet pilot
# hasty iron no

so how can I make a autorole bot? (except trying to add the role forever)

slate swan
#

how can a bot send a embed
i meant like
if somebody sent a embed message the bot should send the same

#

like in a on_message but message.content is a embed and i want it to resend it

sweet pilot
#

!d discord.Message.embeds

unkempt canyonBOT
hasty iron
dull wren
#

does anyone know why my discord desktop icon become like this.

grand anvil
#

any ideas on how to make a music bot which doesn't have to download the music file before playing it?

#

like stream from YT

sweet pilot
#

assign a role to them

valid niche
sweet pilot
#

not reaction role

hasty iron
#

then on_member_join

gloomy coral
#

guys pls help me

valid niche
hasty iron
#

!ytdl

unkempt canyonBOT
#

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)
sweet pilot
#

I tried that. but it doesn't assign the role until the member accepts the terms or something

grand anvil
hasty iron
#

nope

grand anvil
#

spotify isn't against TOS right?

gloomy coral
#

Can sm1 help me PLEASE

hasty iron
#

its against their tos too

gloomy coral
gloomy coral
#

this is my code

grand anvil
#

then why is there an API

hasty iron
valid niche
slate swan
#

on_message, message.content (can message.content that is embed be resended?

hasty iron
#

API is for fetching data

#

not playing music

valid niche
grand anvil
hasty iron
#

huh?

#

you said streaming music

#

streaming music is against their tos

grand anvil
valid niche
hasty iron
grand anvil
lilac latch
#

Pfft

slate swan
hasty iron
#

fetching data != streaming music

grand anvil
manic wing
#

!d discord.ext.commands.guild_only

unkempt canyonBOT
#

@discord.ext.commands.guild_only()```
A [`check()`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.check "discord.ext.commands.check") that indicates this command must only be used in a guild context only. Basically, no private messages are allowed when using the command.

This check raises a special exception, [`NoPrivateMessage`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.NoPrivateMessage "discord.ext.commands.NoPrivateMessage") that is inherited from [`CheckFailure`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.CheckFailure "discord.ext.commands.CheckFailure").
grand anvil
#

what if I wanted to play NCS music

valid niche
# grand anvil hmm....

It clearly says if you have written permission from the service provider for exactly what you are doing you are allowed to use it

grand anvil
#

how would I do that

lilac latch
valid niche
grand anvil
valid niche
#

Which most likely is a no because it’s impossible to get it because the API bypasses ads

lilac latch
grand anvil
#

ouch Music bots dead for real

valid niche
hasty iron
#

there isnt an api for streaming music

valid niche
hasty iron
#

their api is a data api

lilac latch
#

Spotify?

grand anvil
#

well I'm gonna run the bot only on 1 server

valid niche
valid niche
grand anvil
#

and it isn't gonna cause a lot of traffic diversion from YT

lilac latch
hasty iron
valid niche
gloomy coral
#

i got ignored

#

so imma ask again

#

https://paste.pythondiscord.com/erufotiloq.py

This is my code....

and i keep getting error

Task exception was never retrieved
future: <Task finished name='Task-442' coro=<Loop._loop() done, defined at /usr/local/lib/python3.8/dist-packages/discord/ext/tasks/__init__.py:88> exception=UnboundLocalError("local variable 'date' referenced before assignment")>
Traceback (most recent call last):
  File "/usr/local/lib/python3.8/dist-packages/discord/ext/tasks/__init__.py", line 125, in _loop
    raise exc
  File "/usr/local/lib/python3.8/dist-packages/discord/ext/tasks/__init__.py", line 101, in _loop
    await self.coro(*args, **kwargs)
  File "/root/chad/cogs/vote.py", line 39, in member_update
    with open("databases/members.csv", 'a+', newline='') as csvfile:
UnboundLocalError: local variable 'date' referenced before assignment
Unclosed client session
client_session: <aiohttp.client.ClientSession object at 0x7f76ea3547c0>
hasty iron
rustic venture
#
fetch_ban() missing 2 required positional arguments: 'self' and 'user' 
valid niche
ocean steeple
#

some people told me discord will stop supporting discord.py

unkempt canyonBOT
#

await fetch_ban(user)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).

Retrieves the [`BanEntry`](https://discordpy.readthedocs.io/en/master/api.html#discord.BanEntry "discord.BanEntry") for a user.

You must have the [`ban_members`](https://discordpy.readthedocs.io/en/master/api.html#discord.Permissions.ban_members "discord.Permissions.ban_members") permission to get this information.
ocean steeple
#

and i think that is massive 🧢

hasty iron
manic wing
ocean steeple
manic wing
#

discord.py isnt supported by discord - anyone can access the api

manic wing
lilac latch
brazen raft
#

@ocean steeple discord.py is now unmaintained and will not receive future updates anymore, you should move to a fork or find a different library

hasty iron
#

because all forks are shit

brazen raft
#

until April

hasty iron
#

for verified bots

lilac latch
brazen raft
#

try hikari

brazen raft
#

or something

ocean steeple
#

bye

rustic venture
lilac latch
valid niche
hasty iron
valid niche
rustic venture
brazen raft
gloomy coral
hasty iron
#

you cant pass in an id

brazen raft
#

And it's a coroutine so you need to await it

hasty iron
#

you need to pass in a snowflake

brazen raft
#

Don't IDs work?

valid niche
hasty iron
#

you cant pass them directly

valid niche
# gloomy coral r u sure?

Well it says unbound local variable date, and there is no date in your code, only date1 and date2 etc

brazen raft
#

Well then how are you supposed to get a user object from a guild that doesn't include them as members anymore?

unkempt canyonBOT
#
Noooooo!!

No documentation found for the requested symbol.

valid niche
#

Whoops one second

gloomy coral
#

im running it in a vultr vps idk whats happening

valid niche
#

!d discord.Guild.fetch_ban

unkempt canyonBOT
#

await fetch_ban(user)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).

Retrieves the [`BanEntry`](https://discordpy.readthedocs.io/en/master/api.html#discord.BanEntry "discord.BanEntry") for a user.

You must have the [`ban_members`](https://discordpy.readthedocs.io/en/master/api.html#discord.Permissions.ban_members "discord.Permissions.ban_members") permission to get this information.
valid niche
#

And

#

!d discord.Guild.bans

unkempt canyonBOT
#

await bans()```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).

Retrieves all the users that are banned from the guild as a [`list`](https://docs.python.org/3/library/stdtypes.html#list "(in Python v3.9)") of [`BanEntry`](https://discordpy.readthedocs.io/en/master/api.html#discord.BanEntry "discord.BanEntry").

You must have the [`ban_members`](https://discordpy.readthedocs.io/en/master/api.html#discord.Permissions.ban_members "discord.Permissions.ban_members") permission to get this information.
valid niche
#

@brazen raft

valid niche
brazen raft
#

Tbh you can just use bot.fetch_user and then guild.fetch_ban from it

valid niche
#

Look at the traceback it will tell you where it’s coming from

gloomy coral
#

its complicated

#

but now it works so that is that

hasty iron
sweet pilot
#

but it bypasses the rules acceptance

#

anyone know how to wait until the member accepts the rules?

slate swan
#

@valid niche

#

you are not getting me mate

valid niche
#

Unless discord is being funky again

sweet pilot
#

it does trigger on_member_join event and it lets the role to be added to the user

#

I checked the logs

valid niche
#

Oh that, well if they don’t accept they get kicked of the server

#

It’s just a discord quirk nothing to do about

#

The thing is only rendered on the client side and even closing discord and opening it again would bypass it I guess

sweet pilot
#

didn't know abt that

#

intresting

valid niche
#

Also don’t see it as a system where it will physically stop people from breaking the rules, it’s just like a terms and conditions thing when you sign up on a website

#

No one actually reads them and just clicks okay

#

Even if it includes selling your first born to the author so they can make a ritual sacrifice

sweet pilot
#

yeah

#

you must be like 40y old 😂

valid niche
#

I’m not even 20

sweet pilot
#

lol

#

nvm

floral jacinth
#

what is the limit of letters in embed messages?

slate swan
#

6k

valid niche
#

@floral jacinth

#

Read this

floral jacinth
#

thx

valid niche
rotund nova
hasty iron
#

no we dont know how to fix "that"

#

what even is "that"

slate swan
#

send error

cinder horizon
#

how do i get the number of text channels and voice channels separate?

lament mesa
#

!d discord.Guild.text_channels

unkempt canyonBOT
#

property text_channels: List[discord.channel.TextChannel]```
A list of text channels that belongs to this guild.

This is sorted by the position and are in UI order from top to bottom.
lament mesa
#

!d discord.Guild.voice_channels

unkempt canyonBOT
#

property voice_channels: List[discord.channel.VoiceChannel]```
A list of voice channels that belongs to this guild.

This is sorted by the position and are in UI order from top to bottom.
floral jacinth
#

how i remove field from embed?

cinder horizon
atomic topaz
#

I'm trying to make my bot send message when someone joins the server

here's what I did

@bot.event
async def on_member_join(member):
  await bot.get_channel(891126692494577685).send(f"{member.name} has joined.")

idk why this isn't working

hasty iron
#

error?

slate swan
#

did you enable intents?

atomic topaz
valid niche
unkempt canyonBOT
#

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.

slate swan
#

then do it

atomic topaz
floral jacinth
valid niche
#

on_member_join is priviledged to the members intent

valid niche
unkempt canyonBOT
#

remove_field(index)```
Removes a field at a specified index.

If the index is invalid or out of bounds then the error is silently swallowed.

Note

When deleting a field by index, the index of the other fields shift to fill the gap just like a regular list.
slate swan
#

embed.set_image(url = ...)

hasty iron
#

think about it

#

yes here retStr = str(

atomic topaz
cinder horizon
#
128
7
153
```these r wt m getting.....and ik my math...
final iron
#

Send the code

leaden anvil
#

Ok I want to try a command again but it doesn't seem to work ? py @client.group(invoke_without_command=True) async def feedback(ctx, *, text = None): try: text = text.split("#") report=discord.Embed(color=0xfff868) report.add_field(name='Pending Confirmation', value=f"{text[1]} #Tittle \r {text[2]} #Description") await ctx.channel.send(embed=report,components=[[Button(style=ButtonStyle.red, label="Discard", custom_id="n"), Button(style=ButtonStyle.green, label="Send", custom_id="y")]]) except: await ctx.reply("Please enter `/feedback format` to check how to format.")

hasty iron
#

categories count towards channels

cinder horizon
#

oh

#

now tht makes sense

#

thenks

sly hamlet
#
 Ignoring exception in command halloween2:
Traceback (most recent call last):
  File "C:\Users\culan\AppData\Local\Programs\Python\Python39\lib\site-packages\discord\ext\commands\core.py", line 167, in wrapped
    ret = await coro(*args, **kwargs)
  File "C:\Users\culan\OneDrive\Desktop\echo\cogs\pic.py", line 16, in halloween2
    json_dict = json.load(f)
  File "C:\Users\culan\AppData\Local\Programs\Python\Python39\lib\json\__init__.py", line 293, in load
    return loads(fp.read(),
  File "C:\Users\culan\AppData\Local\Programs\Python\Python39\lib\json\__init__.py", line 346, in loads
    return _default_decoder.decode(s)
  File "C:\Users\culan\AppData\Local\Programs\Python\Python39\lib\json\decoder.py", line 337, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "C:\Users\culan\AppData\Local\Programs\Python\Python39\lib\json\decoder.py", line 353, in raw_decode
    obj, end = self.scan_once(s, idx)
json.decoder.JSONDecodeError: Expecting ',' delimiter: line 4 column 5 (char 57)

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "C:\Users\culan\AppData\Local\Programs\Python\Python39\lib\site-packages\discord\ext\commands\bot.py", line 994, in invoke
    await ctx.command.invoke(ctx)
  File "C:\Users\culan\AppData\Local\Programs\Python\Python39\lib\site-packages\discord\ext\commands\core.py", line 894, in invoke
    await injected(*ctx.args, **ctx.kwargs)
  File "C:\Users\culan\AppData\Local\Programs\Python\Python39\lib\site-packages\discord\ext\commands\core.py", line 176, in wrapped
    raise CommandInvokeError(exc) from exc
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: JSONDecodeError: Expecting ',' delimiter: line 4 column 5 (char 57) 
``` I'm not exactly sure what's going on here can anyone help here's the full file in this link
https://hastebin.com/oqejipucow.json
cinder horizon
#
embed.set_image(url = "https://cdn.discordapp.com/attachments/846054799204024340/893964109710770227/image0.png")
leaden anvil
final iron
#

Url needs to be a string iirc

sly hamlet
leaden anvil
#

is it a json file

sly hamlet
#

Yes

placid skiff
#

To send an image that is saved locally i use the path url to that image?

leaden anvil
sly hamlet
#
    @commands.command()
    async def halloween3(self, ctx):
      with open("json/halloween.json", "r") as f:
        json_dict = json.load(f)
      answer = random.choice(json_dict['Things'])
      author = ctx.message.author
      em = discord.Embed(title="", description="", color=0x050505)
      em.set_image(url=(answer))
      em.set_footer(text=f"Echo discord bot")
      await ctx.send(embed=em)```
#

Any command I sent through that file regardless of the command has that error

slate swan
#

Hello is the guild.created_at is in this format?

yyyy/mm/dd

sly hamlet
leaden anvil
leaden anvil
placid skiff
unkempt canyonBOT
#
Fat chance.

No documentation found for the requested symbol.

slate swan
#

Just want the date format

#

Not type

inland kernel
#

just print it out and look for it

placid skiff
#

!d discord.Guild.created_at

unkempt canyonBOT
terse owl
#

I need script for management bot

#

Pls anyone

placid skiff
#

That's too general, what you want?

terse owl
#

Asking to me

#

@placid skiff

placid skiff
#

Asking what? Lol

terse owl
#

I need rep.lit script

dapper cobalt
midnight solstice
#

how would I send a message every hour on the hour

#

i've only used the on message event thus far

manic wing
leaden anvil
#

@sly hamlet

manic wing
rotund nova
midnight solstice
#

can you hep me understand line 2 of that

sly hamlet
leaden anvil
# sly hamlet Try running the program what do you mean

again maybe a loading error also you don't need to read the json twice so remove r from here py with open("json/halloween.json", "r") as f: it should be py with open("json/halloween.json") as f: it worked for me that way maybe it will help you too.

#

since your reading the json file here: py json_dict = json.load(f)

#

@sly hamlet

sly hamlet
#

ok

leaden anvil
sly hamlet
#

Hold on

#

🤣 eeeee no

leaden anvil
#

same error

sly hamlet
#

Ya

leaden anvil
#

so what I recommend is using py @client.command() async def halloween3(self, ctx): with open("json/halloween.json") as f: json_dict = json.load(f) answer = random.choice(json_dict['Things']) author = ctx.message.author em = discord.Embed(title="", description="", color=0x050505) em.set_image(url=(answer)) em.set_footer(text=f"Echo discord bot") await ctx.send(embed=em) client is py client = commands.Bot(command_prefix="/") maybe work ?

#

I did the same

#

@sly hamlet

sly hamlet
#

Is there anything different other than it saying client

leaden anvil
#

no but who knows maybe it will work ? @sly hamlet don't really know how to help since I didn't receive any error from my side also It could be a formatting mistake ?

sly hamlet
#

We'll see if you command to my bot uses bot and not client and it has to be something with the file because I simply met up a real quick command and it don't work

#

It is broken I'm going back to using eval that seems to work with it

leaden anvil
#

u could use eval

slate swan
sly hamlet
cinder horizon
#
elif member ==  member.bot:
``` is this ryt?
manic wing
#

no.

cinder horizon
pallid meadow
cinder horizon
#

ye

manic wing
pallid meadow
#

if so you can just do type(member)

#

yeah

manic wing
pallid meadow
#

since member.bot returns a bool

#

just do if member.bot like @manic wing said

pallid meadow
manic wing
#

got it

cinder horizon
cinder horizon
cinder horizon
#

==True:?

manic wing
#

no

cinder horizon
#

aighty it works

manic wing
#

if checks for True or False

cinder horizon
pallid meadow
#

yeah so since member.bot returns a boolean

manic wing
#

x = True if x: #same as if x == True

pallid meadow
#

so think of it as if true then do this

manic wing
#

if just checks if something is true or not

cinder horizon
manic wing
#

🤦‍♂️

cinder horizon
manic wing
#

you can remove the == True part lol

cinder horizon
#

oh oki thn

manic wing
#

literally just elif member.bot

cinder horizon
#

aighty thenks

manic wing
#

seeing as if checks for truthiness

#

!e
x = True
y = False
if x:
print("hi")
if y:
print("noo")

unkempt canyonBOT
#

@manic wing :white_check_mark: Your eval job has completed with return code 0.

hi
cinder horizon
#

ahh thenks

warm flame
#

guys how can i find a specific file using discord.py?

#

with its file name?

#

or class name

manic wing
#

do you just mean a local file

warm flame
#

yea

#

i just have the folder name

manic wing
#

like file = open(file)?

#

you can do import os print(os.listdir)

cinder horizon
#

is it possible to get the number of humans and bots separately?

warm flame
#

🤔

slate swan
#

hey
where can i learn discord py

manic wing
warm flame
#

u cant?

cinder horizon
manic wing
#

do you want all the members or all the bots

cinder horizon
warm flame
#

u add a link to it i think

#

in an embed?

manic wing
#

print(list(filter(lambda m: m.bot, ctx.guild.members))) @cinder horizon

warm flame
#

what component of an embed?

manic wing
#

that prints all the bots

#

if you want I can make it readable

cinder horizon
#

[click me]("the link here")
though it only works for embed.add_field
for title iz url

warm flame
#

a field? title? description?

manic wing
#
for k in ctx.guild.members:
      if k.bot:
            print(k)``` @cinder horizon
#

this prints all bots

slate swan
#

hey
where can i learn discord py

slate swan
#

ty

manic wing
slate swan
#

nop

#

i dont know anything about py

cinder horizon
slate swan
#

but ik some c#

manic wing
slate swan
#

oh

cinder horizon
#

u put in the text u want

manic wing
slate swan
#

hm
where can i learn c# discord
cuz i know only c#

warm flame
warm flame
slate swan
#

my bad

midnight solstice
#
def checkTime():
    # This function runs periodically every 1 second
    threading.Timer(1, checkTime).start()

    now = datetime.datetime.now()

    current_time = now.strftime("%S")
    print("Current Time =", current_time)

    if(current_time == '35'):  # check if matches with the desired time
      test()

checkTime()


async def test():

  #calculate new time delta
  now_time = datetime.datetime.now()
  GIM_RELEASE = datetime.datetime(2021, 10, 6, 10, 30, 00)
  delta = GIM_RELEASE - now_time



  await channel.message.send
cinder horizon
midnight solstice
#

what am i gettingwrong here

warm flame
#

because c# isnt really flexible

#

only good with unity

midnight solstice
#
main.py:25: RuntimeWarning: coroutine 'test' was never awaited
  test()
RuntimeWarning: Enable tracemalloc to get the object allocation traceback
#

thats the error im getting

cinder horizon
bright palm
#

Use any of those three libraries for C#

cinder horizon
#

add_field

#

....

manic wing
#
amm = 0
for k in ctx.guild.members:
      if k.bot:
            amm += 1
print(amm)``` @cinder horizon
cinder horizon
#

i mean...thaz wrong in various ways

cinder horizon
warm flame
#

i dont think thats how it works

bright palm
#

You should consider learning python first

cinder horizon
#

lemme ask you this...have you ever made a code for an embed before?...coz u r doing it waaay wrong

bright palm
#

embed.add_field(name="A Name", value="A value")

warm flame
#

i think u have to

embed.add_field(name='Invite me!', value='Click me to go to invite me', link=
``` somthing like that
#

ive never tried doing it

warm flame
#

but that would be logical

bright palm
#

No because that isn't how links work in discord

warm flame
#

lol what am i saying, since when was coding logical

cinder horizon
#

aighty thn try this

embed.add_field(name="Link", value="[Invite Me!]("put the link here")")
warm flame
#

ah i get it now

#

its kinda makes sense

#

but i still think link should be an arguement

#

to make it simpler for new coders

cinder horizon
warm flame
cinder horizon
cinder horizon
manic wing
#

unindent print(amm)

#

it will only print it once

cinder horizon
#

aighty...

warm flame
#

guys is there a way for me to create a variable that holds a file ?

cinder horizon
bright palm
#

Yes

slate swan
#
File "main.py", line 1779
    entryToAdd = await client.wait_for("message", check=lambda e: e.author == ctx.author, timeout=20)
    ^
IndentationError: unexpected indent```
#

i dont know where i messed up my indent

cinder horizon
#

neither do we?

warm flame
#

discord moment

bright palm
#

Probably where that arrow is pointing to

warm flame
#

can u send a screenshot of the line?

fervent canopy
#

this is silly

warm flame
manic wing
cinder horizon
bright palm
manic wing
#

you indented it all

#

unindent it out of the for loop

warm flame
slate swan
#

nvm i fixed it

cinder horizon
warm flame
#

guys does open(file directory) run the script?

cinder horizon
manic wing
warm flame
cinder horizon
slate swan
warm flame
#

inside the script

slate swan
#

Make an instance of the class

cinder horizon
warm flame
slate swan
#
class Test:
  pass

instance = Test()
cinder horizon
warm flame
slate swan
#

Import

warm flame
#

import 60 scripts?

manic wing
#

my question is why

slate swan
#

Didn't u say u have it in a class

warm flame
slate swan
#

Hmm

manic wing
slate swan
#

Make the folder a package then idfk

manic wing
#

why

warm flame
slate swan
#

Or just import *

warm flame
#

and making a class for each job

slate swan
#
from ... import *
``` will import everything from your file
warm flame
#

60 was an exxageration

acoustic ermine
#

it is possible to check if a user removed another users reaction in a specific channel

warm flame
#

but like around 16 classes

unkempt canyonBOT
#

discord.on_reaction_remove(reaction, user)```
Called when a message has a reaction removed from it. Similar to on\_message\_edit, if the message is not found in the internal message cache, then this event will not be called.

Note

To get the message being reacted, access it via [`Reaction.message`](https://discordpy.readthedocs.io/en/master/api.html#discord.Reaction.message "discord.Reaction.message").

This requires both [`Intents.reactions`](https://discordpy.readthedocs.io/en/master/api.html#discord.Intents.reactions "discord.Intents.reactions") and [`Intents.members`](https://discordpy.readthedocs.io/en/master/api.html#discord.Intents.members "discord.Intents.members") to be enabled.

Note

Consider using [`on_raw_reaction_remove()`](https://discordpy.readthedocs.io/en/master/api.html#discord.on_raw_reaction_remove "discord.on_raw_reaction_remove") if you need this and do not want to enable the members intent.
warm flame
#

it does

#

nvm

slate swan
#

U have 60 files in a folder and each file has a class of its own?? What

manic wing
#

also why is this in discord bots

slate swan
#

Ikr

manic wing
#
  • if you give me the code I could prob rewrite it all to 2 clean organised files
#

files*

warm flame