#discord-bots

1 messages · Page 1039 of 1

lucid vine
#

i did nothing wrong i keep stating and repeating i dont wish to be micro managed by batman mister vengance discord sheriff now stop talking to me this is the 3rd issue with you ive had where u keep micro managing me i dont care about what you say nor if you breath or not

heady sluice
#

but he doesn't use an opensource api with uncopyrighted with music... it's wavelink

regal pulsar
#

whats wavelink?

heady sluice
regal pulsar
#

so you kinda have to listen

regal pulsar
heady sluice
lucid vine
regal pulsar
#

oh

#

well why is the convo still going on

hollow badger
#

We cannot verify how you will use wavelink, so we can't help you with your issue, even if wavelink itself is not the issue.

regal pulsar
#

problem was solved

slate swan
#

@regal pulsardm ? pls

regal pulsar
#

oh yeah sorry

lucid vine
heady sluice
#

I'm still bullied for my discord username

hollow badger
#

Now, I will ask that everyone moves on, as this channel has been wildly derailed.

heady sluice
#

and I've been told like 6 times that I have a broom up my arse

#

and that someone shit in my brain

hollow badger
#

Please change the subject.

lucid vine
heady sluice
#

sure

#

.topic

lament depotBOT
#
**What commands/features are you proud of making?**

Suggest more topics here!

regal pulsar
#

.topic

#

hmm

slate swan
#

Why are my discord slash commands not showing?

heady sluice
lucid vine
slate swan
#

How?

lucid vine
slate swan
#

bot

regal pulsar
pliant gulch
slate swan
#

yup

lucid vine
pliant gulch
torn sail
#

!d discord.app_commands.CommandTree.sync

unkempt canyonBOT
#

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

Syncs the application commands to Discord.

This must be called for the application commands to show up.

Global commands take up to 1-hour to propagate but guild commands propagate instantly.
regal pulsar
#

if you want to test app commands in a testing server then do

#

test_guilds=[]

slate swan
#

Imagine this not being ticked

sick birch
#

Haha, it's usually the simple things

lucid vine
vocal plover
boreal osprey
sick birch
#

Code?

zealous jay
#
    raise ClientException('This client already has an associated command tree.')
discord.errors.ClientException: This client already has an associated command tree.
#

Why am I getting this error?

zealous jay
# zealous jay ```py raise ClientException('This client already has an associated command t...
class client(discord.ext.commands.Bot):
    def __init__(self):
        super().__init__(
            command_prefix='!',
            intents = discord.Intents.default(),
            application_id = 770696433573036054)
        self.synced = False

        self.initial_extensions = [
            "cogs.test",
        ]
    
    async def setup_hook(self) -> None:
        self.session = aiohttp.ClientSession()

        for ext in self.initial_extensions:
            await self.load_extension(ext)

        await client.tree.sync(guild=discord.Object(id=770698123915165747))

    async def on_ready(self):
        await self.wait_until_ready()
        print(f"Logged in as {self.user}")
        if not self.synced:
            await tree.sync(guild = discord.Object(id=770698123915165747))
            self.synced = True

aclient = client()
tree = app_commands.CommandTree(aclient)

aclient.run(os.getenv("TOKEN"))            
slate swan
#

you cant have 2 command trees afaik

light night
#

https://mystb.in/CondosLogicDiagnostic.txt

 async def interaction_check(self, interaction: discord.Interaction):

        owner_check = await interaction.client.is_owner(interaction.user)
        print(f"1. {owner_check}")
        print(f"2. {self.ctx.author.id != interaction.user.id}")
        print(f"3. {self.ctx.author.id != interaction.user.id or not owner_check}")

        if self.ctx.author.id != interaction.user.id or not owner_check:
            return await interaction.response.send_message(
                content=f"You Can't Use that button, {self.ctx.author.mention} is the author of this message.",
                ephemeral=True,
            )

        return True

so what's up with my check?
only works when owner + author
Meant to work with author clicking on button or bot owner clicking on it

kind mulch
#

how do I make it so when someone sends a specific word that it gets deleted?

#

cuz this doesnt work

little ether
#

!d discord.Message.delete

unkempt canyonBOT
#

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

Deletes the message.

