#discord-bots

1 messages · Page 917 of 1

narrow grail
#

and channel id or setup the channel

#

yeah

slate swan
#

Sad i was going to ask abt auditlogs but nvm i got it

honest shoal
slate swan
narrow grail
slate swan
# narrow grail yeah

then make a command that sets the channel id and the "welcome message" and store it to ur db

honest shoal
narrow grail
narrow grail
slate swan
slate swan
narrow grail
slim ibex
#

discord.Client doesn't have commands

slate swan
slate swan
honest shoal
#

🗿

slate swan
#

lol

slate swan
narrow grail
slate swan
narrow grail
slim ibex
#

..

narrow grail
#

xd

slate swan
#

ew

slate swan
slim ibex
#

good

honest shoal
narrow grail
#

I do it only for tests

slim ibex
#

sqlite

slate swan
#

or nosql db down_syndromesmile

narrow grail
#

it's my first bot

slim ibex
#

ew (was for @slate swan)

slate swan
left crater
#
        self.clear_items()
        await self.ctx.edit(view=None)
        return
``` ```
Task exception was never retrieved
future: <Task finished name='discord-ui-view-timeout-21a633582f1c4ab77ca9f402b79c0a1f' coro=<MyView.on_timeout() done, defined at C:\Users\nikit\PycharmProjects\dpamong\docs\main.py:316> exception=AttributeError("'Context' object has no attribute 'edit'")>
Traceback (most recent call last):
  File "C:\Users\nikit\PycharmProjects\dpamong\docs\main.py", line 318, in on_timeout
    await self.ctx.edit(view=None)
AttributeError: 'Context' object has no attribute 'edit'
Task exception was never retrieved
future: <Task finished name='discord-ui-view-timeout-097721d9b6fad66bd06ae94fd77f94ed' coro=<MyView.on_timeout() done, defined at C:\Users\nikit\PycharmProjects\dpamong\docs\main.py:316> exception=AttributeError("'Context' object has no attribute 'edit'")>
Traceback (most recent call last):
  File "C:\Users\nikit\PycharmProjects\dpamong\docs\main.py", line 318, in on_timeout
    await self.ctx.edit(view=None)
AttributeError: 'Context' object has no attribute 'edit'```
narrow grail
slate swan
left crater
#

if you want i can dm you the full command

slate swan
#

OMG

slim ibex
#

learn Redis then

#

its multi model.

#

im using it for my backend tech stack

slate swan
slim ibex
#

its extremely fast also

#

although mopstly used for caching, it can be a primary db

narrow grail
slim ibex
left crater
slate swan
#

You cant use `` or any other message formatting things in the footer

#

better off using "

#

ok i like that way

#

how to fix this when someone other issues command and shows the older message same thing as new message

#

when changing pages*

maiden fable
#

Uhhhh

#
msg = await ctx.send(...)
await msg.edit(...)

?

cold sonnet
#

me just seeing MR. Soop get ignored

slate swan
#

this thing updates the whole thing i think

cold sonnet
#

youtube videos 😎

slate swan
#

bro

#

i am googling the problem

#

i dont find the solution

cold sonnet
#

and what's user = member for

#

what's the issue overall

#

didn't understand your message before

slate swan
#

when i issue the inv command

#

and switch to other page

cold sonnet
#

wdym issue

slate swan
vital steeple
#

Hey im getting an error

slate swan
#

the error

vital steeple
slate swan
#

code

#

"pop_random_line1" is a string, not a function, make sure you didnt overwrite it previously

vital steeple
# slate swan code

`def pop_random_line1():
"""picks a random line from a file, then deletes the line"""
with open("Day Chair Keys.txt", "r") as file:
lines = file.readlines()

chosen_index = random.randrange(0, len(lines))
chosen_line = lines[chosen_index]

with open("Day Chair Keys.txt", "w") as file:
    del lines[chosen_index]
    file.writelines(lines)

return chosen_line

@client.command()
async def DayChair(ctx):
roles = [role.name for role in ctx.message.author.roles]
if 'Owner' in roles:
line = await pop_random_line1()
await ctx.message.reply(line)
else:
await ctx.message.reply("You don't have the permission to execute the command!")
await asyncio.sleep(5)
await ctx.send("INSTRUCTIONS WILL BE TYPED HERE")
`

vital steeple
slate swan
#

try renaming pop_random_line1() to something very unique like "ajsadoasipdas" just to completely rule out that the function is getting overwriten

#

oh

vital steeple
#

yeah lmao

slate swan
#

your using an await on a none asnync function, change "def pop_random_line1():" to "async def pop_random_line1()"

#

or just remove the await

vital steeple
normal folio
cold sonnet
#

delete that pic Aero

#

we don't wanna have ToS breaking proof

slate swan
vital steeple
#

ay @slate swan thanks for the help pal

cold sonnet
slate swan
#

kk

#

so basically when enter the command and change pages it goes everything well (shows my inv)

#

but when other user enters the same command (if he changes pages of his own msg it shows his inv)

#

and i change my page it shows other users inventory

cold sonnet
#

you should make a new View object everytime when entering the command

slate swan
#

i want to make so when someone enters the command

#

it doesnt update the old message

cold sonnet
#

show the command

slate swan
#

uh

normal folio
cold sonnet
#

why

normal folio
#

cuz no flood?

cold sonnet
#

nobody steals code here

normal folio
cold sonnet
#

especially not youtube tutorial code based on the naming

slate swan
#

i will send

#

where it might be an issue

cold sonnet
#

this doesn't show much

slate swan
#

other ones are same as em4

normal folio
slate swan
#

if name .:
name = .. 25x

cold sonnet
#

!paste

unkempt canyonBOT
#

Pasting large amounts of code

If your code is too long to fit in a codeblock in discord, you can paste your code here:
https://paste.pythondiscord.com/

After pasting your code, save it by clicking the floppy disk icon in the top right, or by typing ctrl + S. After doing that, the URL should change. Copy the URL and post it here so others can see it.

slate swan
normal folio
slate swan
#

don'tn't do this

#

Just send the code here

cold sonnet
slate swan
cold sonnet
#

why did I even think of a view

#

doesn't matter

normal folio
cold sonnet
#

page does never change

#

in your code

slate swan
#

it does

#

if i enter the command and change pages it shows mine but like if someone enters the command it shows the someone's other inventory instead of mine

cold sonnet
#

if you enter a member?

slate swan
#

uh

#

basically yeah

#

just lemme make a vid rq

cold sonnet
#

that's exactly what you coded

slate swan
#

i hope that explains

cold sonnet
#

In this video, we will learn how to make an Economy System for a Discord bot in python using discord.py (rewrite) in 2020. We make the balance and beg command in this video.

If you have any suggestions for future videos, leave it in the comments below.

Some Useful Links -

Discord Developer Portal- https://discord.com/developers
My Disco...

▶ Play video
slate swan
#

shows his instead of mine

cold sonnet
#

but it works for hypeblox

normal folio
cold sonnet
#

shut

normal folio
#

dym

slate swan
#

yea it works for him

cold sonnet
#

how's your json?

normal folio
#

It's my name

slate swan
#

but for me it shows his inv

slate swan
#

its fine but its messy

cold sonnet
#

well idk then bro

slate swan
#

but like

cold sonnet
#

watch the swastik video again 😿

slate swan
#

if he issues the command it shows his inventory for me

#

i want to make so my issued command doesnt update into his inventory

#

but when he uses it shows his

narrow grail
#

how to play an audio file?

slate swan
#

double click on .mp3 file?

junior verge
#
        if member = None
            await ctx.send("Please mention a user")
``` How do I do this in the right way?
slate swan
junior verge
#

I just did yeah

#

It's saying that when I got it

slate swan
#
if member == None:
  #ur code```
junior verge
#

ah ==

#

