#discord-bots

1 messages Β· Page 450 of 1

boreal ravine
#

??? @slate swan

slate swan
#

Python programmer.
Developing discord bots and making some other useless stuff.

[he/him]

#

XDDDDD

valid niche
#

you first need to write a check function, which just returns true or false depending on the situation. You want to like check the message author, channel, and maybe more too

bitter depot
#

As you've been told, we will not be helping with this here. Tiktok doesn't allow this, and so it violates our #rules (specifically rule 5)

valid niche
#

then you write your wait for, do this is a try: except, in the except set asyncio.TimeoutError so when the timeout is reached it will do an action

#

you can write pass in the except if you want it to do nothing

#

hopefully that clears it up more

#

to check whatever you want

#

like if you don't write a check any user in any channel in any server can trigger the wait_for

#

where a check can limit this to only the original author for instance

#

or maybe a specific channel

#

or whatever you want

#

the most common one would be same author same channel/message (depending on your event)

maiden fable
#

Yo seb. Sup

slate swan
#

Oh okay, but how and where would fix that?

kindred epoch
slate swan
#

The level system?

#

Ohhh

valid niche
#
@bot.command()
async def role_give(ctx):
  # blahblahblah
  def check(m):
    return m.author == ctx.author and m.channel == ctx.channel
  try:
    await bot.wait_for("message", check=check, timeout = 60)
  except asyncio.TimeoutError:
    await ctx.send("Timeout reached, aborting")
    return
#

this wold be like one of the most common wait_for with a check @tawdry perch

valid niche
maiden fable
#

Out of context but I still remember that you were the first person who helped me with discord.py in this channel PepeGiggleHehe

slate swan
#

so i have code and stuff, how do i get the bot to execute the code?

kindred epoch
#

send the message in dms and then use reaction_add event to wait for it

valid niche
# maiden fable Long time no see

eh i've been on an off here and there just not as active here due to uni starting soon and doing other stuffs and bits. Ah well good to see you too

kindred epoch
#

use reaction_add in wait_for

#

wait_for takes events

slate swan
kindred epoch
valid niche
#

also my mobile data is taking a dump atm lmao

kindred epoch
#

ye

maiden fable
kindred epoch
#

!d discord.ext.commands.Bot.wait_for

unkempt canyonBOT
#

wait_for(event, *, check=None, timeout=None)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).

Waits for a WebSocket event to be dispatched.

This could be used to wait for a user to reply to a message, or to react to a message, or to edit a message in a self-contained way.