Your own messages could be deleted without any proper permissions. However to
delete other people’s messages, you need the [`manage_messages`](https://discordpy.readthedocs.io/en/master/api.html#discord.Permissions.manage_messages "discord.Permissions.manage_messages")
permission...
kind mulch
#

o

bitter perch
#

therefore the if will succeed

sick birch
bitter perch
zealous jay
#

thanks

sick birch
#

Or does it also use the command tree, but for regular commands?

bitter perch
#

it has interop now

#

with hybrid commands and support for commands inside cogs

sick birch
#

Ah hybrids, was mentioned here a few times. I'll have to check that out

spice adder
#
g = client.get_guild(507364684924452896)
@client.event
@commands.command()
async def banlist(ctx):
    try:
        bans = await g.bans()
        banids = [banentry.user.id for banentry in bans]
        f = open("banlist.txt", "w")
        for id in banids:
          if re.find('(?i)(\balt\b)', ban.reason):
              f.write(str(id) + '\n')
    except Exception as e:
        print("Something happened, probably no perms." + str(e))
    finally:
      f.close()
``` Is there a good way to throttle how quickly it writes each ID in the list? I was thinking sleep but I mainly just don't want to send too many api reqs too fast
sick birch
supple thorn
#

Why do you have a event decorator on your command?

olive osprey
#

lol

zealous jay
#
class test(commands.Cog):
    def __init__(self, client: commands.Bot) -> None:
        self.client = client

@app_commands.command(name="prueba", description="probando")
async def test(self, interaction: discord.Interaction) -> None:
        interaction.response.send_message("Test")

async def setup(client: commands.Bot) -> None:
    await client.add_cog(
        test(client),
        guilds = [discord.Object(id=770698123915165747)]
    )
    print("test.py fue iniciado exitosamente.")

unsupported type annotation <class 'discord.interactions.Interaction'>

error line:

async def test(self, interaction: discord.Interaction) -> None:
#

To be honest, idk whats happening

spice adder
spice adder
supple thorn
spice adder
#

At the time it was Replit, but now I've got a VPS

#

I wonder if that was a replit thing

honest laurel
#

Not sure how rate limit is applied in this case though

supple thorn
#

iirc so he could of gotten ratelimited because of the other bots

supple thorn
spice adder
#

Hmm, so there were other bots running on it?

supple thorn
#

Yes

#

Probably

#

Replit is unfortunately popular for bot hosting

spice adder
#

Makes sense, at the time I really didn't know much about replit, was just using it because free = good

supple thorn
spice adder
supple thorn
#

I should study for the test that's in a couple minutes rather than helping here

supple thorn
#

Or hosting on your vps

spice adder
#

Mhm, replit

supple thorn
spice adder
#

I assumed I bugged something, but in retrospect it was probably just replit

supple thorn
#

I too use replit

supple thorn
kind mulch
#

why isnt this creating a slash command?

supple thorn
#

bussy

honest laurel
spice adder
#

name='bussy'

spice adder
supple thorn
#

I had to go deep in the internet to find a free good one

#

Took like 3 hours

spice adder
#

What'd you end up using?

supple thorn
#

That's free 24/7 without me having to do anything

spice adder
supple thorn
spice adder
zealous jay
zealous jay
supple thorn
zealous jay
#

yes please

zealous jay
#

where are you creating the embed?

#
async def example(ctx):
  em = discord.Embed(title="Title", description="Description")
  await ctx.send(embed = em)
#

should look something like that

#

you can add lots of things tho, for ex

#
em.add_field(name="Name", value="This is just like another description for this section")
#

wait weren't you the one that wanted to make a spam bot

#

anyways

#
class test(commands.Cog):
    def __init__(self, client: commands.Bot) -> None:
        self.client = client

    @app_commands.command(name="probando", description="prueba")
    async def probando(self, interaction: discord.Interaction) -> None:
            interaction.response.send_message("Prueba exitosa.")

async def setup(client: commands.Bot) -> None:
    await client.add_cog(
        test(client),
        guilds = [discord.Object(id=770698123915165747)]
    )
    print("test.py fue iniciado exitosamente.")
#

This is my cog, but the command wont appear on my server.

#

This is my main file, is something wrong?

honest laurel
zealous jay
#

What do you mean

honest laurel
#

You have to register it in your bot

zealous jay
#

Like, loading the extension?

honest laurel
#

Yep

zealous jay
honest laurel
#

And what's about extension setup function?

zealous jay
honest laurel
#

guilds should be list of integers or strings, not discord.Objects

#

Maybe that's the problem

#

try guilds=[7706...]

torn sail
#

no it can be discord.Object

zealous jay
#

hmm

honest laurel
#

Docs say list[Snowflake], so

zealous jay
#

idk if I do the same thing in the main file it works

#

i'll try tho

#

Extension 'cogs.test' raised an error: AttributeError: 'int' object has no attribute 'id'

#

nope

honest laurel
#

Which discordpy version?

honest laurel
#
    .. versionadded:: 2.0
guilds: List[:class:`~discord.abc.Snowflake`]
    If the cog is an application command group, then this would be the
    guilds where the cog group would be added to. If not given then
    it becomes a global command instead. Cannot be mixed with
    ``guild``.

Weird

zealous jay
#

maybe that's not the problem

#

kinda weird

honest laurel
#

Try without the guilds anyway, i'm not sure

zealous jay
#

sure

#

altought if you make it global it takes up to 24hrs to update, that's why im using guild

honest laurel
#

You can also add async cog_load hook to make sure your cog is loaded 🤔

zealous jay
#

where

honest laurel
#

As method in your cog

zealous jay
#

oh

torn sail
#

to a few hrs

zealous jay
#

my bad, idk where I saw that

honest laurel
torn sail
#

global app commands

honest laurel
#

If these are slash commands i guess 🤔 Shouldn't take any time for old fashioned ones

torn sail
#

yeah

zealous jay
#

I'll try again later

slate swan
#

how to get the amount of users are in a guild and set it in presence.

honest laurel
torn sail
#

!d discord.Guild.member_count

unkempt canyonBOT
#

property member_count```
Returns the member count if available.

Warning

Due to a Discord limitation, in order for this attribute to remain up-to-date and
accurate, it requires [`Intents.members`](https://discordpy.readthedocs.io/en/master/api.html#discord.Intents.members "discord.Intents.members") to be specified...
slate swan
#

both works

torn sail
# unkempt canyon

Personally I think this looks better but they’re are the same yes

slate swan
#

!d disnake.Guild.member_count

unkempt canyonBOT
#

property member_count```
Returns the true member count regardless of it being loaded fully or not.

Warning

Due to a Discord limitation, in order for this attribute to remain up-to-date and accurate, it requires [`Intents.members`](https://docs.disnake.dev/en/latest/api.html#disnake.Intents.members "disnake.Intents.members") to be specified.
slate swan
#

cool disnake also have

torn sail
#

It’s fork so most stuff is same

#

Especially things like guilds which doesn’t really change

slate swan
#

yes but some features are not

torn sail
#

Yes but most old stuff is same

slate swan
#

ye

slate swan
slate swan
honest laurel
#

"Huh, no" 😅

slate swan
#

no hikari docs on Python bot

slate swan
#

wo hikari docs are fancy

slate swan
sick birch
slate swan
#

but now fine

paper sluice
#

😔

slate swan
#

it was in canary iirc

paper sluice
#

rip

slate swan
#

space full

#

otherwise ill add more

#

why do you have 4 accounts

slate swan
#

👁️ 👁️

slate swan
#

lol

slate swan
slate swan
#

i also used to logout and login

#

and the pain was

#

anti robot!! one

boreal ravine
#

maybe he's the one the joined with sparky profile pictures

tropic burrow
#

It works

boreal ravine
tropic burrow
#

.I got my answe

boreal ravine
slate swan
#

bots ip ban ppl

tropic burrow
slate swan
#

?

tropic burrow
#

I’m telling to ppl yesterday I found a solution

slate swan
#

okay nice 👍

slate swan
glacial echo
#

i’ve had my bot in a test server (registered by id in the bot initialize thing) and in another server not referenced. why do the commands only show up and work in the test server? i’ve had the bot online for over 24 hours and they still haven’t populated into other servers.

slate swan
#

👀

#

moreover a but can never be online for 24 hors straight

slate swan
slate swan
#

im doing online class

slate swan
slate swan
slate swan
#

:<

#

maths class rn

slate swan
#

yes?

#

but..

#

i removed requirments sadly

slate swan
slate swan
#

str

slate swan
#

wait ill give

slate swan
# slate swan str

huh? how'd you check them then? did you like get the epoch values?

glacial echo
#

but uh why cant i keep my bot online for 24 hours straight?

slate swan
paper sluice
#

u can also do datetime.datetime.strptime()

slate swan
#

..

slate swan
# glacial echo why?

because, the wrapper/api automatically reconnects you to the api after a period of time

sick birch
slate swan
#

oh

sick birch
#

So yes, don't rely on your bot always being online in the sense that it won't disconnect from the gateway

glacial echo
#

i wasnt

glacial echo
#

i meant it is successfully being hosted for over 24 hours at this point, on my rpi, and the commadns are still working without my doing anyhting to it

slate swan
sick birch
sick birch
slate swan
#

^

glacial echo
#

ah, well thats somewhat semantics in this case i guess, as im not doing anythign that qould require NO disconnects

#

just somethign that requires reliable uptime

slate swan
sick birch
#

That's more doable

#

Just store the UNIX timestamp, as was mentioned

glacial echo
#

?

sick birch
#

Oh that was a different question

#

my bad

slate swan
glacial echo
#

is there a convenient library for allowing string parameters to offer spelling errors if what you inputted is close to a viable option but is not actually an option?

pliant gulch
#

!d difflib.get_close_matches

unkempt canyonBOT
#

difflib.get_close_matches(word, possibilities, n=3, cutoff=0.6)```
Return a list of the best “good enough” matches. *word* is a sequence for which
close matches are desired (typically a string), and *possibilities* is a list of
sequences against which to match *word* (typically a list of strings).

Optional argument *n* (default `3`) is the maximum number of close matches to
return; *n* must be greater than `0`...
unkempt canyonBOT
glacial echo
#

other than that i cant think of anything i need to do to it at the moment, since im just waiting for people to make a gif renderer tool and send me gifs

slate swan
pliant gulch
# unkempt canyon

A built in library, not really a spell check but rather a fuzzy search

sick birch
slate swan
#

but it itself returns a warning before execution

glacial echo
#

so with the builtin, if one option is "gemini decomposition" and i type in "gemani decompostio" would it return "gemini decomposition" as a suggestion?

boreal ravine
sick birch
#

Probably some dude's last name

slate swan
pliant gulch
sick birch
pliant gulch
#

So yes

sick birch
#

By soviet mathematician in 1965, how interesting!

slate swan
#

👀

sick birch
#

I do love myself some tidbits of programming history

pliant gulch
paper sluice
#

now i wanna make a fuzzy string matcher

fossil flume
#

how do i go about making a bot

slate swan
fossil flume
#

pins are cnfusing

little ether
fossil flume
#

oh ok

nimble plume
#

Meme

slate swan
#

any better idea to do this?

        listmy = []
        listmy2 = []
        adsf = int(winlimit)
        for xd in range(adsf+1):
          ac = random.choice(dsd)
          if ac not in listmy and ac != self.bot.user.id:
              listmy.append(ac)
``` i dont want to repeat the same id in list
#

dsd is a list of ids

#

anyone?

#

or

#

how can i choose like x items from a list with random and there not same

slate swan
slate swan
slate swan
#

👍 thanks

slate swan
#

;-; dont

supple thorn
supple thorn
#

!e ```py
duck = {}
print(type(duck))

unkempt canyonBOT
#

@supple thorn :white_check_mark: Your eval job has completed with return code 0.

<class 'dict'>
supple thorn
#

Hmm

slate swan
#

duck

supple thorn
#

duc

slate swan
slate swan
#

wait what

#

Lmao

supple thorn
#

Told you

slate swan
supple thorn
#

!e ```py
duck = set()
print(type(duck))

unkempt canyonBOT
#

@supple thorn :white_check_mark: Your eval job has completed with return code 0.

<class 'set'>
supple thorn
#

@slate swan empty set

slate swan
#

!e

#

okay im fucked up

supple thorn
#

Invalid

slate swan
#

!e
myset = set()

myset.add("noob")
print(myset)

print(type(myset))

#

nice

#

well yeah use that

unkempt canyonBOT
#

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

001 | {'noob'}
002 | <class 'set'>
supple thorn
#

I now go back to practicing golfing code

#

Also hi ashley

slate swan
supple thorn
#

It is now my summer break

slate swan
supple thorn
slate swan
#

no

#

i have a limit

#

winlimit

slate swan
slate swan
#

i need that amout of ids

#

not less

#

and if random.choice is same

#

the for loop will continue

#

and miss 1 value

#

..

#

not sure u can understand or not

slate swan
#

Hi people

#

Pls help me with this error:

Ignoring exception in on_command_error
Traceback (most recent call last):
  File "C:\Users\Divi\AppData\Local\Programs\Python\Python310\lib\site-packages\disnake\client.py", line 531, in _run_event
    await coro(*args, **kwargs)
  File "d:\Shrey\Python\3P Pie\script.py", line 42, in on_command_error
    await asitems.set_embed(embed, ctx, True)
  File "d:\Shrey\Python\3P Pie\asitems.py", line 19, in set_embed
    msg = await context.reply(embed=object)
  File "C:\Users\Divi\AppData\Local\Programs\Python\Python310\lib\site-packages\disnake\ext\commands\context.py", line 398, in reply
    return await self.message.reply(content, **kwargs)
  File "C:\Users\Divi\AppData\Local\Programs\Python\Python310\lib\site-packages\disnake\message.py", line 1868, in reply
    return await self.channel.send(content, reference=reference, **kwargs)
  File "C:\Users\Divi\AppData\Local\Programs\Python\Python310\lib\site-packages\disnake\abc.py", line 1504, in send
    data = await state.http.send_message(
  File "C:\Users\Divi\AppData\Local\Programs\Python\Python310\lib\site-packages\disnake\http.py", line 420, in request
    raise HTTPException(response, data)
disnake.errors.HTTPException: 400 Bad Request (error code: 50035): Invalid Form Body
In message_reference: Unknown message
#

I wanted to make a purge command ;-;

slate swan
#

!e

import random
se2 = set()
list2 = [1,2,3,4,5,6,7,8,9,10]
for x in range(8):
    se2.add(random.choice(list2))
print(se2)
unkempt canyonBOT
#

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

{2, 3, 5, 6, 8, 9}
slate swan
#

or i do
!e

import random
se2 = set()
list2 = [1,2,3,4,5,6,7,8,9,10]
limit = 9
while len(se2) != limit:
    se2.add(random.choice(list2))
print(se2)
unkempt canyonBOT
#

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

{1, 2, 3, 4, 5, 6, 7, 8, 10}
boreal ravine
#

#bot-commands

slate swan
#

or like this?

#

bro i need help

#

so dont

slate swan
slate swan
#

feel free to help

slate swan
# slate swan no

you can try updating the presence after some time the bot is started

slate swan
#

it happens because the cache isn't populated with all the servers yet

#

i’m not sure where to implement the code part

slate swan
#

i haven’t use lightbulb or hikari for long

slate swan
slate swan
#

ah

#

yeah

#

thats the issue

#

i meant does the code go into the name part

#

yeah i’m not so well with hikari

#

anything under bot.run won't get executed

#

or lightbulb

#

no like

#

it’s within the bot.run

#

that’s how i have the presence

#

the activity kwarg?

#

oh, that wont work because of the cache thing i told earlier

slate swan
#

yeah so how would you write that properly then

#

i remember trying to do a task loop with the presence but i gave up since it was too confusing and annoying to deal with

#
from lightbulb.ext import tasks

tasks.load(bot)

@tasks.task(m= minutes)
async def my_task()
   # update presence
#

you can start this task using my_task.start() in a StartedEvent

#

right, which one is it to show all users in the guild presented on the status of the bot

#

Guild.member_count

#

why don’t they have an easier way of explaining how to use half the things on there

#

you need to give some time reading the docs

slate swan
#

@slate swan i'm using lightbulb too

#

yeah, ik

slate swan
boreal ravine
#

Does anyone wanna make a simon says bot with me

slate swan
boreal ravine
slate swan
boreal ravine
#

What are you trying to do?

slate swan
#

i have a list and i want to append x number of items randomly with no repeat

boreal ravine
#

x number of items to?

slate swan
#

set

slate swan
#

@slate swan AttributeError: type object 'Guild' has no attribute 'member_count'

#

@boreal ravine ??

#

@slate swan it's giving me this
<property object at 0x00000278337C2040>
<property object at 0x00000278337C2040>
<property object at 0x00000278337C2040>
<property object at 0x00000278337C2040>

vale wing
# slate swan this works but any better way?

Actually it's better to remove the item from the original list every time it gets selected

from random import choice
final_result = []
initial_values = list(range(10))
for i in range(5):
    x = choice(initial_values)
    initial_values.remove(x)
    final_result.append(x)```
#

Cause with sets you do many unnecessary operations

slate swan
#

guild needs to be an instance of hikari.Guild, not the class

slate swan
# slate swan did you just directly wirte Guild.member_count there?
@bot.listen(hikari.StartedEvent)
async def status_task(event):
    while True:
        await bot.update_presence(activity=hikari.Activity(type=hikari.ActivityType.WATCHING, name="over"))
        await asyncio.sleep(10)
        guild = bot.cache.get_guild(guild_id)
        print(guild)
        print(f"{guild.member_count}")
#

is this wrong

#

ah

#

nope it should be correct

#

but you dont use a while True loop in a task~

#

yeah it's just giving me this error

AttributeError: 'NoneType' object has no attribute 'member_count'
slate swan
slate swan
slate swan
#

*show, *your

slate swan
#

guild_id = '973310535556825130'

#

needs to be an integer, not string

#

remove those 's

#

that's what i did

slate swan
#

print(f"{guild.member_count}")
AttributeError: 'NoneType' object has no attribute 'member_count'
I 2022-05-11 22:54:12,360 hikari.bot: started successfully in approx 10.46 seconds
None

#

yeah i didn't mean to put it in a string

slate swan
#

ah

#

it works now when i use the main server

slate swan
#

gives me this

#

is the bot added in that server?

slate swan
#

recheck the Id

slate swan
#

make sure its an integer, and it's guild.member_count

slate swan
#

for some reason

#

@slate swan breaks when i add it into "name"

tropic burrow
#

so i decided to change the joke api, nothing prints at all
Code:

elif message.content.startswith("Joke Pyramid"):
        def get_joke():
            data = requests(f)
            tt = json.loads(data.text)
            return tt
        f = r"https://official-joke-api.appspot.com/random_ten"
        a = get_joke(f)

        for i in (a):
            print(i["type"])
            print(i["setup"])
            print(i["punchline"], "\n")
slate swan
#
guild_id = int(952259827915178094)
@bot.listen(hikari.StartedEvent)
async def status_task(event):
    guild = bot.cache.get_guild(guild_id)
    await bot.update_presence(activity=hikari.Activity(type=hikari.ActivityType.WATCHING, name=f"there is {guild.member.count} in the server"))
    await asyncio.sleep(10)
    print(guild)

@slate swan

honest laurel
#

I assume your guild might not be in cache yet?

slate swan
# honest laurel What's the problem?

await bot.update_presence(activity=hikari.Activity(type=hikari.ActivityType.WATCHING, name=f"there is {guild.member.count} in the server"))
AttributeError: 'NoneType' object has no attribute 'member'

#

no it's cached

honest laurel
#

But it's None

slate swan
#

yes but it was just working

slate swan
honest laurel
slate swan
honest laurel
#

Maybe don't use it since you only run this function on startup

slate swan
#

well i'm going to put it in a task

#

but it works it's just not working in the presence

honest laurel
#

perhaps because you updated presence and it might have updated the cache somehow? 😅

#

That would be my guess

tropic burrow
honest laurel
slate swan
#

because the bots been in there for a minute

#

just use a task

#

cacheing takes place every time the bot restarts

slate swan
#

and then use a task to update presence?

#

@slate swan i did it but it's still not working in the presence

#

when i add it to name

#

it works but it's giving me the same error

await bot.update_presence(activity=hikari.Activity(type=hikari.ActivityType.WATCHING, name=f"over {guild.member_count} users in the server"))

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

spice adder
#

Not sure what I did wrong here, but this raises an exception: UnboundLocalError: local variable 'f' referenced before assignment

@client.command()
@commands.has_role('BotStuff')
async def banlist(ctx):
    try:
        bans = await guild.bans()
        banids = [banentry.user.id for banentry in bans]
        f = open("banlist.txt", "w")
        for id in banids:
          if re.find('(?i)(\balt\b)', ban.reason):
            f.write(str(id) + '\n')
    except Exception as e:
        print("Something happened." + str(e))
    finally:
        f.close()
slate swan
#
@bot.event
async def on_ready():
    await bot.change_presence(status=discord.Status.idle, activity=discord.Game("k.help | lazy sound"))
    print("Kiff connected")```
#

warn(message, DistributionWarning, stacklevel=0)
Ignoring exception in on_ready
Traceback (most recent call last):
File "C:\Users\User\AppData\Local\Programs\Python\Python310\lib\site-packages\nextcord\client.py", line 417, in _run_event
await coro(*args, **kwargs)
File "C:\Users\User\Desktop\discord bot\bot.py", line 11, in on_ready
await bot.change_presence(status=discord.Status.idle, activity=discord.Game("k.help | lazy sound"))
File "C:\Users\User\AppData\Local\Programs\Python\Python310\lib\site-packages\nextcord\client.py", line 1198, in change_presence
await self.ws.change_presence(activity=activity, status=status_str)
File "C:\Users\User\AppData\Local\Programs\Python\Python310\lib\site-packages\nextcord\gateway.py", line 614, in change_presence
raise InvalidArgument('activity must derive from BaseActivity.')
nextcord.errors.InvalidArgument: activity must derive from BaseActivity.

woven bane
#

any idea on how to solve this?

slate swan
#

bruh

#

why are u importing that

#

it doesnt exist

#

just import discord

woven bane
#

oh

#

Must've been watching an outdated video

slate swan
#

pip install -U git+https://github.com/Rapptz/discord.py (you need python 3.8 or later)

woven bane
#

ok thanks that fixed it

wraith moat
#

Is there any website where I can get any type of API, that can be used unlimited time and is free to use?

vale wing
#

Openapi or smth

stiff gorge
#

only these r needed for slash commands right ?

placid skiff
#

Yup

stiff gorge
#

ok

#
    @app_commands.command(name="test", description="Testing")
    async def testreason_slash(self, interaction: Interaction, reason: str="Unspecified"):
        await interaction.response.send_message(reason, ephemeral=True)

is anything wrong in this ?

placid skiff
#

slash commands requires up to 1 hour to be registered globally

stiff gorge
#

ohhh

#

ok ty

slate swan
slate swan
void cove
#

is there a dank here

#

pls dep all

#

Nope no dank

fluid zodiac
#

i have menu that doing role selection, everything working fine when you select role but when you remove role its doing "This interaction failed" and getting the next error:

Traceback (most recent call last):
  File "E:\Softwares\PyCharm\PyCharm 2021.3.3\pythonProject\venv\lib\site-packages\nextcord\ui\view.py", line 371, in _scheduled_task
    await item.callback(interaction)
  File "E:\Softwares\PyCharm\PyCharm 2021.3.3\pythonProject\DiscordBot\main.py", line 289, in callback
    await interaction.response.send_message("Your role list has been modified.", ephemeral=True)
  File "E:\Softwares\PyCharm\PyCharm 2021.3.3\pythonProject\venv\lib\site-packages\nextcord\interactions.py", line 800, in send_message
    await adapter.create_interaction_response(
  File "E:\Softwares\PyCharm\PyCharm 2021.3.3\pythonProject\venv\lib\site-packages\nextcord\webhook\async_.py", line 189, in request
    raise NotFound(response, data)
nextcord.errors.NotFound: 404 Not Found (error code: 10062): Unknown interaction

any idea why its happened?

slate swan
#

you are taking too long to respond to the interaction

fluid zodiac
slate swan
#

show code

fluid zodiac
#

you need the callback?

#

its a little bit long ^_^

#
    async def callback(self, interaction):
        self.values.sort()

        if "0x10" in self.values:
            user = interaction.user
            role = nextcord.utils.get(interaction.guild.roles, id=x)
            await user.add_roles(role)
        else:
            user = interaction.user
            role = nextcord.utils.get(interaction.guild.roles, id=x)
            await user.remove_roles(role)

        await interaction.response.send_message("Your role list has been modified.", ephemeral=True)
#

there is like 10 roles in total

#

@slate swan

slate swan
#

and instead of using utils.get, use guild.get_role

#

idk how to defer in nextcord though

fluid zodiac
opaque tapir
#

why dont the interactions work here ?

#
import discord
from discord.ext import commands
from discord_components import DiscordComponents, Select, SelectOption, Button, ButtonStyle
from discord.utils import get

TOKEN = ""

bot = commands.Bot(command_prefix="dp ")


@bot.event
async def on_ready():
    print("We have logged in as {0.user}".format(bot))


@bot.command()
async def send(ctx):
        await ctx.send(components=[
    Select(
        placeholder = 'Currency ',
        options = [
            SelectOption(label="Dank Memer", value="value1"),
            SelectOption(label="Bro", value="value2"),
            SelectOption(label="Mimu", value="value3"),
            SelectOption(label="UnbelievaBoat", value="value4"),
            SelectOption(label="OwO", value="value5"),
            ])])

@bot.event
async def on_select_option(interaction):
        if interaction.values[0] == "value1":
            await interaction.author.send("Menu 1")
        elif interaction.values[0] == "value3":
            await interaction.author.send("Menu 3")
        elif interaction.values[0] == "value4":
            await interaction.author.send("Menu 4")
        elif interaction.values[0] == "value5":
            await interaction.author.send("Menu 5")

bot.run(TOKEN)
fluid zodiac
tropic burrow
#

why wont my bot run on a virtual enviroment

slate swan
slate swan
tropic burrow
#

wait ill show you tje file

fluid zodiac
slate swan
#

and i can see there are errors above

slate swan
manic path
#

How do I get the list all the checks on a command?

slate swan
tropic burrow
#

there

jade tartan
#
    async def on_member_join(self, member):
        print(member)
        await member.send("hello")
        guild = self.client.get_guild(730651046459998218)
        channel = discord.utils.get(member.guild.channels, id=885464532959526913)
        if guild:
            print("guild ok")
        else:
            print("guild not found")
        
        if channel is not None:
            Myembed = discord.Embed(title= f"Welcome",
            description(f"Welcome {member.mention}, You are member {guild.member_count}. \n Please enjoy your stay here and dont forget to read the await [#904279966693355550](/guild/267624335836053506/channel/904279966693355550/)"))
            Myembed.add_field(name="Account Created at:", value=f"<t:{int(member.created_at.timestamp())}:R>" , inline=True))
            await channel.send(embed=Myembed)
        else:
            print("id channel wrong")``` How do you send an embed in cogs form?
slate swan
tropic burrow
#

im using os.getenv()

slate swan
# tropic burrow no
import os
from dotenv import load_dotenv #pip install python-dotenv

load_dotenv()

os.getenv("KEY")

thats how you do away with env vars

tropic burrow
#

so os.getenv("TOKEN")

#

and

slate swan
tropic burrow
#

pip install aint workinmg

slate swan
tropic burrow
#

ok it worked

#

python -3 -m

stray carbon
#
class HelpButtonMenuPages(menus.ButtonMenuPages):

    FIRST_PAGE = ":pagefirst:"
    PREVIOUS_PAGE = ":pageprev:"
    NEXT_PAGE = ":pagenext:"
    LAST_PAGE = ":pagelast:"
    STOP = ":trashcan:"

    def __init__(
        self,
        ctx: commands.Context,
        help_command: "PaginatedHelpCommand",
        options: List[nextcord.SelectOption],
        **kwargs,
    ):
        super().__init__(timeout=300, **kwargs)
        self._ctx = ctx
        self.add_item(HelpDropdown(help_command, options))
        self.help_command = help_command

    async def interaction_check(self, interaction: nextcord.Interaction) -> bool:
        """Ensure that the user of the button is the one who called the help command"""
        return self._ctx.author == interaction.user

How to override stop button here

tropic burrow
#

worked

stray carbon
#

if i simply add @\nextcord.ui.button, it adds another stop button

#

instead of overriding

placid skiff
stray carbon
placid skiff
#

where did you declared the button?

stray carbon
#

in nextcord ext menus?

slate swan
slate swan
tropic burrow
#

thanks

placid skiff
fluid zodiac
# slate swan its `interaction.response.defer()`

for example:

await interaction.response.send_message("Your role list has been modified.", ephemeral=True)
#TO >
await interaction.response.defer("Your role list has been modified.", ephemeral=True)

?

slate swan
#

you should defer it first, then send the response

#

and defer does not take any args

slate swan
#
await inter.response.defer()
# do your stuff

await inter.response.edit_message(....)
fluid zodiac
slate swan
#
await InteractionResponse.defer()
  #kwargs
    #ephemeral: bool | None = False
    #with_message: bool | None = False

those are the kwargs that defer contains

fluid zodiac
placid skiff
slate swan
copper gulch
#

Is there a way to like put 2 bot tokens in a client.run statement?

slate swan
#

!d nextcord.InteractionResponse.defer

unkempt canyonBOT
#

await defer(*, ephemeral=False, with_message=False)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).

Defers the interaction response.

This is typically used when the interaction is acknowledged and a secondary action will be done later.
stray carbon
#

💀

placid skiff
#

I use disnake, that's why i don't have those problems D_D

copper gulch
slate swan
copper gulch
stray carbon
slate swan
stray carbon
#

I need to override it now

#

its for pagination ah

placid skiff
#

It's not builtin nextcord

copper gulch
stray carbon
slate swan
# copper gulch Will it make the commands slower though xd?

no, it will be more of a loss of resources and both of your apps will make requests from the same ip which potentially makes you vulnerable to getting rate-limited. Thus, you'll get banned from the discord api for making too many requests

placid skiff
#

again there is nothing related to ButtonMenuPages D_D

copper gulch
#

Oh yea

#

I even use replit xd

slate swan
copper gulch
stray carbon
#

there it shows how to remove

#

but i want to override

slate swan
stray carbon
#

what does inherit_buttons do?
I never used it in my code

slate swan
# stray carbon what does inherit_buttons do? I never used it in my code

it wont add the buttons automatically, rather you'd have to explicitly add those, you can the rest of the buttons like

self.add_item(menus.MenuPaginationButton(emoji=self.LAST_PAGE))
#other buttons

and you can create a stop button of your own
in the same class

@nextcord.ui.button()
async def stop_btn(...):
  ...
placid skiff
slate swan
#

most of everything is taken from here

stiff gorge
placid skiff
#

usually you do it by adding a guild_ids = [id] in the slash command decorator

slate swan
supple thorn
#

ewest

placid skiff
#

it's the ewest because it is not the uwuest?

supple thorn
#

I read that with a u

supple thorn
placid skiff
#

btw d.py 2.0 and above are pure hell D_D

slate swan
# stiff gorge how ?
@app_commands.command(...)
@app_commands.guilds(discord.Object(id=guild_id_here), ...)
async def foo(...):
  ...
placid skiff
#

as I said, pure hell

slate swan
#

or you could just do

guild = discord.Object(id=...)
Bot.tree.copy_global_to(guild=guild)
slate swan
# placid skiff as I said, pure hell

tbh, what I think is, dpy devs were gonna implement slash commands like disnake and nextcord and our beloved py-cord ❤️ did
but to make them look somewhat unique, they made some other methods and named the methods something else but totally shat on it

placid skiff
#

beloved py-cord
i think that we can't be friends anymore

slate swan
tropic burrow
#

hey guys so, im making so that if someone is bored discord bot will send a joke

elif message.content.startswith("Joke Pyramid"):
        def get_joke():
            r = requests.get("https://v2.jokeapi.dev/joke/Any")
            json_data = r.json()
            if json_data["type"] == "single":
                return json_data["joke"]
            elif json_data["type"] == "twopart":
                return "\n".join([json_data[x] for x in ["setup","delivery"]])
            else:
                return f"Sorry, I dont know how to tell a joke of type {json_data['type']}"
        
        joke = get_joke()
        await message.channel.send(joke)
    elif any(word in msg for word in boring_words):
        await message.channel.send(random.choice(before_joke))
        Joke = get_joke()   
        await message.channel.send(Joke)

however the bot just sends the first message and gives an error for the second one: Joke = get_joke() UnboundLocalError: local variable 'get_joke' referenced before assignment

#

do i have to redefine it?

placid skiff
#

i think that py-cord devs instead of drinkin' coffee to wake up they drunk alcohol, otherwise there is not other ways to explain how that package is so bad

paper sluice
#

Real coding happens after drinking alcohol

slate swan
gilded gust
slate swan
placid skiff
#

Ashley you are too young yet for alcohol D_D

placid skiff
#

we can't help you on makin' it but we can answer your question and resolve your issues

slate swan
placid skiff
#

to add a role to an user first of all you will need the member id (if you have the guild object) or the member object (if you don't have the guild object) of the user

#

!d discord.Member.add_roles then you will need to use this method

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/master/api.html#discord.Role "discord.Role")s.

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

Nope, I'm a freelancer in my free time so I develop bots for others D_D

paper sluice
#

No

#

I don't even make for others xD

placid skiff
#

really sad Phx_PepoLMAO

#

My contact details are on my page... And that remembers to me that i need to pay the hosting D_D

#

Tysm i will answer during launch (1 hour from my local time)

#

Yup

#

I will answer to you later, now I can't

supple thorn
#

Lmao that's the first time i've seen someone want to talk in email here

#

hamster

#

Blvck will

#

If you pay him

#

no

#

I will be playing games

maiden fable
#

@slate swan what happened?

#

Do u need help with something?

#

What type of bot do you need help with?

#

Well, it's easy. U can make one yourself too

#

And that's bad practice. We can help you learn the discord.py library and help u code the bot, if u r willing

granite parcel
#
    @warns.command()
    async def enable(self, ctx):
        db = sqlite3.connect('warns.db')
        cursor = db.cursor()
        cursor.execute(f"SELECT guild_id FROM warn WHERE guild_id = {ctx.guild.id}")
        result = cursor.fetchone()
        if result is None:
            cursor.execute(f"INSERT INTO warn(guild_id) VALUES(?)", ctx.guild.id)
            await ctx.send(f"Enabled Warns for {ctx.guild}")
        db.commit()
        cursor.close()
        db.close()```
#

Command raised an exception: ValueError: parameters are of unsupported type

#

why?

stiff gorge
#
  @commands.hybrid_command(name="hyb")
  async def ping_command(self, ctx: commands.Context) -> None:
    await ctx.send("Hello!")

do i need to add guild id in this command ?

maiden fable
#

Well, your wish

#

If u want the commands to appear immediately then yes

#

I got a ping?

#

Well, I can help u to some extent, rn

#

Sure

stiff gorge
#
  @commands.hybrid_command(name="hyb")
  @app_commands.guilds(discord.Object(id=guild id here)
  async def hyb_command(self, ctx: commands.Context) -> None:
    await ctx.send("Hello!")

so its like this ?

maiden fable
#

Well sure, u can do it now. I have a few min

#

?

#

Uh

loud junco
#

bruh

#

english everywhere here

maiden fable
#

No? I don't speak it

#

Okay?

loud junco
#

and what do u want to do with that =.=

#

dont tell me its ur bot's password

#

even the hacker will give up after looking at the list

maiden fable
#

!resources

unkempt canyonBOT
#
Resources

The Resources page on our website contains a list of hand-selected learning resources that we regularly recommend to both beginners and experts.

stiff gorge
#
raise errors.ExtensionFailed(key, e) from e
discord.ext.commands.errors.ExtensionFailed: Extension 'cogs.slash_cmnd' raised an error: AttributeError: 'ellipsis' object has no attribute 'id'
    @app_commands.command(name="test", description="Testing")
    @app_commands.guilds(discord.Object(id=845317571301081158),...)
    async def testreason_slash(self, interaction: Interaction, reason: str="Unspecified"):
        await interaction.response.send_message(reason, ephemeral=True)
loud junco
#

Python tutorial - Python full course for beginners - Go from Zero to Hero with Python (includes machine learning & web development projects).
🔥 Want to master Python? Get my Python mastery course: http://bit.ly/35BLHHP
👍 Subscribe for more Python tutorials like this: https://goo.gl/6PYaGF

👉 Watch the new edition: https://youtu.be/kqtD5dpn9C8

📕...

▶ Play video
paper sluice
loud junco
#

🤣
maybe im mosh who knows

maiden fable
#

Nah, he is a popular youtuber

loud junco
#

the first video i watched from him is about html

jade tartan
#
        for roles in roles_list:
            role = discord.utils.get(member.guild.roles, name=roles)``` Is this how to give out autorole to members?
loud junco
#

alright

slate swan
heavy folio
#

!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/master/api.html#discord.Member "discord.Member") join or leaves a [`Guild`](https://discordpy.readthedocs.io/en/master/api.html#discord.Guild "discord.Guild").

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

good news there is russian subtitle

#

learn python first 🤦 one step at a time
dont be me

#

i did that and suffer a lot

#

dont follow me

jade tartan
# slate swan if u add in in a on_member_join event
@commands.Cog.listener()
    async def on_member_join(self, member, ctx):
        print(member)
        await member.send("hello")
        guild = self.client.get_guild(730651046459998218)
        channel = discord.utils.get(member.guild.channels, id=885464532959526913)
        if guild:
            print("guild ok")
        else:
            print("guild not found")
        
        if channel is not None:
            Myembed = discord.Embed(title= f"Welcome",
            description=(f"Welcome {member.mention}, You are member {guild.member_count}. \n Please enjoy your stay here and dont forget to read the await #rules"))
            Myembed.add_field(name="Account Created at:", value=f"<t:{int(member.created_at.timestamp())}:R>" , inline=True)
            await ctx.send(embed=Myembed)
        else:
            print("id channel wrong")```
#

um

supple thorn
#

@jade tartan why is there ctx

#

!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/master/api.html#discord.Member "discord.Member") join or leaves a [`Guild`](https://discordpy.readthedocs.io/en/master/api.html#discord.Guild "discord.Guild").

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

There is only member as the argument

#

That wouldn't work

jade tartan
loud junco
#

no thats not for you
thats the code he asks for help to fix

jade tartan
#

thats for me

slate swan
#

what will u even do with that?

#

u can easily get something like that on github lmao

loud junco
#

but he doesnt understand english

#

he legit google translate every sentence we are sending to understand them

slate swan
loud junco
#

but how is he suppose to understand those codes

slate swan
#

if he learns python

jade tartan
#

dude r u saying that i am dumb

loud junco
slate swan
#

he can use it

jade tartan
#

ohh ok

loud junco
#

LOL

slate swan
loud junco
#

ya

#

germany guy that only know russian 🤣

jade tartan
#

in my opinion

maiden fable
maiden fable
#

Same

loud junco
#

tbh i still dont understand classes 100%

slate swan
#

im too lazy to learn

maiden fable
#

Same

slate swan
#

but i use classes to add buttons

loud junco
maiden fable
#

I totally dk u can define a class with the class keyword and u can subclass by the syntax class A(B) and u need the self as the first arg everywhere except in static method

loud junco
#

i totally knows everything (according to your logix)

maiden fable
#

Is what I would say

slate swan
#

i learnt python using yt first

loud junco
slate swan
#

then realised i was dumb

#

and bought a course on udemy

maiden fable
#

I have been coding in Python since almost 2 years now but still learning new things

#

Meh, YT sucks for Python
I went for the trial and error way

slate swan
#

then i repeated what i knew
basic stuff like for loops and stuff

#

and decided not to learn more
and start making bots

keen dust
#

cool

loud junco
keen dust
#

I wanna try combining a bot with selenium now

slate swan
#

huh

slate swan
#

what will u do with that?

loud junco
#

im still wondering why autocode exist

#

is it for people that thinks they are programmer

keen dust
#

Still deciding

loud junco
#

the code from autocode is working but its legit trash ||dont ask how i know||

unkempt canyonBOT
slate swan
#

something like this?

keen dust
#

ye

loud junco
#

english ;-;

maiden fable
#

Just scrape discord.com

keen dust
#

Django and flask are good too

keen dust
slate swan
loud junco
#

--

slate swan
#

--a--

loud junco
#

what is boring

maiden fable
#

~~Hi~~

slate swan
#

a

loud junco
#

oo

#

hehehehe

granite parcel
#

someone can help?

supple thorn
granite parcel
#
                cursor.execute(f"SELECT reason FROM warn WHERE member = {member.id}")
                mss = cursor.fetchall()
                cursor.execute(f"SELECT by FROM warn WHERE member = {member.id}")
                by = cursor.fetchall()
                await ctx.send(f"{member} was Warned for {mss} by {by} {len(mss)} times")```
granite parcel
#

Godlike#4631 was Warned for [('s',), ('s',), ('wtf',), ('s',), ('s',), ('s',)] by [(951819397973041213,), (951819397973041213,), (951819397973041213,), (951819397973041213,), (951819397973041213,), (951819397973041213,)] 6 times

loud junco
#

what on earth is this

granite parcel
#

i want them in list

slate swan
supple thorn
#

I have a high suspicion that this is a database problem

granite parcel
#

with new line

slate swan
#

its a database

loud junco
#

i mean the indent

#

its so far away 🤣

supple thorn
#

Hopefully

maiden fable
#

its inside a class method

loud junco
#

looks like a biggggggg loop in a loop in a loop

slate swan
loud junco
granite parcel
granite parcel
loud junco
#

just do
for ms in mss?

granite parcel
#

i use it like iterable?

loud junco
#

i think every list is iterable

#

I THINK

granite parcel
#

lemmie try

loud junco
#

👍

loud junco
granite parcel
#

no i think i am unable to do it

maiden fable
granite parcel
loud junco
granite parcel
#

?

loud junco
#

if its iterable then its iterable

#

u cant give it =.=

granite parcel
#

i was talking about query

scarlet sorrel
#

how do you print/see all the guilds you bot is part of?

sage otter
#

!d discord.Client.guilds

unkempt canyonBOT
sage otter
#

@granite parcel can you show your select statement that selects the warn reason and the person who warned them

sage otter
#

If you want them in tandem like matched with each other

#

You should be selecting both rows together in the same statement

#

SELECT reason, by FROM warn WHERE member = ?

granite parcel
#

how to show them differently

sage otter
sage otter
granite parcel
sage otter
#

Yeah you can do that with what I just said. You just gotta do some magic.

scarlet sorrel
sage otter
#

For example
[f"for {r} by {b}" for r, b in listhing]

#

And just join that new list into a string

granite parcel
#

Godlike#4631 was Warned for [('s', 951819397973041213), ('s', 951819397973041213), ('wtf', 951819397973041213), ('s', 951819397973041213), ('s', 951819397973041213), ('s', 951819397973041213)] | 6 times

#

i am getting this now

scarlet sorrel
#

you dont have to define them

#

i see you are very new to python

granite parcel
#

yeah

loud junco
scarlet sorrel
#

no

scarlet sorrel
#

but even i know what it is

#

if i could remember the name

sick stream
#

does anybody know how to create voice channel using discord.py

slate swan
scarlet sorrel
slate swan
unkempt canyonBOT
#
Not in a million years.

No documentation found for the requested symbol.

slate swan
#

!d discord.Guild.create_voice_channel

unkempt canyonBOT
#

await create_voice_channel(name, *, reason=None, category=None, position=..., bitrate=..., user_limit=..., rtc_region=..., video_quality_mode=..., overwrites=...)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).

This is similar to [`create_text_channel()`](https://discordpy.readthedocs.io/en/master/api.html#discord.Guild.create_text_channel "discord.Guild.create_text_channel") except makes a [`VoiceChannel`](https://discordpy.readthedocs.io/en/master/api.html#discord.VoiceChannel "discord.VoiceChannel") instead.

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

idk probably in the docs somewhere

slate swan
supple thorn
#

Hi okimii

slate swan
#

you missed the package name and the class name

sage otter
slate swan
#

tyler slow

slate swan
sage otter
#

I had to go for a bit.

slate swan
sage otter
#

And I just saw his message and didn’t scroll.

#

So I just responded. Idk

slate swan
#

im just joking around hahha

supple thorn
#

Same thing with me sometimes

slate swan
#

🏂

supple thorn
slate swan
#

in nextcord's bot it would have come

slate swan
#

twitters docs is just something else

supple thorn
#

My docs better

#

Somewhat

slate swan
supple thorn
#

Hi sarth

slate swan
#

ello

supple thorn
#

Didn't think you're awake

slate swan
#

im online for 21 hrs these days.

supple thorn
#

Why do i have a suspicion that's a couple avatar

sage otter
#

I’m surprised people are actually still using forks.

#

Especially dead weight libraries like nextcord and pycord

slate swan
#

only fork i would use is nextcord when v3 comes out which it wouldnt be a fork either way but epic still doesnt work on it😔

#

nextcord wont be a fork soon, they are rewriting it from the base

supple thorn
slate swan
maiden fable
supple thorn
#

I just finished my 3rd final exam

#

It's summer now

slate swan
#

hunter worrying about sarthak such a lovely friendship

supple thorn
#

I hate english

slate swan
supple thorn
#

Mostly because they ask me how i feel

slate swan
supple thorn
#

Most of the questions are about how i feel about a story or poem

#

And then make me write about a new poem or story

#

Which makes me pull words out of my ass

#

And hope for the best

#

I did better in math than in english

#

!ot

unkempt canyonBOT
slate swan
sage otter
supple thorn
#

I like disnake

sage otter
#

Everyone does

vocal plover
slate swan
sage otter
#

I knew he’d show up.

slate swan
#

vco always shows up when nextcord is said😭

supple thorn
vocal plover
#

Well since it seems like you're unwilling to actually justify your point I guess it holds no weight lol

supple thorn
#

I always struggle for 2 seconds with typing your name

vocal plover
slate swan
#

vco stop lurking and work on v3

#

😡

maiden fable
vocal plover
#

I can't because epic never pushes their code PainChamp

slate swan
#

push epic

vocal plover
#

I'll find a cliff

slate swan
vocal plover
#

no lol

maiden fable
#

But I payed u to say "Yes" 😔

#

Why betray

vocal plover
#

It's just that I have literally 2 non-vc-text channels unmuted here and it's very easy to lurk both kek

gaunt ice
#
import brain
#

whaaa

#

this works

#

guys

maiden fable
#

!pypi brain

unkempt canyonBOT
gaunt ice
#

pls check whether my abt me is like this

maiden fable
#

Hm well

sage otter
# vocal plover dead weight how?

I mean in reality all of them are dead or had their purpose erased with the revival of dpy. Seeing how most if not all forks just made to continue what Danny started. And now that he’s back to finish I find that there is no point anymore. Just an opinion. Don’t get too hung up on it.

timber kindle
#
async def nickname(ctx, member: discord.Member, nickname):
  await member.edit(nick=nickname)
  await ctx.send(f'Nickname for {member.mention} was changed to {nickname}')```

my bot isn't outputting anything when I run  ?nickname in my server...  it doesn't even give an error or anythng
vocal plover
#

I'd disagree, we have different thoughts on how the library and parts of it should be structured, and maintained. I respect that it's that way for you of course, but having a bunch of different ways of doing it mean that people can choose the one that works well for them

timber kindle
vocal plover
maiden fable
slate swan
#

or if you have an on_message event without process_commands, change it to a listener

maiden fable
#

That too

supple thorn
#

Hi exe

vale wing
#

For example just compare implementation of slash commands in disnake and in dpy

slate swan
#

disnakes and nexcords implementation are the best imo

timber kindle
#
Traceback (most recent call last):
  File "/home/runner/Rolands-Final-Project/venv/lib/python3.8/site-packages/discord/ext/commands/core.py", line 85, in wrapped
    ret = await coro(*args, **kwargs)
  File "main.py", line 51, in nickname
    await member.edit(nick=nickname)
  File "/home/runner/Rolands-Final-Project/venv/lib/python3.8/site-packages/discord/member.py", line 681, in edit
    await http.edit_member(guild_id, self.id, reason=reason, **payload)
  File "/home/runner/Rolands-Final-Project/venv/lib/python3.8/site-packages/discord/http.py", line 248, in request
    raise Forbidden(r, data)
discord.errors.Forbidden: 403 Forbidden (error code: 50013): Missing Permissions

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

Traceback (most recent call last):
  File "/home/runner/Rolands-Final-Project/venv/lib/python3.8/site-packages/discord/client.py", line 343, in _run_event
    await coro(*args, **kwargs)
  File "main.py", line 95, in on_command_error
    raise error
  File "/home/runner/Rolands-Final-Project/venv/lib/python3.8/site-packages/discord/ext/commands/bot.py", line 939, in invoke
    await ctx.command.invoke(ctx)
  File "/home/runner/Rolands-Final-Project/venv/lib/python3.8/site-packages/discord/ext/commands/core.py", line 863, in invoke
    await injected(*ctx.args, **ctx.kwargs)```

This is the error message I got
slate swan
#

if it comes to complexity
making app commands with forks is easier than discord.py

vale wing
#

I've migrated to disnake when the dpy was discontinued and now I have no will to come back to dpy although I have tried it several times

slate swan
#

dpy kinda overcomplicated

vale wing
frozen patio
timber kindle
vale wing
#

!d discord.on_member_remove

unkempt canyonBOT
#

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

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

This requires [`Intents.members`](https://discordpy.readthedocs.io/en/master/api.html#discord.Intents.members "discord.Intents.members") to be enabled.
vale wing
timber kindle
vale wing
#

"Missing Permissions" accurately describes the issue

vale wing
timber kindle
#

wait, since I'm the server owner can it not edit my nickname?

vale wing
#

Lmao no ofc

sage otter
# vocal plover I'd disagree, we have different thoughts on how the library and parts of it shou...

In reality that’s not the reason for the mass migration to forks. Do you think the average user would care about how the library is structured on the inside. Very unlikely, they just care about usability. I will admit, some forks might have better implementations than dpy in some areas such as slash commands. However, the likely reason for migration is rather, less complex. It’s because of the fact the library was known as dead and people wanted to switch to something that would continue to keep up with discords changes to the api. I suspect that is also the reason why people took up the task of creating forks.

vale wing
#

Nobody can edit nickname of server owner

#

Oh heck essays

sage otter
#

In all, I won’t lie. It’s all about opinions and what works better for you.

vocal plover
#

Yeah totally

#

fyi I didn't mean the internals I meant the user-facing API of the lib

sage otter
#

I misunderstood then, I took up that because you said "should be structured and maintained"

vocal plover
#

Yep that was bad phrasing on my part sorry

granite parcel
#

hello

maiden fable
#

helo