ty

slate swan
#

ok

junior verge
#

ok xD

slate swan
#

ok

slate swan
slate swan
normal folio
slate swan
normal folio
slate swan
#

yeah

narrow grail
junior verge
#
@commands.command()
    @commands.has_permissions(kick_members=True)
    async def ban(self, ctx, member: discord.Member, *, reason=None):
        if member == None:
            await ctx.send("Please mention a user") 
        else:

            await ctx.guild.ban(user=member, reason=reason)
            
            channel = self.client.get_channel(954837357239091260)
            embed = discord.Embed(title=f"{ctx.author.name} banned: {member.name}", description=reason)
            await channel.send(embed=embed)
            await ctx.send(f'Banned **{member.name}** for **{reason}**')
``` Should the if member maybe need to be like member: discord.Member since that is a error
normal folio
# junior verge ```py @commands.command() @commands.has_permissions(kick_members=True) a...
@commands.command()
    @commands.has_permissions(kick_members=True)
    async def ban(self, ctx, member: discord.Member = None, *, reason=None):
        if member == None:
            await ctx.send("Please mention a user") 
        else:

            await ctx.guild.ban(user=member, reason=reason)
            
            channel = self.client.get_channel(954837357239091260)
            embed = discord.Embed(title=f"{ctx.author.name} banned: {member.name}", description=reason)
            await channel.send(embed=embed)
            await ctx.send(f'Banned **{member.name}** for **{reason}**')
junior verge
#

Why?

rocky trench
#

how do I remove all specific members from a channel? like if the member has specific permissions to see a channel (not bc of his role) it removes him

slate swan
unkempt canyonBOT
#

@slate swan :white_check_mark: Your eval job has completed with return code 0.

lol
slate swan
rocky trench
#

@slate swan

#

how do I remove all specific members from a channel? like if the member has specific permissions to see a channel (not bc of his role) it removes him

slate swan
#

isnt their an attr that shows all the members that can see the channel?

slate swan
#
@client.command()
async def ping(ctx):
    await ctx.send("**Pong!**")

Anyone know why I'm getting this error:

Ignoring exception in command None:
discord.ext.commands.errors.CommandNotFound: Command "ping" is not found
#

Can you show more code?

#

Sure

#

!paste

unkempt canyonBOT
#

Pasting large amounts of code

If your code is too long to fit in a codeblock in discord, you can paste your code here:
https://paste.pythondiscord.com/

After pasting your code, save it by clicking the floppy disk icon in the top right, or by typing ctrl + S. After doing that, the URL should change. Copy the URL and post it here so others can see it.

slate swan
#

^ Use this, it's better than pasting it here.

junior verge
# normal folio ```py @commands.command() @commands.has_permissions(kick_members=True) a...

Hey how do I that in this case?

@commands.command()
    @commands.has_guild_permissions(manage_messages=True)
    async def purge(self, ctx, amount=10):
        if amount == None:
            await ctx.send("Please enter a amount")
        else:
            await ctx.channel.purge(limit=amount+1)

            channel = self.client.get_channel(954837357239091260)
            embed = discord.Embed(title=f"{ctx.author.name} purged: {ctx.channel.name}", description=f"{amount} messages were cleared")
            await channel.send(embed=embed)
            await ctx.send(f'**{ctx.author.name}** purged **{amount} messages**')
junior verge
#

I did

#

But then it doesn't purge anymore

slate swan
# slate swan ^ Use this, it's better than pasting it here.
import discord
from discord.ext import commands

client = commands.Bot(command_prefix = ";")

#OnStartPrintStatement
@client.event
async def on_ready():
    print("Connected to Discord. Your bot is online.")

#Left
@client.event
async def on_member_remove(member):
    print(f"{member} has left the server.")

#Commands
@client.command()
async def ping(ctx):
    await ctx.send("**Pong!**")

client.run("nothing to see here...")
junior verge
slate swan
#

Oh wait

slate swan
junior verge
frank tartan
#

how can i make a cmd like
!findrole <str>
and it will find the closest role to the string

slate swan
#

@slate swan Can you also please show the traceback from the error?

vital steeple
#

question. if someone miss spells "sent", i would like to get the bot it to say, Please try again invalid work, m y code is listed below

elif message.content.lower() == 'sent': await message.channel.send('Alright Perfect Please Send A ScreenShot Of Payment Being Sent. Once Done Please Write **Proof Is Sent**')

junior verge
#

Me or?

junior verge
slate swan
#

That's the only error I get

slate swan
#

But I don't think anything's wrong..

normal folio
# junior verge Hey how do I that in this case? ```py @commands.command() @commands.has_gui...
@commands.command()
    @commands.has_guild_permissions(manage_messages=True)
    async def purge(self, ctx, amount=None):
        if amount is None: #if amount == None:
            await ctx.send("Please enter a amount")
            return
        await ctx.channel.purge(limit=amount+1)

        channel = self.client.get_channel(954837357239091260)
        embed = discord.Embed(title=f"{ctx.author.name} purged: {ctx.channel.name}", description=f"{amount} messages were cleared")
        await channel.send(embed=embed)
        await ctx.send(f'**{ctx.author.name}** purged **{amount} messages**')
``` Never used cogs in my life. Basically If amount is none it just returns.
vital steeple
#

question. if someone miss spells "sent", i would like to get the bot it to say, Please try again invalid work, My code is listed below

elif message.content.lower() == 'sent': await message.channel.send('Alright Perfect Please Send A ScreenShot Of Payment Being Sent. Once Done Please Write **Proof Is Sent**')

frozen patio
#

This is an error I have not seen before, why is that?

vital steeple
#

question. if someone miss spells "sent", i would like to get the bot it to say, Please try again invalid work, My code is listed below

elif message.content.lower() == 'sent': await message.channel.send('Alright Perfect Please Send A ScreenShot Of Payment Being Sent. Once Done Please Write **Proof Is Sent**')

frozen patio
#

It has been working for a while with my code

slate swan
slate swan
junior verge
slate swan
unkempt canyonBOT
#

Pasting large amounts of code

If your code is too long to fit in a codeblock in discord, you can paste your code here:
https://paste.pythondiscord.com/

After pasting your code, save it by clicking the floppy disk icon in the top right, or by typing ctrl + S. After doing that, the URL should change. Copy the URL and post it here so others can see it.

frozen patio
slate swan
junior verge
#

I had it value = 10

#

But then the error won't work will it?

vital steeple
#

Yo

normal folio
vital steeple
#

question. if someone miss spells "sent", i would like to get the bot it to say, Please try again invalid work, My code is listed below

elif message.content.lower() == 'sent': await message.channel.send('Alright Perfect Please Send A ScreenShot Of Payment Being Sent. Once Done Please Write **Proof Is Sent**')

slate swan
#

i’m trying to make it so when a specific command is ran it changes the channel overwrites, however one of my overwrites is user and when i use it in a command i can’t use user=interaction.user, because i want to stop the user who interacted seeing the ticket.. i don’t know how to do this

slate swan
slate swan
vital steeple
#

question. if someone miss spells "sent", i would like to get the bot it to say, Please try again invalid work, My code is listed below

elif message.content.lower() == 'sent': await message.channel.send('Alright Perfect Please Send A ScreenShot Of Payment Being Sent. Once Done Please Write **Proof Is Sent**')

junior verge
# slate swan thats fine but im not sure why the error raised maybe that raised it lol
@commands.command()
    @commands.has_guild_permissions(manage_messages=True)
    async def purge(self, ctx, amount=0):
        if amount == None:
            await ctx.send("Please enter a amount")
            return
        await ctx.channel.purge(limit=amount+1)

        channel = self.client.get_channel(954837357239091260)
        embed = discord.Embed(title=f"{ctx.author.name} purged: {ctx.channel.name}", description=f"{amount} messages were cleared")
        await channel.send(embed=embed)
        await ctx.send(f'**{ctx.author.name}** purged **{amount} messages**')
``` That won't work, right?
frozen patio
junior verge
normal folio
# junior verge Hey how do I that in this case? ```py @commands.command() @commands.has_gui...
@commands.command()
    @commands.has_guild_permissions(manage_messages=True)
    async def purge(self, ctx, amount: int):
        if amount <= 0:
          return
        await ctx.channel.purge(limit=amount+1)
        channel = self.client.get_channel(954837357239091260)
        embed = discord.Embed(title=f"{ctx.author.name} purged: {ctx.channel.name}", description=f"{amount} messages were cleared")
        await channel.send(embed=embed)
        await ctx.send(f'**{ctx.author.name}** purged **{amount} messages**')