The `timeout` parameter is passed onto [`asyncio.wait_for()`](https://docs.python.org/3/library/asyncio-task.html#asyncio.wait_for "(in Python v3.9)"). By default, it does not timeout. Note that this does propagate the [`asyncio.TimeoutError`](https://docs.python.org/3/library/asyncio-exceptions.html#asyncio.TimeoutError "(in Python v3.9)") for you in case of timeout and is provided for ease of use.

In case the event returns multiple arguments, a [`tuple`](https://docs.python.org/3/library/stdtypes.html#tuple "(in Python v3.9)") containing those arguments is returned instead. Please check the [documentation](https://discordpy.readthedocs.io/en/stable/api.html#discord-api-events) for a list of events and their parameters.

This function returns the **first event that meets the requirements**...
kindred epoch
#

there

maiden fable
#

Where did the search button go?

valid niche
maiden fable
kindred epoch
#

so all the things that bot.event has can be used in wait_for

kindred epoch
#

its not there

maiden fable
kindred epoch
#

close it and its on the top right

maiden fable
kindred epoch
#

pretty sure

valid niche
maiden fable
#

Oh wait

#

Ffs

maiden fable
#

It feels a bit weird now

valid niche
#

anyways back on topic

bitter depot
#

@valid niche would you mind helping me test something with @unkempt canyon rq? Need a non-staff member

valid niche
#

sure go ahead

bitter depot
#

#bot-commands pls

maiden fable
#

reaction.emoji

#

Mhm

#

def check(reaction, user):

#

Mhm

spark dragon
#

How do I use len() on emojis?

maiden fable
#

return reaction.emoji == emoji

spark dragon
maiden fable
#

!d discord.Message.reactions

unkempt canyonBOT
maiden fable
#

This...?

spark dragon
#

Alright

#

Gonna check

maiden fable
#

Either true or false

valid niche
#

your wait for returns a tuple of reaction, user, from this reaction you can do reaction.emoji and see what they reacted with

maiden fable
#

That means the reaction emoji ain't the same

#

So the function won't return anything

valid niche
#

i would add a line to the check to ensure only those 2 emoji's will be accepted too

maiden fable
#

And won't continue

valid niche
#

if you want to have the user choose from 2 reactions, have the check require either 2

#

then get the return value from wait_for (reaction, user) and check reaction.emoji. Put this in an if elif else against all emoji's to do the thing you want to do

slate swan
#

Any idea why this error? Idk much about MetaClasses notlikeblob ```py
(aperture-venv) C:\Users\Asus\Documents\GitHub\Aperture>py launcher.py
Traceback (most recent call last):
File "launcher.py", line 10, in <module>
from aperture import ApertureBot
File "C:\Users\Asus\Documents\GitHub\Aperture\aperture_init_.py", line 32, in <module>
from aperture.core import listeners, constants, ApertureContext
File "C:\Users\Asus\Documents\GitHub\Aperture\aperture\core_init_.py", line 2, in <module>
from .context import ApertureContext
File "C:\Users\Asus\Documents\GitHub\Aperture\aperture\core\context.py", line 28, in <module>
class ApertureContext(commands.Context['ApertureBot']):
TypeError: 'ABCMeta' object is not subscriptable

Code: ```py
from __future__ import annotations
from typing import Any, Optional, TYPE_CHECKING

from discord.ext import commands

if TYPE_CHECKING:
    from discord import Message
    from aperture import ApertureBot

class ApertureContext(commands.Context['ApertureBot']):
    async def reply(self, content: Optional[str] = None, **kwargs: Any) -> Message:
        if not kwargs.get('mention_author', None):
            kwargs['mention_author'] = False

        return await super().reply(content=content, **kwargs)
valid niche
#
def check(r, u):
  return u == ctx.user and r.message == message and (r.emoji == "emoji1" or r.emoji == "emoji2")
try:
  reaction, user = await bot.wait_for("reaction_add", timeout=60, check=check)
except asyncio.TimeoutError:
  pass
if reaction.emoji == "emoji1":
  # do stuff
else:
  # do other stuff
``` @tawdry perch
valid niche
#

commands.Context isn't subscriptable

slate swan
#

I was told to do so, to typehint it's bot attr as my custom bot class notlikeblob

valid niche
#

wut?

#

i mean i already question the fact why you want to subclass context to make your own, the library itself will still use the commands.Context and not your own class

slate swan
valid niche
#

but also who told you to subscript it?

slate swan
#

In dpy server

slate swan
valid niche
#

if you don't do a user argument, reaction becomes a tuple of (reaction, user). Alternatively you can do reaction, _ = await bot.wait_for(...) to indicate you want to discard user

valid niche
#

because that doesn't look correct in my eyes

slate swan
#

Ah I just changed the approach like ```py
class MyContext(commands.Context):
if TYPE_CHECKING:
from blah import MyBot
bot: MyBot

And guess that'll work
#

Since I only need it for type checking

valid niche
#

like you can subclass it just fine

#

just the commands.Context class isn't subscriptable so not sure what danny is on about

slate swan
#

Idk anything about metaclasses, I should learn them first before asking lol notlikeblob

maiden fable
#

Me who doesn't know shit about Python: 7408_shrekstare

slate swan
#

Also it used to work before, I just changed a few lines in another file and it stopped working

#

user never have any guild

maiden fable
#

Could be the person left the guild?

hasty iron
#

could be a dm

slate swan
#

someone's spamming your bot's dm

maiden fable
slate swan
#

Perfect antispam verycool

#

Wait wth, I just changed the directory of my code along with venv, and it is now using lower version of dpy notlikeblob

maiden fable
slate swan
#

try adding an else statement

#

If and elif are never getting executed ig

inland mist
#

You have to do str(reaction.emoji) ig

#

Here

#

Yeah

#

Everywhere in this snippet

valid niche
#

the message.author returned a User, which isn't bound to a guild. Also use message.guild directly

#

well add_reaction adds to the message, and the message in this case is your own message and not the embed message

#

by replacing message with the embed message

#

messageable.send() returns the message that was sent

inland mist
#

Everytime you compare the reaction.emoji to a emoji string

valid niche
#

so you can catch that return value and add_reaction there

naive hornet
#

Isn't there an entire official discord server deticated to the development of discord bots?

naive hornet
#

So it's prob better to ask questions there...

slate swan
#
    user[user.id] = {}

member object doesnt support item assignment

haughty sedge
#
@client.event
async def on_member_join(member):
    if member.guild.id == 876095186181189653:
      try:
        role = get(member.guild.rols,name="Member")
        await client.add_roles(member, role)
      except:
        print("exception")
    else:
      print("WRONG SERVER SUCCESS")
      return```
#

it prints nothing no error

haughty sedge
#

oh~

slate swan
#

since if u have two roles named member or some shit it will error

haughty sedge
#

bruh

inland mist
#

Also there's something weird with your check

slate swan
#

you would have to set the send part to a varible

haughty sedge
#

IT STILL DIDNT WORKED

#
@client.event
async def on_member_join(member):
    if member.guild.id == 876095186181189653:
      try:
        role = get(member.guild.roles,name="MEMBER HEH")
        await client.add_roles(member, role)
      except:
        print("exception")
    else:
      print("WRONG SERVER SUCCESS")
      return```
haughty sedge
slate swan
valid niche
haughty sedge
#

um

#

why not, my bot is in 90 servers

valid niche
#

they aren't like a list or dictionary, you cannot add a value to them

haughty sedge
#

sorry im angri

#

but its caps & not shout

inland mist
#
def check(reaction, user):
   return user == message.author and str(reaction.emoji) in ["emoji1", "emoji2"]
#

Try sth ΓΆike that

slate swan
#

i hacked nasa with this code

#

print('nasa hacked')

haughty sedge
#

man can anyone help me:(

inland mist
haughty sedge
#

um what?

inland mist
#

In your get

haughty sedge
#

u just made m capital but it in the parameter its smol m

inland mist
#

You missspelled roles

haughty sedge
#

i fixed it!!

slate swan
#

client.add_roles?

#

nah

inland mist
haughty sedge
#

oh

slate swan
#

member.add_roles(role)

#

await also

haughty sedge
#

k got it!!

slate swan
#

heyy

#

!d discord.Member.add_roles

unkempt canyonBOT
#

await add_roles(*roles, reason=None, atomic=True)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).

Gives the member a number of [`Role`](https://discordpy.readthedocs.io/en/stable/api.html#discord.Role "discord.Role")s.

You must have the [`manage_roles`](https://discordpy.readthedocs.io/en/stable/api.html#discord.Permissions.manage_roles "discord.Permissions.manage_roles") permission to use this, and the added [`Role`](https://discordpy.readthedocs.io/en/stable/api.html#discord.Role "discord.Role")s must appear lower in the list of roles than the highest role of the member.
inland mist
#

Are your emojis correct?

haughty sedge
#

IT didnt worked either

slate swan
#

show your code

#

that you have now

haughty sedge
#
await member.add_roles(member, role)```
slate swan
#

delete the member

haughty sedge
#

it takes member param from event

#

from where

slate swan
#

it doesn't take a member param

haughty sedge
#

await member.add_roles(role)

slate swan
#

yeah

haughty sedge
#

like this?

#

k

slate swan
#

yeah

#

but it should've thrown an error

inland mist
#

Hm then I dont know

haughty sedge
#

ik idk why it didnt

slate swan
#

which makes me think it didn't even get to that part

haughty sedge
#

IT STILL DIDNT WORKED @slate swan

haughty sedge
#

Oh man i got exam tomorrow i just wanna make that code work

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.pydis.com/

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

slate swan
#

paste it here

haughty sedge
#

GOT IT

#

got itttt a return thing was stopping it

#

from my database if the content is not found in database the whole event gets returned

slate swan
#

that's-

#

kinda disappointing

haughty sedge
#

u were right

#

lol

hasty iron
haughty sedge
slate swan
#

can't wait till I can try out my c# experience

haughty sedge
#

WORKED YAY

#

i bullied dank memer for testing purposes ||Kicked 10 times||

hasty iron
#

wait until it gets revenge

haughty sedge
#

Hi, dank memer melsmie is gonna ban u from earth for bot violation thank you have a great afterlife

slate swan
#

do you want to add those reactions on your embed message?

#

it would just make sense...

#

not important

polar dirge
#

alr bet

slate swan
#

error isn't defined there, is it

#

at the end

#

well-

#

if you have an error handler that would eat this

#

if you disable it, you would know the problem

#

where does the code stop?

#

oof

#

not even the embed message?

unkempt canyonBOT
slate swan
#

try adding

    raise e```
instead of the TimeOutError handler
#

maybe it gives an error

cinder horizon
#

https://paste.pythondiscord.com/avozoquyin.py
welp this is a trial and smtng stoopid ik but i would like some help on this....wen the user runs !osu scores <2 or 3 or 4> lez say i want the bot to make it into 2 or 3 or how many so ever embeds and send with pagination....

slate swan
#

the docs say it has to be done exactly like that

#

I don't know what could go wrong

#

!d discord.ext.commands.Bot.wait_for

unkempt canyonBOT
#

wait_for(event, *, check=None, timeout=None)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).

Waits for a WebSocket event to be dispatched.

This could be used to wait for a user to reply to a message, or to react to a message, or to edit a message in a self-contained way.

The `timeout` parameter is passed onto [`asyncio.wait_for()`](https://docs.python.org/3/library/asyncio-task.html#asyncio.wait_for "(in Python v3.9)"). By default, it does not timeout. Note that this does propagate the [`asyncio.TimeoutError`](https://docs.python.org/3/library/asyncio-exceptions.html#asyncio.TimeoutError "(in Python v3.9)") for you in case of timeout and is provided for ease of use.

In case the event returns multiple arguments, a [`tuple`](https://docs.python.org/3/library/stdtypes.html#tuple "(in Python v3.9)") containing those arguments is returned instead. Please check the [documentation](https://discordpy.readthedocs.io/en/stable/api.html#discord-api-events) for a list of events and their parameters.

This function returns the **first event that meets the requirements**...
slate swan
#

it's there in the examples

#

your logic in the check could go wrong, actually

#
def check(reaction, user):
    return user == message.author and (str(reaction.emoji) == "" or str(reaction.emoji) == "") 
#

paste your emojis there

#

since yours only worked when you clicked on the tick, as I saw

#
def check(reaction, user): return user == message.author and str(reaction.emoji) == "βœ…" and (str(reaction.emoji) == "βœ…" or str(reaction.emoji) == "❌")
#

weird, not even going to lie

covert igloo
#

How do I handle this error

slate swan
#

show code, sir

slate swan
covert igloo
#

It's a mute command

slate swan
#

and yes, can you send your code?

#

!code

unkempt canyonBOT
#

Here's how to format Python code on Discord:

```py
print('Hello world!')
```

These are backticks, not quotes. Check this out if you can't find the backtick key.

slate swan
#

still no output?

covert igloo
#

I'll send it in a sec @slate swan

slate swan
#

wait omg

#

I think

#

!d discord.on_member_join

unkempt canyonBOT
#

discord.on_member_join(member)``````py

discord.on_member_remove(member)```
Called when a [`Member`](https://discordpy.readthedocs.io/en/stable/api.html#discord.Member "discord.Member") leaves or joins a [`Guild`](https://discordpy.readthedocs.io/en/stable/api.html#discord.Guild "discord.Guild").

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

you have a space after reaction_add

#

make sure to enable intents

#

!intents

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
#

and if that's not the problem I'm jumping outta the window

#

jk

#

what's happening?

#

lmao

#

absolutely no output

#

and it might be cause of a space

#

we corrected all the other errors before they could occure

#

that's kinda disappointing too...

#

uh

#

easy

#

send the code

#

!code

unkempt canyonBOT
#

Here's how to format Python code on Discord:

```py
print('Hello world!')
```

These are backticks, not quotes. Check this out if you can't find the backtick key.

slate swan
#

now here lmao

#

can i ask something? how can message content be none if it's on_message? πŸ€”

#

or do those invisible characters count as no content?

#
await message.author.send(embed=embed)

change that to

msg = await message.author.send(embed=embed)
#

ah okay πŸ‘Œ

#

to save the message object

#

exactly

#

and the rest works, ye

#

but you can change the timeouterror handler back

lament mesa
slate swan
#

nice

slate swan
lament mesa
#
            try:
               reaction, user = await self.bot.wait_for("reaction_add", check=check, timeout = 60)

            except Exception as e:
                raise e
``` the try except is not needed
#

the error will get raiseed automatically

slate swan
#

it is tho

#

it's a timeouterror

#

just turned to an example rn

lament mesa
#

yes

#
except asyncio.TimeOutError:
    await message.channel.send("Timed out")```
slate swan
#

yes

#

it isn't like DM the bot for help right?

unique nexus
#

discord.ext.commands.errors.CommandInvokeError: Command raised an exception: AttributeError: 'PermissionOverwrite' object has no attribute 'channel'

@commands.command()
    async def lock(self,ctx,channel:discord.TextChannel=None,*,reason=None,new_name=None):
        
        
        channel =ctx.channel
        overwrite_role=ctx.message.channel.overwrites_for(ctx.guild.default_role)
        if overwrite_role.channel.send_messages == False:
            await channel.send("Channel is already locked down. Use `[prefix]unlock` to unlock.")```
slate swan
#

why is that argument there

#

when you reassign it next line

unique nexus
#

what is wrong in my code

#

yea i will remove it

slate swan
#

overwrite_role wouldn't be a permissionoverwrite, just a role

#

object

unique nexus
#

then how will i write it

slate swan
#

and I think there's a method for TextChannel that overwrites permissions for a role

#

!d discord.TextChannel

unkempt canyonBOT
#

class discord.TextChannel```
Represents a Discord guild text channel.

`x == y` Checks if two channels are equal.

`x != y` Checks if two channels are not equal.

`hash(x)` Returns the channel’s hash.

`str(x)` Returns the channel’s name.
unique nexus
#

i refer it aldreay

#

i am not able to correct thay

#

that

slate swan
#

!d discord.TextChannel.overwrites_for

unkempt canyonBOT
slate swan
#

oh that's not it

unique nexus
slate swan
#

!d discord.TextChannel.set_permissions

unkempt canyonBOT
#

await set_permissions(target, *, overwrite=see - below, reason=None, **permissions)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).

Sets the channel specific permission overwrites for a target in the channel.

The `target` parameter should either be a [`Member`](https://discordpy.readthedocs.io/en/stable/api.html#discord.Member "discord.Member") or a [`Role`](https://discordpy.readthedocs.io/en/stable/api.html#discord.Role "discord.Role") that belongs to guild.

The `overwrite` parameter, if given, must either be `None` or [`PermissionOverwrite`](https://discordpy.readthedocs.io/en/stable/api.html#discord.PermissionOverwrite "discord.PermissionOverwrite"). For convenience, you can pass in keyword arguments denoting [`Permissions`](https://discordpy.readthedocs.io/en/stable/api.html#discord.Permissions "discord.Permissions") attributes. If this is done, then you cannot mix the keyword arguments with the `overwrite` parameter.

If the `overwrite` parameter is `None`, then the permission overwrites are deleted.

You must have the [`manage_roles`](https://discordpy.readthedocs.io/en/stable/api.html#discord.Permissions.manage_roles "discord.Permissions.manage_roles") permission to use this...
slate swan
#

so
overwrite role would just be assigned with
overwrite_role = ctx.guild.default_role

#

which you would use as target in the function above

#

then the overwrites, like

await channel.set_permissions(overwrite_role, send_messages=True)
unique nexus
#

i did that

slate swan
#

I didn't even understand your question, did I

unique nexus
#

not working for the code i send

slate swan
#

heck

maiden fable
#

Need any help?

slate swan
#

got this

unique nexus
#
@commands.command()
    async def unlock(self,ctx,channel:discord.TextChannel=None,*,reason=None,new_name=None):
        
        
        channel = channel or ctx.channel
        
        overwrite_role=ctx.message.ctx.channel.overwrites_for(ctx.guild.default_role)
        if overwrite_role.send_messages == True:
            await channel.send("Channel is Not locked down. Use `[prefix] lock` to unlock.")  ```
slate swan
#

you can tho...

maiden fable
#

Eh

unique nexus
#

if user mention channel and its is aldready lock it is code for it

slate swan
#

damn use the first tag

maiden fable
#

Your indent is fucked up

unique nexus
#

no

slate swan
#

ctx.channel.overwrites_for(ctx.guild.default_role)

#

innit

unique nexus
#

yes

maiden fable
#

Also that won't work @unique nexus

#

There can be only one kwarg in a command

slate swan
#

you would have to get that then check if send_message is False in it

unique nexus
#
@commands.command()
    async def lock(self,ctx,channel:discord.TextChannel=None,*,reason=None):
        
        
        channel =ctx.channel
        overwrite_role=ctx.message.channel.overwrites_for(ctx.guild.default_role)
        if overwrite_role.channel.send_messages == False:
            await channel.send("Channel is already locked down. Use `[prefix]unlock` to unlock.")  
        else:
            overwrite =channel.overwrites_for(ctx.guild.default_role)
            overwrite.send_messages=False
            await channel.set_permissions(ctx.guild.default_role,overwrite=overwrite)
            embed=discord.Embed(title=f"{channel} is Locked ! ", description=f"reason: {reason}")
            
            await ctx.send(embed=embed)
    
full lily
#

leave the reason as kwarg and put new_name before the asterisk

unique nexus
#

my code

full lily
#

πŸ‘

unique nexus
#

now it send that error

slate swan
#

no need for the channel kwarg

#

still

unique nexus
#

whihc?

full lily
#

that's true

unique nexus
#

channel:discord.TextChannel?

slate swan
#

yes

unique nexus
#

ignore that

full lily
#

but you could have a bool to lock ALL channels or just the current

unique nexus
#

if user mention channel and its is aldready lock it is code for it

#

here it brake

slate swan
#

it looks okay tho

#

you could remove many unnecessary parts

unique nexus
#

it is not working

#

same error

slate swan
#

the error would help

unique nexus
#

discord.ext.commands.errors.CommandInvokeError: Command raised an exception: AttributeError: 'PermissionOverwrite' object has no attribute 'channel'

#

i am totally confused plz tell what is wrong in my code

#

for this error

slate swan
#

overwrite_role.channel doesn't exist

#

it's just overwrite_role.send_messages

#

then ig it wasn't as okay as it looked...

unique nexus
#

yea

#

but it is buggy

slate swan
#

could've guessed

unique nexus
#

if =lock #discord-bots and that channel is not locked still it say locked

slate swan
#

what

#

does the channel mention affect it?

unique nexus
#

if channel is not locked it still show channel is locked

unique nexus
slate swan
#

can you print overwrite_role?

unique nexus
#

can try that

#

doesnt print anything

slate swan
#

print it somewhere where it gets triggered...

polar dirge
#

i have an embed like

description=':emoji: text\n   :2emoji: 2text'```
and it is supposed to look like

:emoji: text
   :2emoji: 2text

but it looks like 

:emoji: text
:2emoji: 2text
unique nexus
#

isnt there any other way to fix it

slate swan
#

use \t?

slate swan
reef trail
#
handler.setFormatter(
    logging.Formatter('%(asctime)s:%(levelname)s:%(name)s: %(message)s'))``` can i change the way this prints into my console? I want it to print the same way everything else prints, look at the command used as a perfect example (ignore the shard ratelimit warning, im chunking guilds lol)
unique nexus
#

print(overwrite_role)

slate swan
#

are you sure the everyone role's send_messages permission isn't False?

#

because there's no other way it would say it's locked

#

wait

unique nexus
#
@commands.command()
    async def lock(self,ctx,channel:discord.TextChannel=None,*,reason=None):
        
        
        channel =ctx.channel
        overwrite_role=ctx.message.channel.overwrites_for(ctx.guild.default_role)
        
        if overwrite_role.send_messages == False:
            await channel.send("Channel is already locked down. Use `[prefix]unlock` to unlock.") 
    
        else:
            overwrite =channel.overwrites_for(ctx.guild.default_role)
            overwrite.send_messages=False
            await channel.set_permissions(ctx.guild.default_role,overwrite=overwrite)
            embed=discord.Embed(title=f"{channel} is Locked ! ", description=f"reason: {reason}")
            
            await ctx.send(embed=embed)
slate swan
#

in both of your statements it says it's locked

#

which one does it actually say

#

bruh

unique nexus
#

if is for if channel mention is aldready locked

#

and other is for lock

#

if it is not locked

slate swan
#

so it always says the first one

unique nexus
#

no like not everytime

#

how should i show u demo

#

😩

hasty iron
slate swan
#

it's because it says the first one when @everyone's send_messages permission is False

slate swan
#

obviously

unique nexus
#

yes

slate swan
#

if you set it to true, the second one's triggered

unique nexus
#

if channel is locked aldready it should send channel is lock

#

if channel is not locked it will go to else condition

#

lock that channel

hasty iron
#

you can just store locked channels somewhere and see if that channel is inside that list or whatever you stored shit in

fervent surge
#

is there a way to quickly get the highest heirarchy role of a member in string form

hasty iron
#

!d discord.Member.top_role

unkempt canyonBOT
#

top_role```
Returns the member’s highest role.

This is useful for figuring where a member stands in the role hierarchy chain.
hasty iron
#

returns a Role object

fervent surge
#

thx!

unique nexus
#

eh i dont want store

#

channel

slate swan
#

but I don't think you know how your code works....

unique nexus
#

i have coded it so i know

#

u dont understand what i meant

slate swan
#

that's true too

#

under the definition of overwrite_role, print overwrite_role.send_messages

fervent surge
hasty iron
#

'Returns the member’s highest role.'

unique nexus
#

donto work

#

print

slate swan
#

wdym don't work

unique nexus
#

/ Β―_(ツ)_/Β―

#

print nothing

slate swan
#

where did you put it bru

fervent surge
#

its returning the role at the bottom of the role list

unique nexus
#

inside my code

slate swan
#

does dpy have a reversed day or wtf

hasty iron
#

then try Member.roles[0]

fervent surge
#

top-most one is admin, and bottom is muted. itd returning mutrf

slate swan
fervent surge
unique nexus
#

lol i am out my brain broke now

hasty iron
#

try Member.roles[-1]

fervent surge
waxen granite
#

Is there a way to restrict the bot to be invited in any discord server by only few specific members?

unique nexus
#

yes

vagrant brook
#

I think you can do that in developer portal

unique nexus
#

u can track bot join has how many member if low just make it leave

waxen granite
fervent surge
slate swan
#

try printing the whole list

#

and just see the role order

minor totem
#

Anybody knows what forks of discord.py have become rather prominent?

hasty iron
spring flax
slate swan
#

And it's returning @everyone? rooThink

vagrant brook
minor totem
spring flax
#

!pypi enhanced-dpy i think this

unkempt canyonBOT
minor totem
slate swan
#

Maybe pycord, edpy, and more

slate swan
#

not forks though

waxen granite
slate swan
#

something like hikari i'd prefer over edpy tbh as of now

#

But if you can afford to edit the whole code again, I'd recommend using libs like hikari and hata

#

yeah

minor totem
slate swan
slate swan
#

but that's kind of true, switching from dpy to hikari may seem weird i guess

crisp pine
#

how do i track the server daily message count?

slate swan
#

Also I don't think hikari has any commands extension in their GatewayBot..?

minor totem
#

I don't see that as a downside though

minor totem
slate swan
#

For hikari too? rooThink

crisp pine
slate swan
minor totem
#

I am in their Discord and there's special channel for those at least

slate swan
#

Oh, I heard about Lightbulb

slate swan
#

w- what..

slate swan
#

Whole asyncio is the lib notlikeblob

hasty iron
#

lets say.. they're infamous for "copying" stuff

slate swan
#

Their backend directory has almost everything required to run the bot notlikeblob

minor totem
slate swan
#

Maybe if you can wait for edpy to introduce slash commands just use that tbh wya

minor totem
#

πŸ€·β€β™‚οΈ wasn't really looking for something new to use. Mostly wanted to know if there was any library that was growing big

slate swan
#

Seeing Pycord making third bot class and killing internals, I'll better switch to hikari blobpain

hasty iron
#

hata doesn't look like too bad of a lib tbh

minor totem
#

Oh wow, Pycord has a lot of stars yeah

#

What suprises me is that no one forked through GitHub?

torpid star
#
class Defaults:
    Token = None
    Cluster = None

class Config():
    def __init__(self):
        self.config_file = Path(".") / "config.ini"
        self.config = configparser.ConfigParser(interpolation=None)
        self.config.read(self.config_file, encoding="utf-8")

        self._token = self.config.get("Bot", "Token", fallback=Defaults.Token)
        self._cluster = self.config.get("DB", "Cluster", fallback=Defaults.Cluster)
        self.check()

    def check(self):
        if not self._token:
            logger.error(f"Please enter a Discord Bot Token!", extra={"emoji": WARNING})
            time.sleep(1)
            input_token = input("Token: ")
            self.config.set(section="Bot", option="Token", value=f"{input_token}")

            with open('config.ini', 'w') as configfile:
                self.config.write(configfile)
        if not self._cluster:
            logger.error(f"Please enter the url so i can connect to MongoDB", extra={"emoji": WARNING})
            time.sleep(1)
            input_mongo = input("URL: ")
            self.config.set(section="DB", option="Cluster", value=f"{input_mongo}")

            with open('config.ini', 'w') as configfile:
                self.config.write(configfile)
        if not self._cluster or not self._token:
            logger.critical(f"After you put everything in here you need to restart the Bot!", extra={"emoji": WARNING})
[Bot]

Token =


[DB]

Cluster =

configparser.NoSectionError: No section: 'Bot'

But the Section is there lmao

minor totem
#

Like- it doesn't have that mark

hasty iron
#
import discord

bot = discord.Bot()

@bot.slash_command()
async def hello(ctx, name: str = None):
    name = name or ctx.author.name
    await ctx.send(f"Hello {name}!")

@bot.user_command(name="Say Hello")
async def hi(ctx, user):
    await ctx.send(f"{ctx.author.mention} says hello to {user.name}!")

bot.run("token")
``` tbh i dont like this
spring flax
#

which lib is that?

hasty iron
#

they couldve just added slash commands to Client

#

pycord

spring flax
#

what would user_command mean ?

slate swan
#

There's no reason to make third bot class.

#

user context menu command

hasty iron
crisp pine
#

why does this let the code stop working?

messagecounts = {}
@client.command()
async def serverstats(ctx):
    embed=discord.Embed(title=f" {ctx.guild.name}")
    embed.add_field(name="Users:", value=ctx.guild.member_count, inline=False)
    embed.add_field(name="Channels:", value=len(ctx.guild.channels), inline=False)
    embed.add_field(name="Messages sent:", value=messagecounts[ctx.guild.id], inline=False)
    await ctx.send(embed=embed)

@client.event
async def on_message(message):
    if message.guild.id not in messagecounts.keys():
        messagecounts[message.guild.id] = 0
    messagecounts[message.guild.id] += 1```
hasty iron
#

atleast to me

slate swan
#

They don't like this extension. They say this won't break anything just replace your constructor with this.
Then what's the sense of making a new class kannaconfused

hasty iron
#

my idea for slash commands is to add it to Client

#

so Bot can use it too

crisp pine
#

How do i count the guild daily messages?

slate swan
#

Danny's approach was same, to have client let use slash and have discord/slash.py for commands extension

slate swan
stone palm
#

use a good dpy fork

stone palm
#

its apparently the best ive seen

hasty iron
#

i wont use either

slate swan
#

Atleast till now, dpy_good_fork_exist == True --> False fl_panik

hasty iron
#

ill make my own

slate swan
stone palm
brisk plover
#

hi

stone palm
#

it was pinned on this server as an alternative to slash commands

hasty iron
#

ok

brisk plover
#

so uhm the bot is recieving errors but its not even in the server?

#

im gonna lose my mind

stone palm
#

and they made disnake that works amazing
its also really simple

brisk plover
#

no servrrs

#

the bot is literally just created

#

i get the token and start it

#

and its getting errors

torpid star
brisk plover
#

errors that the command is not found

#

i use ?hi or literally anything and it says not found

stone palm
brisk plover
#

no

#

no server

#

and thats why im gonna lose my mind

stone palm
#

it might be previous errors

hasty iron
#

print bot.guilds

#

and see if your bot is really in no guilds

stone palm
#

?hi might not be a command on the bot
thats why it says command not found

#

Β―_(ツ)_/Β―

brisk plover
#

yeah i know

#

its not

slate swan
#

How are you using ?hi if it's not in any server?

brisk plover
#

but im typing the command in a server that the bot is not in

#

how does it know im even typing it??

slate swan
#

wait what

brisk plover
#

yeah exactly

slate swan
#

Check if you're using wrong bot token

brisk plover
#

yeah

#

i am

#

this is unbelievable

crisp pine
#

does anyone know how to track the server daily messages and joins?

brisk plover
#

and in the server that the bot IS IN its not detecting errors

#

what the fuck

waxen granite
#

how to send a msg in system_channel of a guild?

#

guild.system_channel.send?

vagrant brook
vagrant brook
dapper cobalt
unkempt canyonBOT
#

system_channel```
Returns the guild’s channel used for system messages.

If no channel is set, then this returns `None`.
waxen granite
#

says nonetype has attr send

brisk plover
#

im gonna get a seizure

slate swan
vagrant brook
waxen granite
#

but server has a system channel

crisp pine
# vagrant brook on_message and on_member_join events
messagecounts = {}
@client.command()
async def serverstats(ctx):
    embed=discord.Embed(title=f"Statystyki serwera {ctx.guild.name}")
    embed.add_field(name="Users:", value=ctx.guild.member_count, inline=False)
    embed.add_field(name="Channels:", value=len(ctx.guild.channels), inline=False)
    embed.add_field(name="Messages sent:", value=messagecounts[ctx.guild.id], inline=False)
    await ctx.send(embed=embed)

@client.event
async def on_message(message):
    if message.guild.id not in messagecounts.keys():
        messagecounts[message.guild.id] = 0
    messagecounts[message.guild.id] += 1```

tried this but it would not reply
dapper cobalt
brisk plover
#

@slate swancan u help?

#

im gonna get a seizure

vagrant brook
slate swan
#

Maybe..

dapper cobalt
crisp pine
#

Nope Just Did Not reply

vagrant brook
waxen granite
slate swan
dapper cobalt
slate swan
waxen granite
#

yes

vagrant brook
#

Are you sure that the guild has a system channel

dapper cobalt
#

Try to print guild.system_channel.

waxen granite
#

i am sure 100%

#

okay

crisp pine
dapper cobalt
#

And since you are doing it for every guild then you can use try...except.

slate swan
dapper cobalt
#
try:
  await guild.system_channel.send("...")
except:
  continue
brisk plover
#

the bot thinks its a whole new bot

crisp pine
dapper cobalt
waxen granite
brisk plover
#

1 sec

slate swan
waxen granite
#

see

dapper cobalt
flat pilot
#

im noob in pythongrumpchib

crisp pine
dapper cobalt
# waxen granite

Is this the first guild that the bot goes through in the loop?

waxen granite
#

wdym

#

well yes i guess

waxen granite
#

i have 2 guilds and both have system channels

#

ye i am sec

slate swan
dapper cobalt
#

Can you send your code again?

vagrant brook
slate swan
waxen granite
dapper cobalt
vagrant brook
#

Is there some kind of guilds intents

#

That he disabled somehow

slate swan
#

!d discord.Intents.guilds

unkempt canyonBOT
waxen granite
#

i have all intends enabled

#

t

dapper cobalt
#

You can make it easier. Instead of looping through the guilds to find the one with the same name just do guild = discord.utils.get(self.bot.guilds, name=serverName).

vagrant brook
#

Wait

#

if you left the server, then how do you message in it

#

Oh wait I am blind

waxen granite
#

yes

dapper cobalt
#

They leave at the end.

waxen granite
#

xd

dapper cobalt
#

Why do you underline the guild's name instead of bolding it?

vagrant brook
#

** is bold

#

Uh I don't get it

#

Why is it None

slate swan
#

wait continue..?

#

It's for loops

vagrant brook
#

He's looping through guilds

slate swan
#

use pass instead

#

ah

#

just use ctx.guild..?

vagrant brook
#

He's leaving another guild from a guild

#

I guess

waxen granite
waxen granite
slate swan
#

Oh

vagrant brook
#

Is it None now

waxen granite
#

let me try

dapper cobalt
#

Remove the check now.

#

f-string obsession...

vagrant brook
#

str(guild.system_channel} is different from guild.system_channel ig

slate swan
#

You don't need serverName == guild.name since utils.get will always return that only

slate swan
#

that's fine

vagrant brook
#

!d discord.utils.find This one is good too

unkempt canyonBOT
#

discord.utils.find(predicate, seq)```
A helper to return the first element found in the sequence that meets the predicate. For example:

```py
member = discord.utils.find(lambda m: m.name == 'Mighty', channel.guild.members)
```  would find the first [`Member`](https://discordpy.readthedocs.io/en/stable/api.html#discord.Member "discord.Member") whose name is β€˜Mighty’ and return it. If an entry is not found, then `None` is returned.

This is different from [`filter()`](https://docs.python.org/3/library/functions.html#filter "(in Python v3.9)") due to the fact it stops the moment it finds a valid entry.
dapper cobalt
#

guild is now a discord.Guild object.

waxen granite
#

it works

compact field
#

guys how can i get avatar from code like this 167a2c872f7de4ff4f04873d86535cab ?

waxen granite
#

ty guys

vagrant brook
#

Ow

#

Oh I get it now

dapper cobalt
dapper cobalt
#

https://cdn.discordapp.com/avatars/user_id/avatar_code.webp?size=1024

covert igloo
#

@dapper cobalt hey can u get back to me in the dm, there's context so that's why I haven't asked here again

dapper cobalt
dapper cobalt
# dapper cobalt You can ask here.

I don't mean that I don't want to help you in DMs, but I've been programming in Python for only 2 years. So of course asking here will be better for you since there are people more experienced than me.

wide silo
#
    async def send_pages(self):
        destination = self.get_destination()
        embed = discord.Embed(title=":robot: **How to use Twitch Tipping Bot**",
                              description="The following commands can be used to setup the bot correctly!")
        embed.set_author(name="Twitch Tipping Bot - Help")
        embed.add_field(name='!help',
                        value="Shows this embedded message in your DM's.")
        embed.colour = uBot.Colors.blue
        for page in self.paginator.pages:
            embed.description += page
        await destination.send(embed=embed)


bot.help_command = Help(dm_help=True)```
#

how to make this admin only ?

dapper cobalt
#

I don't think you can.

#

I'm not sure.

wide silo
#

i've been trying to figure it for one hour now and i can't find anything about it

dapper cobalt
#

Wouldn't it be better to make a tickets system instead then?

slate swan
crisp pine
#

i am still confused how to track daily joins and messages

slate swan
crisp pine
#

Yeah Ma Bot Is 24/7

high flame
#

how do i make a role can't see a specific channel

slate swan
#

Set role permissions as view_channel = False

high flame
#

im noob with permissions related stuff blobpain

#

give docs

crisp pine
pale turtle
#

How can I run an async function with bot.loop? If even possible

pale turtle
slate swan
high flame
#

got it

#

how do i make a member can see it and a role can't, do i replace role_object with Member?

slate swan
#

and multiple also

high flame
pliant gulch
high flame
#

what create_task do blobpain

pliant gulch
pale turtle
pale turtle
pliant gulch
#

Well bot.run calls login and connect

#

Put the API request in connect and it should be fine

slate swan
pliant gulch
#

Its an async method as well so

slate swan
pale turtle
pliant gulch
#

the connect part is the blocking part iirc because its a while loop for listening to websocket messages

#

I'm not sure I don't really know much about discord.py's websocket stuff

pale turtle
#

Yeah it's blocking

slate swan
#

It runs on different thread? rooThink

#
      await asyncio.sleep(2)
      await msg.edit(content='Getting IP: {}'.format(random.choice(string.digits.split('.') for i in range(10))))

how would i make a fake ip with ascii

#

Just because you're doing whatever this is inside of a bot does not make it dpy related. #python-discussion
"i have a toaster in my house, do i ask a carpenter how to fix it?" - Laggy

pale turtle
#
@bot.event #Or bot.listen(), bot.listen('on_member_join'), commands.Cog.listener() and commands.Cog.listener('on_member_join')
async def on_member_join(member: discord.Member): #Don't forger self if in a class
  channel = member.guild.get_channel(channel_id)
  await channel.send(f'{member.mention} joined {member.guild.name}')```
#

!d discord.on_member_join

unkempt canyonBOT
#

discord.on_member_join(member)``````py

discord.on_member_remove(member)```
Called when a [`Member`](https://discordpy.readthedocs.io/en/stable/api.html#discord.Member "discord.Member") leaves or joins a [`Guild`](https://discordpy.readthedocs.io/en/stable/api.html#discord.Guild "discord.Guild").

This requires [`Intents.members`](https://discordpy.readthedocs.io/en/stable/api.html#discord.Intents.members "discord.Intents.members") to be enabled.
pale turtle
#

It's set_footer

#

You can't have two footers

#

Welcome to the party pal

#

Well it still triggers

#

Which means channel will be None

#

Because that other guild doesn't have a channel with that id

slate swan
#

discord.PermissionOverwrite(view_channels=False, ...)

high flame
#

also, if i use 0 as discord.Permissions would that make no perms to a role/memner?

sonic aspen
#
    @commands.group(invoke_without_command=True)
    @commands.guild_only()
    async def voice(self, ctx):
        embed = discord.Embed(title='Canali Vocali Auto', description=all_msg(type='description_def', guild=ctx.guild.id), colour=colorprd())
        embed.add_field(name='Canali Vocali', value=all_msg('vc_cmds_help', ctx.guild.id))
        embed.add_field(name='Testing', value='Testing..')
        embed.add_field(name='Generatore', value=all_msg('admin_cmds_help', ctx.guild.id))
        # buttons = [ActionRow(
        #     Button(

        #     ),
        #     Button(

        #     )
        # )]
        await ctx.send(embed=embed)
        await self.generator(ctx)


    @voice.group(invoke_without_command=True)
    @commands.guild_only()
    @commands.has_permissions(manage_channels=True)
    async def generator(self, ctx):
        embed = discord.Embed(title=':controlpanel: Pannello dei Generatori', description=all_msg('vc_gen_def', ctx.guild.id), colour=colorprd())
        embed.set_thumbnail(url=self.client.user.avatar_url)
        msg = await ctx.send(embed=embed, components=all_buttons('gen_cp'))
        click_buttons('gen_cp', msg)

Why if I do !voice it send me the message of the command !voice generator?

slate swan
#

how do i get the cooldown for a member?

#

how to send msg to dm?

high flame
#

!d discord.ext.commands.Command.get_cooldown_retry_after

unkempt canyonBOT
high flame
#

@slate swan

slate swan
slate swan
high flame
#

!d discord.User.send

unkempt canyonBOT
#

await send(content=None, *, tts=False, embed=None, file=None, files=None, delete_after=None, nonce=None, allowed_mentions=None, reference=None, mention_author=None)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).

Sends a message to the destination with the content given.

The content must be a type that can convert to a string through `str(content)`. If the content is set to `None` (the default), then the `embed` parameter must be provided.

To upload a single file, the `file` parameter should be used with a single [`File`](https://discordpy.readthedocs.io/en/stable/api.html#discord.File "discord.File") object. To upload multiple files, the `files` parameter should be used with a [`list`](https://docs.python.org/3/library/stdtypes.html#list "(in Python v3.9)") of [`File`](https://discordpy.readthedocs.io/en/stable/api.html#discord.File "discord.File") objects. **Specifying both parameters will lead to an exception**.

If the `embed` parameter is provided, it must be of type [`Embed`](https://discordpy.readthedocs.io/en/stable/api.html#discord.Embed "discord.Embed") and it must be a rich embed type.
high flame
#

@slate swan

hoary gust
#

guys how to use the split func

high flame
#

!d str.split

unkempt canyonBOT
#

str.split(sep=None, maxsplit=- 1)```
Return a list of the words in the string, using *sep* as the delimiter string. If *maxsplit* is given, at most *maxsplit* splits are done (thus, the list will have at most `maxsplit+1` elements). If *maxsplit* is not specified or `-1`, then there is no limit on the number of splits (all possible splits are made).

If *sep* is given, consecutive delimiters are not grouped together and are deemed to delimit empty strings (for example, `'1,,2'.split(',')` returns `['1', '', '2']`). The *sep* argument may consist of multiple characters (for example, `'1<>2<>3'.split('<>')` returns `['1', '2', '3']`). Splitting an empty string with a specified separator returns `['']`.

For example:
high flame
#

!e ```py
x = "hello;world"

print(x.split(";"))

unkempt canyonBOT
#

@high flame :white_check_mark: Your eval job has completed with return code 0.

['hello', 'world']
high flame
#

@slate swan will this work? i want to use a perms integer

slate swan
#

Not sure, I never understood this Permission thing, how dpy handles it notlikeblob try it

high flame
#

members is a role

hoary gust
#

!e

x = "33133133132 3213213213123 123212312333"
print(x.split)
unkempt canyonBOT
#

@hoary gust :white_check_mark: Your eval job has completed with return code 0.

<built-in method split of str object at 0x7f0203f86150>
slate swan
#

great naming

hoary gust
#

!e

x = "33133133132, 3213213213123, 123212312333"
print(x.split(","))
unkempt canyonBOT
#

@hoary gust :white_check_mark: Your eval job has completed with return code 0.

['33133133132', ' 3213213213123', ' 123212312333']
slate swan
#

@hoary gust #bot-commands

short axle
#

is there a way to unban a user while the bot is in a guild but not a person

high flame
#

i can use discord.Member there?

hoary gust
slate swan
unkempt canyonBOT
#

class discord.Object(id)```
Represents a generic Discord object.

The purpose of this class is to allow you to create β€˜miniature’ versions of data classes if you want to pass in just an ID. Most functions that take in a specific data class with an ID can also take in this class as a substitute instead. Note that even though this is the case, not all objects (if any) actually inherit from this class.

There are also some cases where some websocket events are received in [strange order](https://github.com/Rapptz/discord.py/issues/21) and when such events happened you would receive this class rather than the actual data class. These cases are extremely rare.

`x == y` Checks if two objects are equal.

`x != y` Checks if two objects are not equal.

`hash(x)` Returns the object’s hash.
slate swan
#

so if i was wanting to get the cooldown of a command would i do: self.command_name.and.get_cooldown_retry_after()

fervent surge
#

is there a way to only DM someone if you can?

hoary gust
fervent surge
hoary gust
#

@slate swan what is the use of append

slate swan
#

how can i like def channel?

fervent surge
#

and it works

hoary gust
#

try except will work ofc

slate swan
#

how can i like def channel?

hoary gust
#

just get the channel

slate swan
hoary gust
slate swan
#

{}

hoary gust
#

use id

slate swan
hoary gust
stoic flicker
hoary gust
#

self.bot.get_guild

stoic flicker
#

wrong one

slate swan
unkempt canyonBOT
#

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

001 | [1, 2, 3]
002 | [1, 2, 3, 5]
slate swan
#

you don't understand

stoic flicker
covert igloo
#

how do i set up heroku on mac

stoic flicker
#

help please

hoary gust
#

ok i get it

slate swan
#

no reason, I just do that way lol

hoary gust
#

u inserted it in the list

stoic flicker
#

bruh

hoary gust
#

??

slate swan
stoic flicker
#

can someobdyody help

hoary gust
slate swan
kindred epoch
stoic flicker
hoary gust
kindred epoch
#

then what does it say?

stoic flicker
#

users isnt define

kindred epoch
#

then do it

stoic flicker
#

but how do i define it

kindred epoch
#

by learning python

hoary gust
#

what r u trying to do ?

stoic flicker
#

make a bank system

slate swan
stoic flicker
#

so like .beg. or .work

covert igloo
#

does anyone know how to set up heroku

stoic flicker
#

so that people can gamble and stuff

#

then claim their money for actuall things

#

so like 100k = voucher

#

idk just some fun

kindred epoch
hoary gust
stoic flicker
#

im just adding to a bot i already have

kindred epoch
covert igloo
#

@kindred epoch would you happen to know lol

hoary gust
stoic flicker
kindred epoch
hoary gust
kindred epoch
stoic flicker
covert igloo
hoary gust
covert igloo
hoary gust
#

and if user

stoic flicker
hoary gust
#

u need to define it

stoic flicker
#

i already have that

hoary gust
#

@stoic flicker can u show ur code

stoic flicker
#

yee

kindred epoch
stoic flicker
#

i cant fit it into one picture

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.pydis.com/

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

hoary gust
kindred epoch
stoic flicker
slate swan
#

Heroku is meant for hosting webapps like apis kinda stuff

stoic flicker
#

thats the part i added

hoary gust
stoic flicker
#

but i already have imports and stuff

hoary gust
stoic flicker
#

the full thing

#

so everything

covert igloo
slate swan
# stoic flicker

Will you share more traceback? A lot of it is hidden or cropepd

stoic flicker
#

o

#

File "C:\Users\leyton#\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\discord\ext\commands\bot.py", line 939, in invoke
await ctx.command.invoke(ctx)
File "C:\Users\leyton#\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\discord\ext\commands\core.py", line 863, in invoke
await injected(*ctx.args, **ctx.kwargs)
File "C:\Users\leyton#\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\discord\ext\commands\core.py", line 94, in wrapped
raise CommandInvokeError(exc) from exc
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: NameError: name 'users' is not defined

slate swan
#

This isn't the whole blobpain

kindred epoch
stoic flicker
slate swan
#

This module in my bot is used to get a list of channel IDs and their names in the server.... but the problem is how do I make it send all the IDs and messages at once py @Blank.command(aliases=['cid']) async def channels(ctx): await ctx.message.delete() i=0 c=[] d=[] for channel in ctx.guild.channels: c.append(channel.id) d.append(channel.name) for x in range(len(c) and len(d)): msg+=f"{c[x]} = {d[x]}\n"

In this I tried to await ctx.send the value of msg but it shows that I have called it before it is assigned... Please help

slate swan
stoic flicker
#

Traceback (most recent call last):
File "C:\Users\leyton#\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\discord\ext\commands\bot.py", line 939, in invoke
await ctx.command.invoke(ctx)
File "C:\Users\leyton#\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\discord\ext\commands\core.py", line 863, in invoke
await injected(*ctx.args, **ctx.kwargs)
File "C:\Users\leyton#\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\discord\ext\commands\core.py", line 94, in wrapped
raise CommandInvokeError(exc) from exc
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: NameError: name 'users' is not defined

covert igloo
kindred epoch
#

after a new month starts, it resets

covert igloo
#

the free trail resets?

kindred epoch
#

yes

covert igloo
#

so whats the point of paying on heroku

kindred epoch
slate swan
#

@stoic flicker Don't dm me the error, you can use the paste too. Also the error is

stoic flicker
#

o

#

whats wrong with it tho

slate swan
#

I don't know blobpain

stoic flicker
#

o

slate swan
#

Try to read it once

stoic flicker
#

that r is meant to be a w

covert igloo
#

ah i see

stoic flicker
slate swan
covert igloo
#

anyways what vid did you follow

slate swan
#

users

covert igloo
#

@kindred epoch

stoic flicker
#

o Lmao

#

if thats what caused the full thing to break

#

still broken

#

tf

#

bruh

magic stump
#
  if ctx.on_raw_reaction_add:
     await user1.send("AHA")
covert igloo
slate swan
covert igloo
#

this is what pops up when i click on import

#

its not letting me drag the files

#

oh wait i think thats only to import another repository

valid niche
unkempt canyonBOT
#

When using JSON, you might run into the following error:

JSONDecodeError: Expecting value: line 1 column 1 (char 0)

This error could have appeared because you just created the JSON file and there is nothing in it at the moment.

Whilst having empty data is no problem, the file itself may never be completely empty.

You most likely wanted to structure your JSON as a dictionary. To do this, edit your empty JSON file so that it instead contains {}.

Different data types are also supported. If you wish to read more on these, please refer to this article.

magic stump
#

!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.pydis.com/

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

valid niche
covert igloo
#

@kindred epoch what do i enter here

covert igloo
valid niche
#

screw that friend then

covert igloo
#

lol

valid niche
#

you cannot go any worse than heroku

kindred epoch
covert igloo
#

yes

kindred epoch
valid niche
#

idk what really is worse

covert igloo
valid niche
#

replit or heroku

kindred epoch
covert igloo
#

which was his file name im pretty sure

kindred epoch
#

atleast you dont get api banned on heroku

kindred epoch
covert igloo
#

oh im just an idiot

#

i thought the python was just part of his file name

kindred epoch
#

lol

magic stump
compact eagle
#

Hi, i need some help

#

Is there a way to inline discord buttons?

#

We tried to use .center(15, "** **"),

#

But it only takes 1 char and it takes it raw anyway

kindred epoch
compact eagle
#

Is there a work around maybe?

slate swan
compact eagle
#

What about transparent emoji's?

#

@kindred epoch

kindred epoch
covert igloo
#

@kindred epoch its not letting me turn it on yo πŸ’€

kindred epoch
magic stump
#

But I don't know how to do or save or do it

kindred epoch
#

and then do it bruh

slate swan
compact eagle
#

Anyone know the hex of the discord background?

languid jungle
#

Please don't use ableist language in this server

covert igloo
#

sorry

magic stump
#

sadge

plucky shoal
covert igloo
#

@kindred epoch when i make new files in vsc, do i just upload it to github in that respository

kindred epoch
kindred epoch
covert igloo
#

ok

magic stump
#

but i have problem

covert igloo
#

ty ill hit u up if i got any issues with it @kindred epoch

kindred epoch
#

np

kindred epoch
magic stump
#

yes

stoic flicker
#

Ignoring exception in command beg:
Traceback (most recent call last):
File "C:\Users\leyton#\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\discord\ext\commands\core.py", line 85, in wrapped
ret = await coro(*args, **kwargs)
File "C:\Users\leyton#\Documents!!!!bot\awdawd.py", line 147, in beg
await open_account(ctx.author)
File "C:\Users\leyton#\Documents!!!!bot\awdawd.py", line 164, in open_account
users = await get_bank_data()
File "C:\Users\leyton#\Documents!!!!bot\awdawd.py", line 179, in get_bank_data
user = json.load(f)
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.9_3.9.2032.0_x64__qbz5n2kfra8p0\lib\json_init_.py", line 293, in load
return loads(fp.read(),
io.UnsupportedOperation: not readable

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

Traceback (most recent call last):
File "C:\Users\leyton#\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\discord\ext\commands\bot.py", line 939, in invoke
await ctx.command.invoke(ctx)
File "C:\Users\leyton#\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\discord\ext\commands\core.py", line 863, in invoke
await injected(*ctx.args, **ctx.kwargs)
File "C:\Users\leyton#\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\discord\ext\commands\core.py", line 94, in wrapped
raise CommandInvokeError(exc) from exc
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: UnsupportedOperation: not readable
Ignoring exception in command balance:
Traceback (most recent call last):
File "C:\Users\leyton#\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\discord\ext\commands\core.py", line 85, in wrapped
ret = await coro(*args, **kwargs)
File "C:\Users\leyton#\Documents!!!!bot\awdawd.py", line 133, in balance
await open_account(ctx.author)
File "C:\Users\leyton#\Documents!!!!bot\awdawd.py", line 164, in open_account
users = await get_bank_data()
File "C:\Users\leyton#\Documents!!!!bot\awdawd.py", line 179, in get_bank_data
user = json.load(f)
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.9_3.9.2032.0_x64__qbz5n2kfra8p0\lib\json_init_.py", line 293, in load
return loads(fp.read(),
io.UnsupportedOperation: not readable

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

Traceback (most recent call last):
File "C:\Users\leyton#\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\discord\ext\commands\bot.py", line 939, in invoke
await ctx.command.invoke(ctx)
File "C:\Users\leyton#\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\discord\ext\commands\core.py", line 863, in invoke
await injected(*ctx.args, **ctx.kwargs)
File "C:\Users\leyton#\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\discord\ext\commands\core.py", line 94, in wrapped
raise CommandInvokeError(exc) from exc
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: UnsupportedOperation: not readable

#

uhh help

slate swan
# magic stump yes

Everything you're doing in your bot isn't related to dpy. An indentation error is nowhere related.
Also dpy is not a library for beginners, even it's maintainer says so.
I'd recommend you to learn basic concepts of python and oop before dpy and have a basic project.
If you still want to stick with dpy, we (or atleast I) can't help with it.

magic stump
#

mhm

stoic flicker
#

my error

slate swan
compact eagle
#

It didn't work

full lily
stoic flicker
#

how

compact eagle
#

You can't use custom emojis in buttons

stoic flicker
#

i have {}

compact eagle
#

😒😒😒😒😒😒

stoic flicker
#

inside

kindred epoch
full lily
stoic flicker
#

yee

compact eagle
#

Unicode emojis only @kindred epoch

stoic flicker
kindred epoch
compact eagle
#

Proof

#

Now

full lily
compact eagle
#

@kindred epoch

kindred epoch
#

sure

compact eagle
#

Haha

stoic flicker
full lily
#

change "w" to "r"

kindred epoch
#

@compact eagle

slate swan
compact eagle
#

How?!

full lily
kindred epoch
compact eagle
#

Please help me @kindred epoch

full lily
stoic flicker
kindred epoch
#

I'm using the emoji kwarg

magic stump
#

nice \