``` Maybe this will work
slate swan
junior verge
slate swan
#

so much things to make better tbh

slate swan
slate swan
slate swan
junior verge
slate swan
narrow grail
#

how to make a delay till the bot response?

junior verge
#

ah k didnt see

normal folio
junior verge
#

yep

slate swan
dull terrace
#

game coming along nicely, have sprites for dynamite and other items now. only shows explosions on non dug out land

slate swan
#

oooh

slate swan
slate swan
#

@slate swan Are you using the commands extension?

slate swan
slate swan
slate swan
#

should add hp

#

Josh, how are you running your code?

normal folio
junior verge
# slate swan amount: int = 1
@commands.command()
    @commands.has_guild_permissions(manage_messages=True)
    async def purge(self, ctx, amount = int = 1):
        if amount == None:
            await ctx.send("Please enter a amount")
            return
        await ctx.channel.purge(limit=amount+1)

        channel = self.client.get_channel(954837357239091260)
        embed = discord.Embed(title=f"{ctx.author.name} purged: {ctx.channel.name}", description=f"{amount} messages were cleared")
        await channel.send(embed=embed)
        await ctx.send(f'**{ctx.author.name}** purged **{amount} messages**')
``` How do I do that like amount = int = 1 xD
slate swan
#

Hello!

#

Who can help me?

#

timtoy take over ima take a breakAG_ChikaStunned

slate swan
slate swan
# slate swan what’s that?

How are you planning to write said command? Are you intending on using interactions or just regular message content commands?

slate swan
slate swan
#

Can i DM you?

pliant gulch
#

foo: str = "bar"

junior verge
#

like amount : int = 1

pliant gulch
#

Here, foo is hinted as str

pliant gulch
slate swan
# junior verge ```py @commands.command() @commands.has_guild_permissions(manage_messages=Tr...
@commands.command()
@commands.has_guild_permissions(manage_messages=True)
async def purge(self, ctx, amount: int = 1):
    if amount == None:
        await ctx.send("Please enter a amount")
        return
    await ctx.channel.purge(limit=amount+1)

    channel = self.client.get_channel(954837357239091260)
    embed = discord.Embed(title=f"{ctx.author.name} purged: {ctx.channel.name}", description=f"{amount} messages were cleared")
    await channel.send(embed=embed)
    await ctx.send(f'**{ctx.author.name}** purged **{amount} messages**')
slate swan
# slate swan How are you planning to write said command? Are you intending on using interacti...

well i’m just using:

@bot.command()
@commands.has_role('Other Middleman')
async def close(ctx):
    guild=bot.get_guild(879189880511557632)
    embed=discord.Embed(description=f"**Ticket has been closed**", color=discord.Colour.yellow())
    category = discord.utils.get(ctx.guild.categories, name = "CLOSED TICKETS")
    fox = guild.get_role(925444830480453644)
    await ctx.channel.edit(category = category)
    await ctx.reply(embed=embed, view=end_ticket())```
normal folio
slate swan
#

You want to use a colon to tell discord.py that you will only accept amount if it can be converted to a valid int

pliant gulch
#

The typehint only tells discord.py to cast it to int

maiden fable
#

discord? nvm u mean dpy

pliant gulch
#

Regardless if it's valid or not I'm pretty sure it tries to run

dull terrace
frozen patio
dull terrace
#

trying to think of a fun way to give visual feedback when a player teleports or uses an energy item

unkempt canyonBOT
#

Hey @slate swan!

You either uploaded a .txt file or entered a message that was too long. Please use our paste bin instead.

dull terrace
#

i was going to make a glow outline around them in different colors but its messy with cosmetics

unkempt canyonBOT
#

Hey @slate swan!

You either uploaded a .txt file or entered a message that was too long. Please use our paste bin instead.

slate swan
slate swan
dull terrace
#

50% opacity blue lines infront of the person for teleporter could work

junior verge
slate swan
slate swan
#

Can you also run python3 -m discord -v and show us the version

frozen patio
#

It says what version

#

in my console

#

3.10.2

slate swan
pliant gulch
#

That would mean you need two API calls instead of one

normal folio
pliant gulch
slate swan
#

!d discord.ext.commands.Context.reply

unkempt canyonBOT
#

await reply(content=None, **kwargs)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).

A shortcut method to [`abc.Messageable.send()`](https://discordpy.readthedocs.io/en/master/api.html#discord.abc.Messageable.send "discord.abc.Messageable.send") to reply to the [`Message`](https://discordpy.readthedocs.io/en/master/api.html#discord.Message "discord.Message").

New in version 1.6.

Changed in version 2.0: This function will now raise [`TypeError`](https://docs.python.org/3/library/exceptions.html#TypeError "(in Python v3.10)") or [`ValueError`](https://docs.python.org/3/library/exceptions.html#ValueError "(in Python v3.10)") instead of `InvalidArgument`.
slate swan
#

It replies to the message that invoked the command, are you sure you want this? Did you mean to use ctx.send() instead?

tame nymph
#

does this mean bots can join group dms

manic wing
tame nymph
normal folio
tame nymph
#

yeah

#

this can be done with Python

manic wing
tame nymph
#

are they all this "smart"?

#

good for them

manic wing
slate swan
slate swan
#

That endpoint also creates a group dm, it doesn't join one.

slate swan
#

Why they still have it documented publicly? I'm not sure.

#

Why they have it in the first place? Because regular users exist. We are allowed to create group channels.

#

lmao maybe they support Tos breakers

slate swan
pliant gulch
# tame nymph does this mean bots can join group dms

This basically means, give the bot Oauth2 scopes, to gain the access tokens, then just call this endpoint with the list of access tokens & their respective IDs. This then creates a group DM with all those user, not including the bot

slate swan
#

Before Discord implemented OAuth2 for adding bots to guilds, you had to basically scrape invite links to join guilds. It was a weird time.

pliant gulch
#

Oauth2 can preform actions like this, for an example making a member join a guild

pliant gulch
#

Well bot's can't exist in a group DM

tame nymph
#

Gotta keep up the hard work for discord to add this feature

slate swan
pliant gulch
#

Go through code grant

slate swan
#

And I completely forgot why this is publicly documented. Thanks for the refresher.

pliant gulch
#

You'd request the same way you make your bot's invite URL 😃

#

You can add scopes, such as gdm.join

slate swan
#

That one is a bit annoying I find

#

I usually cut it out of the url before accepting.

#

One time I got added to like 3 guilds

#

And got 6 automated DMs

pliant gulch
#

Oauth2 is just annoying in general

#

I refuse to read the RFC, I got tired of RFCs after reading all of websockets

slate swan
#

I mean it's not that bad

tame nymph
#

is discord planning to add bots to group dms

slate swan
#

No

tame nymph
#

we need this feature like real bad

pliant gulch
#

Strong 100% no

slate swan
#

No

tame nymph
#

why not though

slate swan
#

no

pliant gulch
#

Why need it though?

slate swan
#

Bots are meant for guilds, really.

tame nymph
#

so people in the gc can use the bot

pliant gulch
#

Just make a guild????

slate swan
#

I mean you can do more fishy stuff in DMs

narrow grail
#

how to make a delay till the bot response?

tame nymph
#

but what if you have oauth2 and deleting a guild is super annoying

slate swan
#

Besides, making a guild is now simpler than ever. It literally takes 4 clicks.

pliant gulch
#

Getting an access token is much harder than deleting a guild

tame nymph
#

true

slate swan
#

Does anyone know how I would go about seeing WHO updated a "member"

@client.event
async def on_member_update(before, after):```
narrow grail
#

how to make a delay till the bot response?

slate swan
#

You mean 2FA?

tame nymph
#

yeah

#

mb

slate swan
#

Besides you enabled 2FA, cope.

tame nymph
#

Discord forced me to enable 2FA

slate swan
#

How so?

tame nymph
#

creating teams in developer portal requires 2FA

slate swan
#

Ha that feature sucks, I'm surprised you even use it

tame nymph
#

ikr

pliant gulch
#

Haven't heard of anyone even actually using it for real

#

Last time I checked the payout system didn't even work

normal folio
slate swan
#

It's just another one of those things Discord wasted their R&D on.

#

It was your choice to moderate someone else's server.

pliant gulch
slate swan
#

Discord isn't forcing anything upon you. If 2FA is inconvenient enough, just opt out of it.

slate swan
dull terrace
#

sprite behind player after using teleporter, look okay? 🤔

slate swan
#

Wrong channel

pliant gulch
slate swan
#

jeez i can't type

#

!d asyncio.sleep

unkempt canyonBOT
#

coroutine asyncio.sleep(delay, result=None)```
Block for *delay* seconds.

If *result* is provided, it is returned to the caller when the coroutine completes.

`sleep()` always suspends the current task, allowing other tasks to run.

Setting the delay to 0 provides an optimized path to allow other tasks to run. This can be used by long-running functions to avoid blocking the event loop for the full duration of the function call.

Deprecated since version 3.8, removed in version 3.10: The `loop` parameter. This function has been implicitly getting the current running loop since 3.7. See [What’s New in 3.10’s Removed section](https://docs.python.org/3/whatsnew/3.10.html#whatsnew310-removed) for more information.

Example of coroutine displaying the current date every second for 5 seconds:
slate swan
#

@narrow grail ^

dull terrace
pliant gulch
dull terrace
#

😓

rocky trench
#

!e

print(type(discord.Role))

unkempt canyonBOT
#

@rocky trench :x: Your eval job has completed with return code 1.

001 | Traceback (most recent call last):
002 |   File "<string>", line 1, in <module>
003 | NameError: name 'discord' is not defined
rocky trench
manic wing
#

absolutely not.

slate swan
#

discord.Role is an instance of type, what are you attempting?

#

What are you trying to fix?

#

bruh

#

basically i enter command and loads my inventory then friend enters command too and loads his inventory and then when i switch pages it shows his inventory not mine

#

Good luck, your code is a pretty unholy mess to read and diagnose.

#

That's due to the fact that you're just parsing a json file

#

Use a database instead, it should make the process easier

#

how

hushed galleon
#

according to the start of your clip you do have a cookie in your second page, but regardless the likely issue is that you're using a bot variable to store the pages

slate swan
#

Oh, my bad. I was looking at the wrong code

#

Yours doesn't use JSON

hushed galleon
#

well they do

slate swan
#

ye pretty much it doesnt...

normal folio
hushed galleon
normal folio
hushed galleon
#

the likely issue is that you're using a bot variable to store the pages

hushed galleon
#

it doesnt seem necessary to have a bot var in the first place

#

define your help_pages as a regular variable and it won't get shared across commands

normal folio
normal folio
hushed galleon
#

are you using bot.help_pages anywhere else?

vital steeple
#

im getting that error

slate swan
hushed galleon
# vital steeple

it means they have their dms locked, probably so they dont get annoyed by mass DMs...

stone beacon
#

Assuming they're in your server

pliant gulch
# vital steeple

Your bot seems to facilitate cheats, and in this server we don't help with projects that break ToS

hushed galleon
stone beacon
#

oh damn , I have not the talent to read anything over 20 words

#

🗿

normal folio
robust jacinth
#

can i somehow check how many times a user has boosted the server?

hushed galleon
#

discord doesnt provide that information

royal oar
#

Does anyone know why this is happening at all? Admin perms work but otherwise everything else says invalid permissions?

manic wing
#

whats the invite link?

manic wing
#

well the permissions is wrong

royal oar
#

I used that

#

and used the url generator

manic wing
#

well you used it wrong

normal folio
royal oar
royal oar
robust jacinth
#

for example "booster bot"

normal folio
#

Did booster bot use python? Maybe.

pliant gulch
#

What does python have to do here?

#

Regardless of language the API doesn't give out that information

#

You'd need to do inconsistent ways, such as tracking system messages 😃

hushed galleon
#

does it only send out one message if you bought multiple boosts?

pliant gulch
#

I remember getting two boosts, and boosting them seperately not all together, that produced two messages

#

Maybe boosting it all together would produce one message but I'm not sure

#

Well, the only thing the role does it let you know the user has boosted

#

Not the boost number, which they were trying to get

#

That's gonna be very API Intensive

#

Also what about bot outages?

#

Then you have dead data

#

Either way discord never meant for bot's to be able to do this

#

Same thing with invite tracking, they discourage it because of advertising or whatever

hushed galleon
# robust jacinth for example "booster bot"

oh i only just noticed, booster bot doesnt seem to have any feature for listing the boost count for a specific user, they can only state the total boosts which discord does provide with Guild.premium_subscription_count
(or maybe they can and i just cant tell from their docs)

pliant gulch
#

I'm sure nitro boosting would fall under the same category

unkempt yacht
minor totem
#

Are you sure that the extension is loaded?

slate swan
#

why do my buttons timeout even if i have timeout=None

pliant gulch
#

Do you close your bot then reload it?

#

Buttons aren't persistent by default

slate swan
#

well i’ve kept vsc open for a while, but i’m hosting it on heroku

pliant gulch
#

The futures (or at least I think discord.py is using Future) won't timeout if you set the timeout to None

#

You'd have to stop the view manually or, if the bot restarted

slate swan
#

i’m using pycord

pliant gulch
slate swan
#

ooohhh

#

so i have to stop the view manually?

pliant gulch
#

No, I'm saying it would only stop working if you stopped the view manually

#

Not sure why it's "timing out"

pliant gulch
slate swan
#

hm

#

why

#

what’s a good site to host on?

hushed galleon
slate swan
#

light modeisFine

#

ah

hushed galleon
#

yeah they're pasting a couple tags from the dpy server

manic wing
#

can someone thank danny for personalising discord.py for me

royal jasper
#
@client.command(name='demotar_o_g')
async def demotando_o_g(ctx, membro: discord.Member):
    await ctx.send('demotando o glanchefeliz')
    
    # get role and remove the role
    role = discord.utils.get(ctx.message.guild, name='Trial')
    await client.remove_roles(membro, role)

    # add the role again
    await asyncio.sleep(15)
    await client.add_roles(membro, role)

how can i solve this error?: Command raised an exception: TypeError: 'Guild' object is not iterable

manic wing
#

they used my birthday in an example

supple crescent
#
@bot.command(name = 'order')
async def order(ctx: commands.Context, *, echo: str) -> None:
    msg = await ctx.send(echo)
    await msg.add_reaction("👍")
    await msg.add_reaction("👎")
    await ctx.message.delete()

    await ctx.send('You have 60 seconds to confirm! Press [placheolder thumbsup] to confirm! press [placeholder thumbsdown] to try again!')
    channel = ctx.channel
    def check(reaction, user):
            return user == ctx.author and str(reaction.emoji) == '👍'
    try:
        reaction, user = await bot.wait_for('reaction_add', timeout=60.0, check=check)
    except asyncio.TimeoutError:
        await channel.send('Gotcha! order confirmed')
    else:
        await channel.send('you timed out...')

    def check(reaction, user):
            return user == ctx.author and str(reaction.emoji) == '👎'
    try:
        reaction, user = await bot.wait_for('reaction_add', timeout=60.0, check=check)
    except asyncio.TimeoutError:
        await channel.send('Understood! cancelling order!')
    else:
        await channel.send('you timed out...')

only the you timed out for the 👍 works. idk why. any help?

hushed galleon
#

well, they dont want to be referencing just guild in the first place

royal jasper
hushed galleon
#

you should use just one check where the reaction can either be 👍 or 👎, then you can check the emoji again after they select one of them

supple crescent
#

so smthn like this

#
    def check(reaction, user):
            return user == ctx.author and str(reaction.emoji) == '👍'
    try:
        reaction, user = await bot.wait_for('reaction_add', timeout=60.0, check=check)
    except asyncio.TimeoutError:
        await channel.send('Gotcha! order confirmed')
    else:
        await channel.send('you timed out...')
            return user == ctx.author and str(reaction.emoji) == '👎'
    try:
        reaction, user = await bot.wait_for('reaction_add', timeout=60.0, check=check)
    except asyncio.TimeoutError:
        await channel.send('Understood! cancelling order!')
    else:
        await channel.send('you timed out...')

#

the ident was wrong but u get the point

hushed galleon
#

uhhh

#

the idea is that you only use one wait_for and have the check accept either reaction, then you can decide based on which one they chose afterwards

supple crescent
#

ahhhh

#

so its has to wait for the forst 60 secs to time out b4 the 👎 works

hushed galleon
#

mhm

supple crescent
#

okk

#

sooo

#

im just gonna remoe the timeout altogther

#

@hushed galleon now, its there any way to make it so if they press 👍 pressing 👎 wont do anything? (and vice versa)

hushed galleon
#

well having just one wait_for would do that for you

#

cause it returns after one reaction

supple crescent
#

@hushed galleon but how would i make it so it only uses 1 wait for with this new code?

    channel = ctx.channel
    def check(reaction, user):
            return user == ctx.author and str(reaction.emoji) == '👍'
    try:
        reaction, user = await bot.wait_for('reaction_add', check=check)
    except asyncio.TimeoutError:
        await channel.send('you timed out...')
    else:
        await channel.send('Gotcha! order confirmed')

    def check(reaction, user):
            return user == ctx.author and str(reaction.emoji) == '👎'
    try:
        reaction, user = await bot.wait_for('reaction_add', check=check)
    except asyncio.TimeoutError:
        await channel.send('you timed out...')
    else:
        await channel.send('Understood! cancelling order!')
hushed galleon
#

use one wait_for and have the check accept either reaction, then you can decide based on which one they chose afterwards

#

e.g. py def check(reaction, user): return reaction.emoji in ('👍', '👎')

supple crescent
#

ahhhhh

#

wait so smthn like this:

#
 def check(reaction, user):
        reaction, user = await bot.wait_for('reaction_add', check=check)
 [thumbsup path here]
 [thumbsdown path here]
hushed galleon
#

hm i coulda sworn even unicode emojis were wrapped with discord.Emoji

supple crescent
hushed galleon
#

ah whatever anyway, no you dont put the wait_for in the check

#

but yeah you'd have an if-statement to compare the thumbsup after the wait_for

supple crescent
hushed galleon
#

no, the check should return true for either emoji they choose

#

that way you can handle both reactions in one wait_for()

supple crescent
#

wait, so how would i do that 🤔

#

wait

#

holdup

#

nvm

hushed galleon
#

its just having an if-statement

supple crescent
#

sooo im just talkin in english here but:

reaction, user = await bot.wait_for('reaction_add', check=check)
if reaction is ('👍', '👎'):
[thumbsup path]
[thumbsdown path]

hushed galleon
#

the check would have that double emoji condition, but afterwards you can check which specific emoji they chose

supple crescent
#

ahh

#

so add both emojies in the 'reactin_add ' somehow?

supple crescent
#

thats deadass all i need to put

#

nvm 🤦‍♂️

#

wait

#

is that all?

hushed galleon
#

it should be shorter than the initial code you wrote

supple crescent
#

im so confused brainmon

hushed galleon
#

get thumb reaction from user (wait_for + check)
if reaction is thumbs up
confirmed
else cancelled

supple crescent
#

this isnt right at all but is the concept right/ am i on the right track?

    channel = ctx.channel
    def check(reaction, user):
        reaction, user = bot.wait_for('reaction_add', check=check)
        if 'reaction_add' == '👍': 
            do thing 
        
        if 'reaction_add' == '👎':
            do OTHER thing
#

@hushed galleon ^

hushed galleon
#

no not inside the check itself

minor totem
# supple crescent this isnt right at all but is the concept right/ am i on the right track? ```py ...

Almost, don't put the do thing and do OTHER thing inside the check. Place it outside like this:

    channel = ctx.channel
    def check(reaction, user):
        return user == ctx.author and str(reaction.emoji) in {'👍', '👎'}

    try:
        reaction, user = await bot.wait_for('reaction_add', check=check)
    except asyncio.TimeoutError:
        await channel.send('you timed out...')
        return  # There's no point in continue running the code

    if str(reaction.emoji) == '👍':
        ...
    else:
        # This means that: str(reaction.emoji) == '👎'
        ...
#

I also recommend that you check that it's inside the same channel!

supple crescent
#

or thumbs down

hushed galleon
#

the check should return true for either emoji they choose

minor totem
#

Yes, the check filters out (by ignoring) any other reaction than the ones made by the user and where the emoji is 👍 or 👎

supple crescent
#

and that alows the else to only be the thumbsdown soooo u dont need to check speratly for it 🤯

minor totem
#

The latter is done by str(reaction.emoji) in {'👍', '👎'}, if str(reaction.emoji) is 👍 then it is inside {'👍', '👎'}. Same goes for 👎

supple crescent
#

gotcha

minor totem
#

Note that I explicitly choose to use {} for the in {'👍', '👎'}.

#

This is because {} means both a dictionary, and a set. Now, when you have a , Python will recognize it as a set but if you have : it will understand it as a dictionary.

supple crescent
#

good to know!

minor totem
#

A set is much more performant at checking if one thing is inside the other. The same way that a dictionary is better at looking up keys

#

All you can do with a set is add or remove keys, and check if a particular value is in it (which is very fast).

#

That's exactly what we want to do!

minor totem
supple crescent
supple crescent
hushed galleon
#

although for a two-element set the performance difference is in the nanoseconds and uses about 4x the memory (216 bytes vs. 56 bytes) ```sh

py -m timeit -n 500000 -s "s = {'1', '2'}" "'3' in s"
500000 loops, best of 5: 16.5 nsec per loop
py -m timeit -n 500000 -s "s = ('1', '2')" "'3' in s"
500000 loops, best of 5: 29.8 nsec per loop```

minor totem
#

They don't, but if there are duplicates they will be removed because there cannot be duplicates

minor totem
supple crescent
minor totem
#

!e ```python
import dis

def check(arg):
return arg in {'👍', '👎'}

dis.dis(check)

unkempt canyonBOT
#

@minor totem :white_check_mark: Your eval job has completed with return code 0.

001 |   4           0 LOAD_FAST                0 (arg)
002 |               2 LOAD_CONST               1 (frozenset({'👍', '👎'}))
003 |               4 CONTAINS_OP              0
004 |               6 RETURN_VALUE
hushed galleon
#

oh thats pretty cool

subtle kindle
supple crescent
#

wait is there a way to see how intensive, fast, etc. your code is?

minor totem
#

Yup 😅 - but you did bring up a good point. Not all cases require a set but I like showing it when I can

supple crescent
minor totem
minor totem
slate swan
subtle kindle
#

briish

supple crescent
hushed galleon
small kettle
#

need help, how to make the author id is avaivable for everyone, not only 1 person

manic wing
#
if message.channel.id == ...: return
await react(...)```
hushed galleon
#

as in you want it to react to any message in that channel?

manic wing
#

meh same shit

hushed galleon
#

you just... dont check the user's id then

minor totem
small kettle
supple crescent
#
    if str(reaction.emoji) == '👍':
        await channel.send('Gotcha! order confirmed')
        channel = bot.get_channel(636399538650742795)
        await channel.send(f"<@{user_id}> \n", echo )

why is send undefined?

hushed galleon
#

was the error along the lines of NoneType has no attribute send?

slate swan
#

anyone know why bot.user returns _MissingSentinel? checked src code still not sure why it would return the class

hushed galleon
#

that would likely mean get_channel was none

slate swan
#

depends

#

if its for moderation its ok but you will always need a reason for logging actions

#

discord doesnt quite like it when you store allot of data in their platform

#

youll be fine

manic wing
alpine furnace
#

No, and write a privacy policy/tos for your bot if you’re concerned legally about it

#

Otherwise, it’s likely that nobody gives a shit

slate swan
manic wing
#

well it would be before the client is logged in

slate swan
#

nah

#

it would return None

#

!d discord.ext.commands.Bot.user

unkempt canyonBOT
slate swan
#

would return a NoneType error but i checked ClientUser and now im checking base

supple crescent
#

new error: : Command raised an exception: TypeError: Messageable.send() takes from 1 to 2 positional arguments but 3 were given

    if str(reaction.emoji) == '👍':
        await channel.send('Gotcha! order confirmed')
        channel = bot.get_channel(954898254783459388)
        await channel.send(f"<@{user_id}> \n", echo )
royal jasper
#

can someone help me? how can i update this code for the latest discord.py structure?

@client.command(name='demotar_o_g')
async def demotando_o_g(ctx, glanchefeliz: discord.Member):
    await ctx.send('demotando o g')
    
    role = discord.utils.get(ctx.guild, name='Trial')

    await client.remove_roles(glanchefeliz, role)
    await asyncio.sleep(15)
    await client.add_roles(glanchefeliz, role)
final iron
#

Outdated code

royal jasper
final iron
#

Reading is hard

supple crescent
#

removing \n doesnt do anything so idk what the 3 pos args are

#

await channel.send(f"<@{user_id}> \n" + not, echo )?

#

@slate swan

#

liek that?

#

yes

slate swan
#

just realized theres like a second difference between the cache getting populated and the gateway connecting to the botrooPopcorn

#

why have an f string an str concatenation?

#

and f strings are faster

#

3

#

not even 3 theres way more

#

f string is the only correct way lol

#
from __future__ import annotations
from disnake.ext.commands import Bot
import os


class Klaxo(Bot):
    def __init__(self, token: str, cogsdir: str, *args, **kwargs) -> None:
        super().__init__(*args, **kwargs)
        self.token = token
        self.cogsdir = cogsdir

    async def on_ready(self) -> None:
        print("Bots cache has been populated")

    async def on_connect(self) -> None:
        print(
            f"Bot info:\nId: {self.user.id}\nName: {self.user.name}\nDiscriminator: #{self.user.discriminator}\nTag: {self.user.name}#{self.user.discriminator}\nGuild count: {len(self.guilds)}\nMember count: {len(self.users)}\nToken: {self.token}\nCog dir: {self.cogsdir}\nCreation date: {self.user.created_at}\n"
        )
        print("Bot has connected to the gateway")

    def setup(self) -> None:
        for filename in os.listdir("./cogs"):
            if not filename.startswith("_") and filename.endswith("py"):
                self.load_extension(f"cogs.{filename[:-3]}")
                print(f"Loaded: {filename[:-3]}")

    async def on_disconnect(self) -> None:
        print("Bot has disconnected from the gateway")

    def run(self) -> None:
        self.setup()
        super().run(self.token, reconnect=True)

is this over the top? i feel like it isgopher

#

there is no error i just want a honest opinion if its over the toprooAww

#

especially the cogsdir argumentcatsip

#

the initiate of the class

final iron
#

Just print it once

#

Also cogdir and token is unnecessary

slate swan
final iron
#

It's useless

#

And clutters the console

slate swan
#

no such thing

#

how to i get playing a game in my bot status

final iron
slate swan
slate swan
unkempt canyonBOT
#

class discord.Status```
Specifies a [`Member`](https://discordpy.readthedocs.io/en/master/api.html#discord.Member "discord.Member") ‘s status.
slate swan
#

you just pass it in the bot status constructor

#

!d discord.ext.commands.Bot

unkempt canyonBOT
#

class discord.ext.commands.Bot(command_prefix, help_command=<default-help-command>, description=None, **options)```
Represents a discord bot.

This class is a subclass of [`discord.Client`](https://discordpy.readthedocs.io/en/master/api.html#discord.Client "discord.Client") and as a result anything that you can do with a [`discord.Client`](https://discordpy.readthedocs.io/en/master/api.html#discord.Client "discord.Client") you can do with this bot.

This class also subclasses [`GroupMixin`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.GroupMixin "discord.ext.commands.GroupMixin") to provide the functionality to manage commands.
pliant gulch
slate swan
# slate swan !d discord.Status
import requests
import os
import discord
from keep_alive import keep_alive
from discord.ext import tasks
from bs4 import BeautifulSoup
from discord.ext import commands
import asyncio

client = commands.Bot(command_prefix='xxx')
client._skip_check = lambda x, y: False

client.change_presence(status=discord.Status.idle)

await client.change_presence(activity=discord.Game(name="The Walking Dead Season 1"))

keep_alive()
client.run(os.getenv('tok'),bot=False)
client.run(os.getenv('tok'),reconnect=True)
``` is it correct?
pliant gulch
slate swan
hoary cargo
final iron
#

Self bot smh

slate swan
#

my class instance variable of my bot instance: AG_WorrySadge

#

anyone has cool complicated ideas for commands maybe api relatedpeeposhy

#

sed

pliant gulch
final iron
#

🗿

slate swan
slate swan
final iron
slate swan
pliant gulch
final iron
#

That's all you need

slate swan
pliant gulch
#

chess?

slate swan
slate swan
#

mhmmm

supple thorn
pliant gulch
#

But have you coded it

slate swan
#

good point but thats not my point

supple thorn
#

Haven't seen that one yet

slate swan
#

bro what

supple thorn
#

And it'd be pretty cool to play it inside discord

pliant gulch
#

How about a CHIP-8 emulator that works in discord

slate swan
pliant gulch
#

By that I mean fully emulate codeblocks (acting as ROMs)

slate swan
#

unlike youworksonmymachine

#

ill try game engines with imagine manipulation worksonmymachine

pliant gulch
#

Imagine manipulation

slate swan
#

behing?hehe

silent ermine
#

This keeps happening when I try to log a ctx.guild.id

Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/nextcord/ext/commands/core.py", line 168, in wrapped
    ret = await coro(*args, **kwargs)
  File "/Users/ext/config.py", line 45, in setup
    servers[str(ctx.guild.id)] = {}
AttributeError: 'NoneType' object has no attribute 'id'```

My code is 
```py
@commands.command()
async def log(self, ctx):
  with open("servers.json", "r") as f:
    servers = json.load(f)
  servers[int(ctx.guild.id)] = {}
  with open("servers.json", "w") as f:
    json.dump(servers, f)```
silent ermine
pliant gulch
#

Your running the command in a DM

slate swan
#

lol

lusty sky
#
@commands.command()
async def join(self,ctx):
    if ctx.author.voice is None:
        await ctx.send("You must be in a voice channel to do this")
    voice_channel = ctx.author.voice.channel
    if ctx.voice_client is None:
        await voice_channel.connect()
    else:
        await ctx.voice_client.move_to(voice_channel)```
#

Why is it telling me join is an invalid command?

silent ermine
#

I even did this and its none

pliant gulch
#

ctx.guild is NONE in DMs

#

It just makes no sense otherwise

silent ermine
silent ermine
final iron
pliant gulch
#

!e ```py
print(int(None))

unkempt canyonBOT
#

@pliant gulch :x: Your eval job has completed with return code 1.

001 | Traceback (most recent call last):
002 |   File "<string>", line 1, in <module>
003 | TypeError: int() argument must be a string, a bytes-like object or a real number, not 'NoneType'
silent ermine
pliant gulch
#

Either way, if it's None, it won't have any attribute id

unkempt canyonBOT
#

@pliant gulch :x: Your eval job has completed with return code 1.

001 | Traceback (most recent call last):
002 |   File "<string>", line 1, in <module>
003 | AttributeError: 'NoneType' object has no attribute 'id'
final iron
silent ermine
#

not dms

final iron
#

Then the guild shouldn't be None

silent ermine
#

idk ill figure it out ty

buoyant igloo
#

!e
print(int(“SDJJWKDKWJJD”))

tacit storm
buoyant igloo
#

Ik guys I ain’t dumb

slate swan
#

int means integer which is always a solid number dont get confused with a float as a float is a decimal which is still a number

#

number with parameters you mean the int converter?

pliant gulch
full lily
#

🗿solid

buoyant igloo
#

!e
list=[“g”,”h”] print(“”.join(list))

unkempt canyonBOT
#

@buoyant igloo :x: Your eval job has completed with return code 1.

001 |   File "<string>", line 1
002 |     list=[“g”,”h”]
003 |           ^
004 | SyntaxError: invalid character '“' (U+201C)
slate swan
pliant gulch
#

Guess there are liquid numbers? Maybe gaseous numbers?

slate swan
silent ermine
#

Is there a way to have like a code block format better on mobile cuz it keeps messing up.

inner epoch
#

Is it possible to send empheral messages using ctx.send? Or the ones which are only visible to ctx.message.author

slate swan
inner epoch
inner epoch
#

Ohh.....naah I mean in server

slate swan
#

private thread or channel ig

inner epoch
#

Umm yea private thread is a good idea....thanks!

silent ermine
pliant gulch
#

Not any consistent way, phones have dimensions, they can vary from phone to phone

#

It’s not a one size fits all thing

silent ermine
pliant gulch
#

discord already formats DESKTOP codeblocks in a “weird” way

#

I wouldn’t expect it to be an easier for mobile

silent ermine
#

Is there a way to Detect if a user is on mobile?

supple crescent
#

if i want to react with a server emoji can i just do ?

await msg.add_reaction("954933649395048488")
slate swan
thorn ore
slate swan
#

and if it's a discord emote u can just add a \ infront of the emote

#

and u can copy & paste it

thorn ore
#

\🎉

slate swan
#

its a custom emoji

#

then u just add a \ infront of the custom emote

supple crescent
slate swan
#

so u can get the name/id

slate swan
slate swan
supple crescent
#

whatev ill juse use a discord emothe 🤷‍♂️

slate swan
#

wouldn't work

gaunt ice
#

i have a doubt

slate swan
#

you probably need to get the object

thorn ore
gaunt ice
#

can we like ping a channel

thorn ore
gaunt ice
#

like this but for vc

#

um

#

not that

#

thats a text channel

slate swan
#

yeah mb

#

vc nah you cant

gaunt ice
#

hm

#

can bots?

thorn ore
#

Wdym bro?

slate swan
gaunt ice
#

yes bots can do

#

wait

slate swan
#

im not sure if you can tag a vc ive never seen it done before

thorn ore
#

We can't tag

slate swan
#

yeah

thorn ore
#

It's impossible

slate swan
#

not sure if discord lets you at all

thorn ore
#

Nops

novel bolt
thorn ore
gaunt ice
#

u just have to get it and just mention

hollow quarry
thorn ore
gaunt ice
#

see he just did

slate swan
hollow quarry
novel bolt
final iron
#

[#751591688538947646](/guild/267624335836053506/channel/751591688538947646/)
#751591688538947646

gaunt ice
#

m

#

okkk thanks

novel bolt
#

oh wait not #

thorn ore
#

Leave

slate swan
#

i thought discord didnt format vcs

thorn ore
#

Who can make a customized bot

gaunt ice
thorn ore
#

Like fully customized

brittle axle
slate swan
gaunt ice
#

lmfao

brittle axle
thorn ore
#

We can talk in dm?

brittle axle
#

k

gaunt ice
#

bruh

#

sunny stole boomerang from us

slate swan
#

its always dmsAG_ChikaStunned

gaunt ice
#

lol

slate swan
gaunt ice
#

nitro .....

unkempt canyonBOT
slate swan
#

!paste

unkempt canyonBOT
#

Pasting large amounts of code

If your code is too long to fit in a codeblock in discord, you can paste your code here:
https://paste.pythondiscord.com/

After pasting your code, save it by clicking the floppy disk icon in the top right, or by typing ctrl + S. After doing that, the URL should change. Copy the URL and post it here so others can see it.

slate swan
gaunt ice
#

!e print("hell world")

unkempt canyonBOT
#

@gaunt ice :white_check_mark: Your eval job has completed with return code 0.

hell world
gaunt ice
#

i used to be happy for this

slate swan
final iron
#

Boutta do some crazy one liner lambda shit

#

smh

slate swan
#
print((password_generator:=lambda num:f"Your new password is:\n{''.join(__import__('random').sample('1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz!@#$%^&*()_-+=|>.<,/?', num))}")(2))

one line password generatorhehe

final iron
#

Called it

slate swan
gaunt ice
#

im....

slate swan
supple crescent
#

can anyone help me with something complicated? its rly wordy so i dont feel like typing it if nobody feels like helping. its about pinging users in a spefic channel

slate swan
#

what about the idea?

supple crescent
# slate swan what about the idea?

ok when somobody does !order the order the say goes into another separate channel where i have to review the order, if i accpet it, how can the bot ping them back in their channel that they did !order in?

#

here is the code

gaunt ice
#

okk

#

append channel id

supple crescent
#
@bot.command(name = 'order')
async def order(ctx: commands.Context, *, echo: str) -> None:
    msg = await ctx.send(echo)
    await msg.add_reaction("✅")
    await msg.add_reaction("❌")
    await ctx.message.delete()


    channel = ctx.channel
    def check(reaction, user, ):
        return user == ctx.author and str(reaction.emoji) in {'✅', '❌'}

    try:
        reaction, user = await bot.wait_for('reaction_add', check=check)
    except asyncio.TimeoutError:
        await channel.send('you timed out...')
        return 

    if str(reaction.emoji) == '✅':
        await channel.send('Gotcha! order confirmed')
        channel = bot.get_channel(954898254783459388)
        await channel.send(f"<@{user_id}> \n {echo} ")
        await msg.add_reaction("✅")
        await msg.add_reaction("❌")

        channel =ctx.channel 
        def check(reaction, user):
            return user == ctx.author and str(reaction.emoji) in {'✅', '❌'}

        try:
            reaction, user = await bot.wait_for('reaction_add', check=check)
        except asyncio.TimeoutError:
            await channel.send('you timed out...')
            return 
        if str(reaction.emoji) == '✅':
            return
        else:
            return

    else:
        
        await channel.send('Understood! cancelling order!')
supple crescent
#

bc each person has their own private channel

slate swan
gaunt ice
#

is it like a ticket system

supple crescent
#

yeahhhh

gaunt ice
#

hmmm

supple crescent
#

sorta

#

ill send the full code

gaunt ice
#

sure

supple crescent
#

!paste

unkempt canyonBOT
#

Pasting large amounts of code

If your code is too long to fit in a codeblock in discord, you can paste your code here:
https://paste.pythondiscord.com/

After pasting your code, save it by clicking the floppy disk icon in the top right, or by typing ctrl + S. After doing that, the URL should change. Copy the URL and post it here so others can see it.

supple crescent
gaunt ice
#

okk

pliant gulch
gaunt ice
#

gib me like 5 mins @supple crescent

supple crescent
gaunt ice
#

im on phone lmfao

pliant gulch
unkempt canyonBOT
#

@pliant gulch :white_check_mark: Your eval job has completed with return code 0.

001 | 0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ!"#$%&'()*+,-./:;<=>?@[\]^_`{|}~ 	
002 | 
003 | 
slate swan
pliant gulch
slate swan
#

as the emoji is called this so you mean the emoji i suppose?

pliant gulch
#

🤦‍♂️

slate swan
oblique adder
#

how do I check if bot is able to give the mentioned role from the command?
do I check the role position or what ?

gaunt ice
#

@supple crescent

supple crescent
#

thas me

gaunt ice
#

im back on pc

supple crescent
#

alr sick

gaunt ice
#

gib 2 mins

supple crescent
#

gotcha

pliant gulch
#

Facepalming to Okimii

slate swan
pliant gulch
#

My two this meant to look above two messages

#

Like how you'd do ^^^ or something like people usually do

slate swan
#

no one does that bro

maiden fable
#

oki, stop acting weird

gaunt ice
#

@supple crescent by ctx.message.delete() are u meaning to delete the "msg" in order cmd

slate swan
#

cuz i dont do itwhyyy

supple crescent
#

its just to clear space

gaunt ice
#

alr then

#

@supple crescent

supple crescent
#

here

gaunt ice
#

try this

supple crescent
#

whats diffrentr

gaunt ice
#

the "bot.get_channel"

supple crescent
#

ohh

#

i see, lets try

gaunt ice
#

u can only use id there

#

but utils let u use name

supple crescent
#

k let me try

#

AttributeError: 'NoneType' object has no attribute 'send'

#

await channel2.send(f"<@{user_id}> \n {echo} ")

gaunt ice
#

hmm

#

alr wait

#

frig im sry

#

i forgot to get its id

supple crescent
#

ahh

#

no i have a user id

gaunt ice
#

try this

supple crescent
#

i have to try laer sorry

gaunt ice
#

np

quick gust
#

🥄

gaunt ice
#

🍴

heavy folio
#
  1. defined bot twice, second time was a subclassed one which was not even used
  2. bot.run is a method
  3. time.sleep blocking
gaunt ice
#

umm

#

this isnt my code....

#

its actually meat's

#

he took out the token intentionally

#

was he supposed to send token?

sick birch
#

The token has nothing to do with the other mentioned issues

gaunt ice
slate swan
#

Anyone know mongo?

boreal ravine
#

yes

slate swan
#

Ok

echo wasp
#

is it (manage_guild) or (mange_server) for checking if they have permissions

echo wasp
reef trail
#

why does this say 69 hours lol

gaunt ice
#

dunno

#

why is ur background like dat....

reef trail
#

Because i have a theme, and before you lecture me about how its against ToS, ive had client modifications for upwards of 4 years, if discord cared that much they'd enforce the rule lol

gaunt ice
#

hm ok

#

why do u have to read me like that 😂

reef trail
#

ive had people lecture me for years about it

#

Im aware of the risks

gaunt ice
#

alr lol

torn sail
#

Yeah discord doesn’t care about that

#

Even though it breaks the tos

reef trail
torn sail
#

Yep that’s right

native onyx
#

I uninstalled the discord modules to use nextcord, but changed my mind and reinstalled discord.py and discord again, only now it's giving this error

heavy folio
#

force reinstall

heavy folio
# reef trail why does this say 69 hours lol

i personally use divmod cuz i find it easier, here's an example from dpy server ```py
from datetime import datetime
from discord.ext import commands

bot = commands.Bot(command_prefix="?", description="This is a bot")
bot.launch_time = datetime.utcnow()

@bot.command()
async def uptime(ctx):
delta_uptime = datetime.utcnow() - bot.launch_time
hours, remainder = divmod(int(delta_uptime.total_seconds()), 3600)
minutes, seconds = divmod(remainder, 60)
days, hours = divmod(hours, 24)
await ctx.send(f"{days}d, {hours}h, {minutes}m, {seconds}s")

reef trail
#

divmod

#

Huh, i havent heard of that. what exactly does it do?

brave narwhal
heavy folio
unkempt canyonBOT
#

divmod(a, b)```
Take two (non-complex) numbers as arguments and return a pair of numbers consisting of their quotient and remainder when using integer division. With mixed operand types, the rules for binary arithmetic operators apply. For integers, the result is the same as `(a // b, a % b)`. For floating point numbers the result is `(q, a % b)`, where *q* is usually `math.floor(a / b)` but may be 1 less than that. In any case `q * b + a % b` is very close to *a*, if `a % b` is non-zero it has the same sign as *b*, and `0 <= abs(a % b) < abs(b)`.
reef trail
#

ahhhh

native onyx
heavy folio
#
python -m pip install --force-reinstall discord.py
#

if you are using 2.0 then ```
python -m pip install --force-reinstall git+https://github.com/Rapptz/discord.py

native onyx
#

thx

reef trail
#

i appreciate this, thanks man

reef trail
drowsy thunder
#

Guys how to check if a message has walls of text or repeated text or too many emotes?

#

@minor totem

long whale
#

Hey... how do I get ppl knwing about my bot any good methods to get my bot onto servers?

drowsy thunder
# long whale Hey... how do I get ppl knwing about my bot any good methods to get my bot onto ...

I have 5 ways to do it

  1. Top.gg, Post your bot on top.gg and actively vote it
  2. Needed features,surf though the internet and check what users are interested in the botd to be added
  3. Customization, Make a cool little dashboard with a .xyz domain and make your bot customizable
  4. Hundreds of features,add as many features as possible to your discord bot and all must be customizable using dashboard.
    5)Advertise it manually,advertising it manually by telling your friends about it also helps!
tardy plume
#

is it possible to put this embed field to other file and use it to my bot embed message?

drowsy thunder
tardy plume
#

private thing 😅

#

like i have separate file which is only with embed.add_field() and load that file to my bot command embed message

drowsy thunder
#

I dont think if that will work

#

@tardy plume but if you can then can ya help me

thorn ore
#

Suiyuuu typing

#

Typing too long

bleak karma
#

help

@bot.event
async def on_member_update(before, after):
    if before.status != after.status:
       return

    if str(before.status) == "online":
      if str(after.status == "offline"):
        return

    if str(before.status) == "offline":
      if str(after.status == "online"):
        return
        
    if before.activity != after.activity:
        req_act = "vanity"
        my_server = bot.get_guild(guild id here)
        role_id = role id here
        role = my_server.get_role(role_id)
        if act := [activ.name for activ in after.activities if activ.type == ActivityType.custom and req_act in activ.name]:
            channel = bot.get_channel(bot channel id here)
            emb = discord.Embed(color=0xffffff)
            emb.description = f"thank for vanity"
            emb.set_footer(text="meoww")
            await channel.send(f"<@{after.id}>", embed=emb)
            await after.add_roles(role)
        else:
            await after.remove_roles(role)

i want it to not ping the user again if they change or put a emoji in their status or if they change something in their status but it still has the vanity. is it possible? do i make sense?-

bleak karma