#discord-bots

1 messages ยท Page 642 of 1

pliant gulch
#

Git doesn't come preinstalled with linux

#

Not with Arch linux at least

sick birch
#

Oh, it's probably in the AUR and quite simple to install then

#

probably why i don't remember doing it haha

pliant gulch
#

You can just do pacman, you don't need to download git from the AUR

sick birch
#

Yeah, i probably did something like that during or after install

pliant gulch
#

Are you on arch as well?

sick birch
#

Yep

pliant gulch
#

Samsies

#

๐Ÿ‘

sick birch
#

Arch buddies haha

polar ice
#

installing git now

sick birch
#

Great, git will come in handy a lot when you want to have version control for your bot

#

Or just installing things directly from git

polar ice
#

@sick birchYeah it will help loads, thanks ๐Ÿ™‚

#

Okay so i installed it

#

but its saying 1.7 still

  Attempting uninstall: discord.py
    Found existing installation: discord.py 1.7.3
    Uninstalling discord.py-1.7.3:
      Successfully uninstalled discord.py-1.7.3
    Running setup.py install for discord.py: started
    Running setup.py install for discord.py: finished with status 'done'
Successfully installed discord.py-2.0.0a3575+g45d498c1
WARNING: You are using pip version 20.2.3; however, version 21.3.1 is available.
You should consider upgrading via the 'C:\Users\Jorda\AppData\Local\Programs\Python\Python39\python.exe -m pip install --upgrade pip' command.
#

oh wait..

sullen shoal
#

its done

sick birch
polar ice
#

command not found

sullen shoal
#

use what you used to install it

#

replace pip3 with that

sick birch
#

just try pip list then

polar ice
#

Tried both, i used git to install

sullen shoal
polar ice
sullen shoal
#

thats git

#

try it on a terminal

sick birch
#

Oh my, pip not found?

#

That's never fun

#

I'm not fully sure how you can fix that

polar ice
#

Terminal not working either, could it be because i use pycharm?

sullen shoal
#

they're doing it in the git cli

polar ice
#

sorry to be a nuisance ๐Ÿ˜„

sullen shoal
#

py -m pip show discord

#

also after all this is done, run py -m ensurepip

polar ice
#

yay says v2

polar ice
#

Now just how to get it working in pycharm? ๐Ÿ˜„

sullen shoal
#

pycharm is just an ide, you have to select the right python interpreter in the settings to get it working

sick birch
#

if you do pip list does it show anything installed?

polar ice
#

C:\Users\Jorda>py -m pip list
Package           Version
----------------- --------------------
aiohttp           3.7.4.post0
async-timeout     3.0.1
attrs             21.2.0
cffi              1.15.0
chardet           4.0.0
discord.py        2.0.0a3575+g45d498c1
idna              3.3
multidict         5.2.0
pip               20.2.3
pycparser         2.21
PyNaCl            1.4.0
setuptools        49.2.1
six               1.16.0
typing-extensions 4.0.0
yarl              1.7.2
WARNING: You are using pip version 20.2.3; however, version 21.3.1 is available.
You should consider upgrading via the 'C:\Users\Jorda\AppData\Local\Programs\Python\Python39\python.exe -m pip install --upgrade pip' command.```
sick birch
#

You can now go about and use all the new features

polar ice
#

just having a flick through the link above

sullen shoal
#

reminder: the official discord.py will not implement slash commands, to use them you have to implement it yourself. (you can use third party outdated extensions but you wont get any help for them in the official support server. there are alot of them, most people now use forks instead of them so you may not get help anywhere but the extension's support server)

polar ice
#

@sullen shoalDo i just set Venv Enviroment to the new discord.py directory?

sullen shoal
#

idk about venvs, seems like you have to install it again

sick birch
sick birch
#

I assume you haven't created your own venv using the specific commands, so no

polar ice
#

This is how i have it set up :/

sullen shoal
#

also, the person who is managing the slash commands of disnake knows what they're doing, their implementation of slash command is beautiful

#

they powered doc strings for command description and param description

sick birch
#

Well that's new

#

Most of the lib devs i've talked to were going to implement type hinting for param description

sullen shoal
#

getting descriptions for params and the command is as easy and beautiful as this

polar ice
#

Still cant figure out how to get discord working on pycharm ๐Ÿ˜„

sick birch
#

What's the problem?

#

You should just be able to import discord and get going

polar ice
#

I tried to install it on the intrepreter and it installed v1.72 again ๐Ÿ˜„

sullen shoal
#

i dont really suggest using pycharm unless you're experienced with all this, you should be using vscode or other editors like sublime, atom if you're not experienced with it

lethal moat
#

is there a way to asyncio.sleep till a player completes a "task"? i am making an rpg bot so i need it for that

lapis socket
#

This code isnt working for me for some reason

@bot.command()
async def collatz(self,ctx,num:int):
  if num > 1000000000:
    await ctx.send('man thats too big of a number i dont want to die today')
    return
  tree=Tree()
  tree.create_node('1',1)

  def do(num):
    if (num % 2 == 0):
        return num // 2
    else:
        return num * 3 + 1

  def run(num):
      chain=[num]
      while (num != 1):
          num = do(num)
          chain.insert(0,num)

      for i in range(1,len(chain)):
          tree.create_node(str(chain[i]),chain[i],parent=chain[i-1])

  async with ctx.channel.typing():
    run(num)

    text = str(tree)
    selected_font = "./fonts/ARIAL.TTF"
    font_size = 50

    img = Image.new('RGBA', (0,0), (255, 255, 255,0))
    font = ImageFont.truetype(selected_font, font_size)
    draw = ImageDraw.Draw(img)
    text_size = draw.textsize(text, font)

    img = img.resize(text_size)
    draw = ImageDraw.Draw(img)
    draw.text((0,0), text, (255,255,255), font,)
    

    with BytesIO() as image_binary:
          img.save(image_binary, 'PNG')
          image_binary.seek(0)
          await ctx.send(file=discord.File(fp=image_binary, filename='image.png'))

Context: I am trying to create a discord bot that does collatz conjecture

polar ice
#

@final iron Ive installed Conda

final iron
#

pip install -U git+https://github.com/Rapptz/discord.py

#

Also try this

polar ice
#

@final iron Created a virtual enviroment

#

tried that cmd and nothing

final iron
#

You need git installed

#

It just worked for me

polar ice
#

ive got git installed

#

2 secs

final iron
#

Take a screenshot of command prompt

polar ice
final iron
#

You need to activate the virtual environment

#

conda activate <your venv name here>

#

then pip install

#

Also no need for git to be open. You do this all in windows cmd

#

Can you also type python in to command prompt and see if its actually installed properly?

polar ice
#

typed python took me to the appstore to download

#

๐Ÿ‘€

final iron
#

You don't type the <>

sick birch
#

I don't think they're using anaconda

final iron
#

Oh miniconda

#

They're using miniconda

sick birch
#

Are they?

final iron
#

Yes

sick birch
#

Oh i see

final iron
#

@polar ice I would suggest you use regular anaconda

polar ice
#

anaconda it says

final iron
#

Its miniconda

polar ice
#

Why is it so difficult ๐Ÿ˜ฎ

final iron
#

How long have you been using it?

polar ice
#

oh okay, Ive literally just downloaded it

sick birch
polar ice
#

You suggested to use it? I just want to get discord.py v2 working through pycharm ๐Ÿ˜ฆ

sick birch
#

I personally think that regular old python would be much easier

#

you can create and activate a venv with 2 lines

final iron
#

Same with anaconda

polar ice
#

im a noob ๐Ÿ˜„

final iron
#

I've never had any issue with it

sick birch
#

I don't think they have any specific reason to use anaconda for the time being

#

@polar ice if you just import discord and try it like normal, is it 2.0?

#

sorry wrong ping

#

because i remember seeing your pip list has 2.0.0a for discord.py

polar ice
#

@sick birch my pip list says 2.0 now in cmd window but in pycharm it still installs v1.7

sick birch
#

Oh yikes

#

How are you checking it on PyCharm?

final iron
polar ice
#

No ive changed it back to python

sick birch
#

pithink that would explain it

polar ice
sick birch
#

I'm not really sure about PyCharm as i use vscode and it works flawlessly with this sort of thing

#

Try restarting your pycharm

#

it's showing some sort of error at the bottom

final iron
#

Honestly this is one of the reasons I like anaconda. If something goes wrong I can just nuke the environment

sick birch
#

๐Ÿ˜‚ if only everything was that easy

final iron
#

It was for me

polar ice
#

restarted pycharm

final iron
#

I would honestly suggest never doing anything in the global python libraries

final iron
#

Have you successfully installed it yet?

polar ice
#

@final iron No ๐Ÿ˜ฆ for the sake of me i cant figure it out ๐Ÿ˜ฆ

final iron
#

Are you willing to reinstall your entire python installation?

sick birch
#

That would fix up everything

polar ice
#

sure

sick birch
#

How would one uninstall python pithink

final iron
polar ice
#

doing it now ๐Ÿ™‚

final iron
#

Find python and uninstall it

polar ice
#

going to re-install pycharm also

final iron
#

What python version are you using?

cyan hare
#

how is command prefix like

#

for a discord bot

polar ice
#

python 10 now

#

via the website, just installing

iron river
#

i am just starting python ๐Ÿ˜ž

final iron
#

I'm not sure if it's supported

#

Try 3.9

#

I know thats supported

upbeat otter
polar ice
#

@final ironokay ill install 3.9

#

Okay installed ๐Ÿ™‚

#

Want me to re-install discord.py with those 3 commands?

tropic palm
#

how to add multiple permissions here? I wanted to add admin perms with ban perms

sullen shoal
#

!d all

unkempt canyonBOT
#
all

all(iterable)```
Return `True` if all elements of the *iterable* are true (or if the iterable is empty). Equivalent to:

```py
def all(iterable):
    for element in iterable:
        if not element:
            return False
    return True
polar ice
#

Okay python re-installed and discord.py v2 installed

upbeat otter
polar ice
#

@final iron Where too now, re-install pycharm?

sullen shoal
slate swan
#

Why not use has_permissions check?

upbeat otter
slate swan
#

^ yea

tropic palm
#

thanks

tame lion
slate swan
#

umm, i have a doubt

#

how do we

#

add voting option to our bbot

sullen shoal
slate swan
#

hello

#

u guys making bots ?

#

or just finding

prisma spoke
#

i have an unreg command

async def unregister(ctx):


    with open("usersforteams.json", "r") as f:
        users = json.load(f)

    if str(ctx.author.id) in users:
        with open("usersforteams.json", "w"):
            users.pop(str(ctx.author.id))
        await ctx.send("You have been unregistered!")


    else:
        return await ctx.send("You have not registered!")``` this shud remove user if it is registered from the json but this, along with the user removes the `{}` too
#

how to solve?

upbeat otter
#

and not dumping them back

#

popping should be outside

#

and dump the results

prisma spoke
upbeat otter
#

do you know how to use json files with python?

prisma spoke
#

oh

prisma spoke
upbeat otter
prisma spoke
upbeat otter
#

do it outside

#

and dump the results while opening the file in write mode

#

otherwise it clears everything inside the json

prisma spoke
#

then how will it pop

#

it didnt work yesterday

upbeat otter
# prisma spoke then how will it pop
with open("whatever.json") as f:
  users = json.load(f)
if str(ctx.author.id) in users:
  users.pop(str(ctx.author.id))
with open("whatever.json", "w") as f:
  json.dump(users, f)

like this

prisma spoke
#

it didnt pop yesterday lemme try again

upbeat otter
#

xD

prisma spoke
#

breuh

upbeat otter
prisma spoke
#

wait what

#

it didnt pop yesterday i- swear

#

@upbeat otter thx tho

outer violet
outer violet
# upbeat otter wdym

how would i remove the brackets and the quotations cuz i want it to look like rep, r instead

upbeat otter
#

they will work like normal commands

#

doesnt matter

outer violet
upbeat otter
outer violet
# sage otter `", ".join()`

would this be right

value=f"{command.help}\n**Aliases:** {", ".join(command.aliases) if command.aliases else 'None'}")```
visual island
#

dont use double quote inside f string expression

sage otter
#

^

#

Yeah that works.

upbeat otter
sage otter
#

Aliases?

upbeat otter
#

commands

#

an embed cant handle more than 50 fields

sage otter
#

I doubt heโ€™s making a field for every command.

upbeat otter
#

uh okay

sage otter
#

If so he can just use pagination.

outer violet
sage otter
#

๐Ÿ‘Œ

sullen shoal
upbeat otter
sullen shoal
#

idk it was 25 since i started making bots

tiny ibex
#

Can someone tell me WTF is ctx_menus_core.send

sullen shoal
#

custom Context i think

upbeat otter
#

oh yeah

#

its 25 fields as of now

boreal ravine
upbeat otter
narrow notch
#

Hi

#

How do I get the server Id?

#

await ctx.guild.id?

upbeat otter
boreal ravine
unkempt canyonBOT
sullen shoal
boreal ravine
#

๐Ÿ‘Œ

slate swan
unkempt canyonBOT
slate swan
#

oooo

prisma spoke
#
@client.command()
async def show(ctx):


    users = await get_user_info()


    
    m = nextcord.Embed(title="The users who have registered for the tournament are as follows:-")
    m.add_field(name="users",value=users )
    await ctx.send(embed=m)

@client.command()
async def clearregs(ctx):
    with open("usersforteams.json","r") as f:
        users = json.load(f)

    with open("usersforteams.json", "w") as f:
        json.dump({},f)  

    await ctx.send("Cleared all registrations!")



@client.command(aliases=["reg"])
async def register(ctx, ign:str, uid:int):


    with open("usersforteams.json", "r") as f:
        users = json.load(f)


    if str(ctx.author.id) in users:
        return await ctx.send("You have already registered!")
    elif str(ign) in users:
        return await ctx.send("This in-game name already exists!")
    elif str(uid) in users:
        return await ctx.send("This in-game name already exists!")
    else:
        users[str(ctx.author.id)] = {}
        users[str(ctx.author.id)]["IGN"] = ign
        users[str(ctx.author.id)]["UID"] = uid
        await ctx.send("You have been registered")

    
    with open("usersforteams.json", "w") as f:
        json.dump(users,f)
    return True

async def get_user_info():
    with open("usersforteams.json", "r") as f:
        users = json.load(f)
    return users

@client.command(aliases=["unregmem"])
@commands.has_permissions(administrator=True)
async def unregister_member(ctx, user:nextcord.User):


    with open("usersforteams.json", "r") as f:
        users = json.load(f)

    if str(user.id) in users:    
        users.pop(str(user.id))
            

        with open('usersforteams.json', 'w') as f:
            users = json.dump(users, f)

        await ctx.send("The user has been unregistered!")


    else:
        return await ctx.send("The user has not registered!")


@client.command(aliases=["unreg"])
async def unregister(ctx):


    with open("usersforteams.json", "r") as f:
        users = json.load(f)

    if str(ctx.author.id) in users:    
        users.pop(str(ctx.author.id))
            

        with open('usersforteams.json', 'w') as f:
            users = json.dump(users, f)

        await ctx.send("You have been unregistered!")


    else:
        return await ctx.send("You have not registered!")``` i want it to display like users = (user.id) and ign=(ign) uid=(uid) how to arrange it in that way/.?
boreal ravine
prisma spoke
#

input

#

from the reg command

outer violet
#

how do i change the defualt error message?

async def send_error_message(self, error):
        channel = self.get_destination()
        embed = discord.Embed(
            title="Error",
            description=error,
            color=0xFF4040,
            timestamp=datetime.utcnow()
        )
        await channel.send(embed=embed)
tacit fog
#

how do i solve this error??

outer violet
tacit fog
outer violet
#

you forgot the s

outer violet
#

wait

#

im wrong lol

tacit fog
#

lol

outer violet
#

i dont have an error handler for command not found

#

am i supposed to make one

#

@prisma spoke

prisma spoke
outer violet
#

command*

prisma spoke
#

1 ur error handler is wrong

#

It goes with client.event

outer violet
#

im subclassing help command

prisma spoke
outer violet
prisma spoke
#

After the self,error there shud be commands.CommandsNotFound

#

Like this u have to state

soft radish
#

how can i make multiple channels?

prisma spoke
prisma spoke
soft radish
slate swan
#

how can I make a queue command

prisma spoke
soft radish
#

like alot

prisma spoke
#

And cha he the name

#

Change*

soft radish
#

oh so ill just copy paste that over and over?

prisma spoke
#

Yes and cha ge the namw

heavy radish
#

Hello guys

prisma spoke
heavy radish
#

Long time

prisma spoke
vernal marten
#

Try this (if it works)

@client.command()
async def create_new(ctx, names=None):
    
    if ctx.message.author is not ctx.guild.owner:
        return await ctx.send("You're not Owner from this Server")
    
    if str(names) is None:
        names = "default"
    
    await ctx.guild.create_text_channel(f"{names}")
    await ctx.send(f"New Text Channel Created. Name: {names}")
soft radish
upbeat otter
maiden fable
kind fern
#

How do I timestamp the bot to EST?

tacit fog
#

it still error

#

๐Ÿค”

kind fern
tacit fog
#

wait

prisma spoke
#

Please ๐Ÿฅบ

upbeat otter
prisma spoke
tacit fog
#

oh no

upbeat otter
prisma spoke
upbeat otter
prisma spoke
#

How to make it show

#

Like arrange in a column form....kinds thing if u get meh

upbeat otter
#

I dont get it ,-, what're you tryna say

prisma spoke
#

But in an arrange way

prisma spoke
upbeat otter
#

using ctx.send()

upbeat otter
soft radish
#

im trying to clean up my mess

upbeat otter
velvet tinsel
#

hi eevee ๐Ÿ˜„

velvet tinsel
urban shell
# tacit fog xd

try something like -

a = random.choice(responses)
await ctx.send(f'Question: {question}\nAnswer: {a}')
prisma spoke
#

In that way

upbeat otter
#

an example-

urban shell
tacit fog
#

my brain almost die

urban shell
#

you've imported random right?

tacit fog
#

yea

urban shell
#

aight

#

so try something like this now

upbeat otter
#
with open("ign.json") as f:
  ign_data = json.load(f)
with open("uid.json") as f:
  uid_data = json.load(f)
uid_for_user = uid_data[str(ctx -------)
ign_for_user = ign_data[str(ctx--------)

await ctx.send(f"IGN: {ign_for_user}\nUID: {uid_for_user}")
upbeat otter
#

for declaring a useless variable

tacit fog
#

hmmm

urban shell
#

@tacit fog

i = random.randint(0, 4)
await ctx.send(f'Question: {question}\nAnswer: {responses[i]}')
urban shell
#

your code does seem right

#

but I don't really know what's wrong

#

bruh

#

I'm just making him try other options

tacit fog
#

No way it work!

urban shell
#

lessgooo

tacit fog
#

tysm!

#

lets gooo

urban shell
#

np ๐Ÿ˜„

tacit fog
#

๐Ÿ˜ƒ

boreal ravine
urban shell
#

but it didn't work for him

boreal ravine
#

The i is so extra

upbeat otter
boreal ravine
upbeat otter
#

Just why

tacit fog
#

xd

urban shell
upbeat otter
#

thats brave

urban shell
#

indeed

tacit fog
boreal ravine
#

I didn't even do anything bruh

tacit fog
#

xd

upbeat otter
#

but why didnt random.choice work ,-,

urban shell
#

idek

urban shell
#

I was wondering the same

#

I can't tell unless I see his entire code

upbeat otter
#

sem

#

anyways, imma go die now, bai bai

boreal ravine
#

You don't need to see his entire code though

urban shell
#

nothing seems wrong with his imports

#

he imported random correctly

#

or else randint wouldn't have worked either

boreal ravine
urban shell
#

I'm just assuming

#

from his response

boreal ravine
#

@tacit fog show your imports

urban shell
#

bruh

#

just let it be

tacit fog
urban shell
#

his problem has been solved

tacit fog
#

and

urban shell
#

oh...

tacit fog
boreal ravine
# tacit fog

* is the problem ๐Ÿคฆโ€โ™‚๏ธ

urban shell
#

you could've just imported random

visual island
urban shell
#

like-
import random

boreal ravine
#

^^

tacit fog
#

okok

boreal ravine
#

The random module doesn't even have a random object

urban shell
#

๐Ÿ˜ฉ

visual island
#

!d random.random

unkempt canyonBOT
#

random.random()```
Return the next random floating point number in the range [0.0, 1.0).
visual island
#

it exists

boreal ravine
#

my bad then, but he used it wrongly

upbeat otter
tacit fog
#

dont look xd

upbeat otter
#

I'll pass

velvet tinsel
#

Me no like code on mobile no matter how big or small

manic wing
#

why are you deleting your messages

prisma spoke
#

not only for that user only

upbeat otter
#
for users in ign_data:
      print(users["whatever"])
prisma spoke
#

SuS lemme try

dire folio
#

So I used datetime.now() but it's really specific, does anyone know what will give me just the date and not the time?

maiden fable
unkempt canyonBOT
#

discord.utils.format_dt(dt, /, style=None)```
A helper function to format a [`datetime.datetime`](https://docs.python.org/3/library/datetime.html#datetime.datetime "(in Python v3.9)") for presentation within Discord.

This allows for a locale-independent way of presenting data using Discord specific Markdown...
maiden fable
#

!d time.time returns the unix time

unkempt canyonBOT
#

time.time() โ†’ float```
Return the time in seconds since the [epoch](https://docs.python.org/3/library/time.html#epoch) as a floating point number. The specific date of the epoch and the handling of [leap seconds](https://en.wikipedia.org/wiki/Leap_second) is platform dependent. On Windows and most Unix systems, the epoch is January 1, 1970, 00:00:00 (UTC) and leap seconds are not counted towards the time in seconds since the epoch. This is commonly referred to as [Unix time](https://en.wikipedia.org/wiki/Unix_time). To find out what the epoch is on a given platform, look at `gmtime(0)`.

Note that even though the time is always returned as a floating point number, not all systems provide time with a better precision than 1 second. While this function normally returns non-decreasing values, it can return a lower value than a previous call if the system clock has been set back between the two calls.
velvet tinsel
#

Hai Hunter

prisma spoke
# upbeat otter ```py for users in ign_data: print(users["whatever"]) ```
async def showall(ctx):



    with open("usersforteams.json","r") as f:
        users = json.load(f)
    ids = users[str(ctx.author.id)] = {}
    ign = users[str(ctx.author.id)]["IGN"]
    uid = users[str(ctx.author.id)]["UID"] 

    for users in ids,ign,uid:
        embed=nextcord.Embed(title=f"{ctx.author.mention} The details of all the users registered are as follows:-")
        embed.add_field(name="User IDs", value=uid)
        embed.add_field(name="In-Game Names", value=ign)
        embed.add_field(name="ID's", value=ids)
    
    await ctx.send(embed=embed)```?
velvet tinsel
#

Oh no big code but whatโ€™s wrong

#

Me no like big code on mobile ๐Ÿ˜ญ

upbeat otter
coral flame
velvet tinsel
slate swan
#

How do I make my discord bot online 24/7? ( i am ready to pay for it too )

velvet tinsel
#

in reality I can see perfectly well. Itโ€™s just the fact that Iโ€™m on a car and I get motion sick

#

๐Ÿคข

slate swan
gaunt ice
#

ye

prisma spoke
velvet tinsel
#

Or buy Linode

slate swan
#

that's exactly what i wanted to know from here

velvet tinsel
#

Thatโ€™s what @unkempt canyon is hosted from

#

There are a few others but I forgor ๐Ÿ’€

gaunt ice
#

forgor lol

velvet tinsel
#

They donโ€™t reveal what they are hosted on, dank memer

upbeat otter
#
with open("usersforteams.json","r") as f:
        current_data = json.load(f)
if str(ctx.author.id) in users:
  pass
else:
   ids = current_data[str(ctx.author.id)] = {}
   ign = current_data[str(ctx.author.id)]["IGN"]
   uid = current_data[str(ctx.author.id)]["UID"] 
with open("usersforteams.json", "w") as f:
  json.dump(users, f)
with open("usersforteams.json") as f:
  users = json.load(f)
for data in users:
  embed = nextcord.Embed(title=f"{ctx.author.name} your details whatever")
  embed.add_field(name="User IDs", value=users["UID"])
  embed.add_field(name="In-Game Names", value=users["IGN"])
#

^

velvet tinsel
#

Or a VPS

upbeat otter
#

just see the indentation

prisma spoke
#

wait

velvet tinsel
#

thatโ€™s what most bots are hosted on

upbeat otter
#

hmm

prisma spoke
#

i am making a show cmd

#

not dump

upbeat otter
#

what

velvet tinsel
#

Showโ€ฆcommand?

upbeat otter
#

then dont new blocks for users

velvet tinsel
#

๐Ÿ˜• me no understand

upbeat otter
#

just cut out that code

velvet tinsel
#

Ok Eevee seems to be doing fine

#

Why are you listening to animals

#

Eevee

prisma spoke
#

@upbeat otter ```py
@client.command()
async def showall(ctx):

with open("usersforteams.json","r") as f:
        current_data = json.load(f)

ids = current_data[str(ctx.author.id)] = {}
ign = current_data[str(ctx.author.id)]["IGN"]
uid = current_data[str(ctx.author.id)]["UID"] 

with open("usersforteams.json") as f:
    users = json.load(f)
for data in users:
    embed = nextcord.Embed(title=f"{ctx.author.name} your details whatever")
    embed.add_field(name="User IDs", value=users["UID"])
    embed.add_field(name="In-Game Names", value=users["IGN"])
    await ctx.send(embed=embed)````
upbeat otter
#

its all wrong

#

you need to make a new section for users who have not registered?

prisma spoke
#

it wud only show the users hwo have registered

#

not those who havent

#

means the users from the json file

upbeat otter
velvet tinsel
#

amazingโ€ฆ10 minutes of looking on the phone and I havenโ€™t thrown up yet or felt queasy. I think this is a new superpower of mineโ€ฆ

velvet tinsel
prisma spoke
# upbeat otter cut out this then ```py ids = current_data[str(ctx.author.id)] = {} ign = cu...
async def showall(ctx):



    with open("usersforteams.json","r") as f:
            current_data = json.load(f)


    with open("usersforteams.json") as f:
        users = json.load(f)
    for data in users:
        embed = nextcord.Embed(title=f"{ctx.author.name} your details whatever")
        embed.add_field(name="User IDs", value=users["UID"])
        embed.add_field(name="In-Game Names", value=users["IGN"])
        await ctx.send(embed=embed)
#

?

upbeat otter
prisma spoke
#

and?

upbeat otter
#

fix the ctx.author.name

#

you need to get the members first then use their names

upbeat otter
#

using client.get_user

#

or bot,get_user, whatever

prisma spoke
#
        users = json.load(f)
    for data in users:
        embed = nextcord.Embed(title="your details ")
        embed.add_field(name="User IDs", value=users["UID"])
        embed.add_field(name="In-Game Names", value=users["IGN"])
        await ctx.send(embed=embed)```
upbeat otter
prisma spoke
#

not for only a user

upbeat otter
prisma spoke
#

i just want to display their ids

#

alll the users in the json

upbeat otter
prisma spoke
# upbeat otter then add the {users["id"]} in title
Traceback (most recent call last):
  File "C:\Python310\lib\site-packages\nextcord\ext\commands\core.py", line 168, in wrapped
    ret = await coro(*args, **kwargs)
  File "c:\Users\admin\Downloads\underdev.py", line 36, in showall
    embed.add_field(name="User IDs", value=users["UID"])
KeyError: 'UID'

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

Traceback (most recent call last):
  File "C:\Python310\lib\site-packages\nextcord\client.py", line 351, in _run_event
    await coro(*args, **kwargs)
  File "c:\Users\admin\Downloads\underdev.py", line 25, in on_command_error
    raise error
  File "C:\Python310\lib\site-packages\nextcord\ext\commands\bot.py", line 995, 
in invoke
    await ctx.command.invoke(ctx)
  File "C:\Python310\lib\site-packages\nextcord\ext\commands\core.py", line 895, in invoke
    await injected(*ctx.args, **ctx.kwargs)
  File "C:\Python310\lib\site-packages\nextcord\ext\commands\core.py", line 177, in wrapped
    raise CommandInvokeError(exc) from exc
nextcord.ext.commands.errors.CommandInvokeError: Command raised an exception: KeyError: 'UID'```
upbeat otter
upbeat otter
#

wait

#

send your code

unkempt canyonBOT
#

Hey @prisma spoke!

Uh-oh! It looks like your message got zapped by our spam filter. We currently don't allow .txt attachments, so here are some tips to help you travel safely:

โ€ข If you attempted to send a message longer than 2000 characters, try shortening your message to fit within the character limit or use a pasting service (see below)

โ€ข If you tried to show someone your code, you can use codeblocks
(run !code-blocks in #bot-commands for more information) or use a pasting service like:

https://paste.pythondiscord.com

prisma spoke
#

@upbeat otter

slate swan
#

embed.add_field(name="User IDs", value=data["UID"])

slate swan
upbeat otter
slate swan
#

๐Ÿ‘Ž

#

that wont work

slate swan
#

Just data["UID"]

#

^^^

upbeat otter
slate swan
#

๐Ÿ‘

maiden fable
#

๐Ÿ˜ฌ

prisma spoke
#
Traceback (most recent call last):
  File "C:\Python310\lib\site-packages\nextcord\ext\commands\core.py", line 168, in wrapped
    ret = await coro(*args, **kwargs)
  File "c:\Users\admin\Downloads\underdev.py", line 36, in showall
    embed.add_field(name="User IDs", value=data(str["UID"]))
TypeError: 'type' object is not subscriptable

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

Traceback (most recent call last):
  File "C:\Python310\lib\site-packages\nextcord\client.py", line 351, in _run_event
    await coro(*args, **kwargs)
  File "c:\Users\admin\Downloads\underdev.py", line 25, in on_command_error     
    raise error
  File "C:\Python310\lib\site-packages\nextcord\ext\commands\bot.py", line 995, 
in invoke
    await ctx.command.invoke(ctx)
  File "C:\Python310\lib\site-packages\nextcord\ext\commands\core.py", line 895, in invoke
    await injected(*ctx.args, **ctx.kwargs)
  File "C:\Python310\lib\site-packages\nextcord\ext\commands\core.py", line 177, in wrapped
    raise CommandInvokeError(exc) from exc
nextcord.ext.commands.errors.CommandInvokeError: Command raised an exception: TypeError: 'type' object is not subscriptable```
slate swan
#

Why do you have a str method in there

#

str(data["UID"])

prisma spoke
#
async def showall(ctx):



    with open("usersforteams.json") as f:
        users = json.load(f)
    for data in users:
        embed = nextcord.Embed(title="your details ")
        embed.add_field(name="User IDs", value=data(str["UID"]))
        embed.add_field(name="In-Game Names", value=data(str["IGN"]))
        await ctx.send(embed=embed)
        await ctx.send(data)```
upbeat otter
prisma spoke
#

oh shoot

slate swan
#

It's just data["UID"]

#

Same for ign

prisma spoke
slate swan
#

?

prisma spoke
#

data uid

slate swan
#

error?

#

What's the error

prisma spoke
#
Traceback (most recent call last):
  File "C:\Python310\lib\site-packages\nextcord\ext\commands\core.py", line 168, in wrapped
    ret = await coro(*args, **kwargs)
  File "c:\Users\admin\Downloads\underdev.py", line 36, in showall
    embed.add_field(name="User IDs", value=data["UID"])
TypeError: string indices must be integers

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

Traceback (most recent call last):
  File "C:\Python310\lib\site-packages\nextcord\client.py", line 351, in _run_event
    await coro(*args, **kwargs)
  File "c:\Users\admin\Downloads\underdev.py", line 25, in on_command_error     
    raise error
  File "C:\Python310\lib\site-packages\nextcord\ext\commands\bot.py", line 995, 
in invoke
    await ctx.command.invoke(ctx)
  File "C:\Python310\lib\site-packages\nextcord\ext\commands\core.py", line 895, in invoke
    await injected(*ctx.args, **ctx.kwargs)
  File "C:\Python310\lib\site-packages\nextcord\ext\commands\core.py", line 177, in wrapped
    raise CommandInvokeError(exc) from exc
nextcord.ext.commands.errors.CommandInvokeError: Command raised an exception: TypeError: string indices must be integers```
slate swan
#

str(data["UID"])

#

try dat

upbeat otter
#

Understood

#

good luck figuring out

slate swan
#

users is basically a dict, since you're iterating over it, the "data" will actually be the key, which is in fact the user's discord id which you stored as a string

#

And that's why you get that error

#

๐Ÿ‘

tawdry perch
#
    @commands.command()
    async def get_permissions(self, ctx, role: discord.Role):
        a = ctx.channel.permissions_for(role)
        print(a)
``` I'm trying to get a permissions of specific role in a current channel but it's not working: https://paste.pythondiscord.com/digaqibula.sql
It should be correct
maiden fable
#

Still?

tawdry perch
#

I have not had energy to change to disnake

maiden fable
#

What's your dpy version

tawdry perch
#

1.7 ig or smth like that

maiden fable
shadow wraith
#

how can you specify 2 roles the user should have or atleast have 1 because with @commands.has_role() you can only specify 1 role

maiden fable
unkempt canyonBOT
#

@discord.ext.commands.has_any_role(*items)```
A [`check()`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.check "discord.ext.commands.check") that is added that checks if the member invoking the command has **any** of the roles specified. This means that if they have one out of the three roles specified, then this check will return True.

Similar to [`has_role()`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.has_role "discord.ext.commands.has_role"), the names or IDs passed in must be exact.

This check raises one of two special exceptions, [`MissingAnyRole`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.MissingAnyRole "discord.ext.commands.MissingAnyRole") if the user is missing all roles, or [`NoPrivateMessage`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.NoPrivateMessage "discord.ext.commands.NoPrivateMessage") if it is used in a private message. Both inherit from [`CheckFailure`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.CheckFailure "discord.ext.commands.CheckFailure").

Changed in version 1.1: Raise [`MissingAnyRole`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.MissingAnyRole "discord.ext.commands.MissingAnyRole") or [`NoPrivateMessage`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.NoPrivateMessage "discord.ext.commands.NoPrivateMessage") instead of generic [`CheckFailure`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.CheckFailure "discord.ext.commands.CheckFailure")
tawdry perch
unkempt canyonBOT
maiden fable
shadow wraith
#

ohh

tawdry perch
#

error what?

tawdry perch
shadow wraith
#

ill just guess how @commands.has_any_role works

@bot.command()
@commands.has_any_role('role1', 'role2')
async def ping(ctx):
  await ctx.reply('pong lol')
maiden fable
#

Cool it will work

shadow wraith
#

because i like learning quick

maiden fable
#

Same ngl

shadow wraith
#

yea ๐Ÿ’€

tawdry perch
#

uuh now it broke a import for me

upbeat otter
#

@prisma spoke this should fix the problem

for data in users.items():
  uid = data[1]["UID"]
slate swan
tawdry perch
#
ImportError: cannot import name 'AsyncWebhookAdapter' from 'discord'
#

;-;

#

it worked with 1.7.3

maiden fable
upbeat otter
#

lmao

upbeat otter
slate swan
#

oh it won't

tawdry perch
#

sigh ||installs disnake because I'm desperate||

maiden fable
#

This is a list of breaking changes

upbeat otter
slate swan
#

but still, it's better if you do for key, value in dict.items() instead of just for data in ...

tawdry perch
#
Webhooks are changed significantly: WebhookAdapter is removed, and synchronous requests using requests is now inside SyncWebhook.
``` *intensified pain*
tawdry perch
#

what does that even mean

upbeat otter
#

sadness

maiden fable
upbeat otter
tawdry perch
#

I would tell how I feel about that but I might get banned by that

tawdry perch
#
    async def send_webhook(self, embed: discord.Embed):
        async with aiohttp.ClientSession() as session:
            webhook = Webhook.from_url(self.webhook, adapter=AsyncWebhookAdapter(session))
            return await webhook.send(embed=embed)
``` well this is all of the code I need to change tho
maiden fable
tawdry perch
#

sigh time to install disnake

shadow wraith
upbeat otter
maiden fable
#

Yea

maiden fable
upbeat otter
#

like, they changed avatar_url to avatar.url ๐Ÿฅฒ

#

lmao

slate swan
maiden fable
upbeat otter
shadow wraith
#

๐Ÿ’€

maiden fable
tawdry perch
#

wait... how can I install it as discord? or should I just install as disnake, because I have bunch of files like 11-14 with imports and files that use discord.Embed as example

upbeat otter
#

i'll leave

maiden fable
tawdry perch
#

it was wrong

maiden fable
maiden fable
tawdry perch
maiden fable
#

CTRL Shift F
Search for discord
CTRL D
Change all the occurrences

tawdry perch
#

so I should install it as disnake?

slate swan
#

yes

tawdry perch
maiden fable
#

That search will select in all the files ๐Ÿคฆ

tawdry perch
#

ctrl f does not?

dapper cobalt
maiden fable
maiden fable
#

!d discord.ext.commands.has_any_role

unkempt canyonBOT
#

@discord.ext.commands.has_any_role(*items)```
A [`check()`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.check "discord.ext.commands.check") that is added that checks if the member invoking the command has **any** of the roles specified. This means that if they have one out of the three roles specified, then this check will return True.

Similar to [`has_role()`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.has_role "discord.ext.commands.has_role"), the names or IDs passed in must be exact.

This check raises one of two special exceptions, [`MissingAnyRole`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.MissingAnyRole "discord.ext.commands.MissingAnyRole") if the user is missing all roles, or [`NoPrivateMessage`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.NoPrivateMessage "discord.ext.commands.NoPrivateMessage") if it is used in a private message. Both inherit from [`CheckFailure`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.CheckFailure "discord.ext.commands.CheckFailure").

Changed in version 1.1: Raise [`MissingAnyRole`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.MissingAnyRole "discord.ext.commands.MissingAnyRole") or [`NoPrivateMessage`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.NoPrivateMessage "discord.ext.commands.NoPrivateMessage") instead of generic [`CheckFailure`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.CheckFailure "discord.ext.commands.CheckFailure")
shadow wraith
#

lmfao i did guess the syntax kind of right

maiden fable
#

See, it's not a list

maiden fable
shadow wraith
#

i had experience with had_role

tawdry perch
dapper cobalt
#

I shouldn't think of code while I just woke up.

shadow wraith
#

friendship ended with has_role, has_any_role is my new friend now

tawny arrow
#

i need help with tensorflow and keras

shadow wraith
slate swan
#
  File "C:\Python39\lib\site-packages\discord\ext\tasks\__init__.py", line 101, in _loop
    await self.coro(*args, **kwargs)
  File "c:\Users\rrfda\OneDrive\Desktop\sublime\commands\snipe.py", line 58, in my_loop
    await self.bot.cursor.execute("SELECT blacklisted FROM blacklist")
  File "C:\Python39\lib\site-packages\aiosqlite\cursor.py", line 37, in execute
    await self._execute(self._cursor.execute, sql, parameters)
  File "C:\Python39\lib\site-packages\aiosqlite\cursor.py", line 31, in _execute
    return await self._conn._execute(fn, *args, **kwargs)
  File "C:\Python39\lib\site-packages\aiosqlite\core.py", line 129, in _execute
    return await future
  File "C:\Python39\lib\site-packages\aiosqlite\core.py", line 102, in run
    result = function()
sqlite3.OperationalError: database is locked
``` what does that even mean
maiden fable
slate swan
#

oh fair

#
Command raised an exception: ProgrammingError: Incorrect number of bindings supplied. The current statement uses 1, and there are 3 supplied.``` and this ?
maiden fable
#

Good thing u deleted that message Mini. I already have had an argument yesterday with someone else on that and I ain't in a mood to argue again ๐Ÿ˜‡๐Ÿ˜

slate swan
#

๐Ÿ˜”

maiden fable
#

Ah I know

slate swan
#

oh yeah go ahead

maiden fable
#

U did (var) instead of (var,)

slate swan
#

        await self.bot.cursor.execute("INSERT INTO blacklist VALUES (?)",(stuff,))```
#

like that ?

maiden fable
#

Yea

#

Dude, I now feel like I have already had literally all the errors u all ask now ๐Ÿ˜

still escarp
#

use postgres

maiden fable
slate swan
slate swan
#

heres the error i had while hosting it on my vps

still escarp
maiden fable
still escarp
#

0% downtime + its free

maiden fable
#

See the last line

slate swan
#

oh wait fair

maiden fable
#

Connect Call Failed

slate swan
#

i've got the file with the last code

#

1 sec let me get it

maiden fable
#

Haha sure

slate swan
tawdry perch
#

ok.. how do I import AsyncWebhookAdapter from disnake?

maiden fable
#
Railway

Railway is an infrastructure platform where you can provision infrastructure, develop with that infrastructure locally, and then deploy to the cloud.

tawdry perch
#

Sad..

dapper cobalt
#

If you installed disnake[discord] then just import it from Discord. I believe that's what I did and it worked.

tawdry perch
#

well I will have to wait until I find a way, until that the bot is completely broken

#

I will have to do smth to this ```
Webhooks are changed significantly: WebhookAdapter is removed, and synchronous requests using requests is now inside SyncWebhook.

slate swan
#
python main.py
Traceback (most recent call last):
  File "main.py", line 33, in <module>
    from cogs.music import music
  File "/home/runner/Tirex-Safety/cogs/music.py", line 17, in <module>
    client = pymongo.MongoClient(os.environ.get('dbconn'))
  File "/opt/virtualenvs/python3/lib/python3.8/site-packages/pymongo/mongo_client.py", line 677, in init
    res = uri_parser.parse_uri(
  File "/opt/virtualenvs/python3/lib/python3.8/site-packages/pymongo/uri_parser.py", line 455, in parse_uri
    raise ConfigurationError(
pymongo.errors.ConfigurationError: The "dnspython" module must be installed to use mongodb+srv:// URIs. To fix this error install pymongo with the srv extra:
 /opt/virtualenvs/python3/bin/python -m pip install "pymongo[srv]"
exit status 1
#

Whats the issue

dapper cobalt
slate swan
# dapper cobalt
python main.py
Traceback (most recent call last):
  File "main.py", line 33, in <module>
    from cogs.music import music
ImportError: cannot import name 'music' from 'cogs.music' (/home/runner/Tirex-Safety/cogs/music.py)
#

Now this error

tawdry perch
#

music bot?

slate swan
#

Yes

tawdry perch
#

!ytdl

unkempt canyonBOT
#

Per Python Discord's Rule 5, we are unable to assist with questions related to youtube-dl, pytube, or other YouTube video downloaders, as their usage violates YouTube's Terms of Service.

For reference, this usage is covered by the following clauses in YouTube's TOS, as of 2021-03-17:

The following restrictions apply to your use of the Service. You are not allowed to:

1. access, reproduce, download, distribute, transmit, broadcast, display, sell, license, alter, modify or otherwise use any part of the Service or any Content except: (a) as specifically permitted by the Service;  (b) with prior written permission from YouTube and, if applicable, the respective rights holders; or (c) as permitted by applicable law;

3. access the Service using any automated means (such as robots, botnets or scrapers) except: (a) in the case of public search engines, in accordance with YouTubeโ€™s robots.txt file; (b) with YouTubeโ€™s prior written permission; or (c) as permitted by applicable law;

9. use the Service to view or listen to Content other than for personal, non-commercial use (for example, you may not publicly screen videos or stream music from the Service)
tawdry perch
#

does webhooks really need a token, and what is the token?

slate swan
#
from cogs.AntiChannel import AntiChannel
from cogs.AntiGuild import AntiGuild
from cogs.afk import AFK
from cogs.AntiSpam import onMessage
from cogs.AntiRemoval import AntiRemoval
from cogs.AntiRole import AntiRole
from cogs.AntiWebhook import AntiWebhook
from cogs.moderation import Moderation
from cogs.economy import economy
from cogs.server import server
from cogs.misc import misc
from cogs.snipe import snipe
from cogs.emoji import Emojis
from cogs.extra import extra
from cogs.music import music
#
python main.py
Traceback (most recent call last):
  File "main.py", line 33, in <module>
    from cogs.music import music
ImportError: cannot import name 'music' from 'cogs.music' (/home/runner/Tirex-Safety/cogs/music.py)
#

Code and error

tawdry perch
#

we can't help with music bots afaik

prisma spoke
# slate swan Instead of ```py for data in users: ``` Do ```py for key, value in users.items()...

it worked but py with open("usersforteams.json") as f: users = json.load(f) for key, value in users.items(): embed = nextcord.Embed(title="User Details") embed.add_field(name="User's In-GameIDs", value=value["UID"]) embed.add_field(name="In-Game Names", value=value["UID"]) embed.add_field(name="User Discord Id's", value=key) await ctx.send(embed=embed) its sending it as many times as there is a user means 5 users 5 msgs.. and if put ctx.send outside the for loop its sending one time with one one data

slate swan
#

Really not a music bot

tawdry perch
#

you just told it is

slate swan
#

Its is an security bot

tawdry perch
slate swan
#

But main features

#

Is security bot

tawdry perch
slate swan
#

move the embed = ... above the for loop

dapper cobalt
tawdry perch
#

ah

#

I need to rewrite my webhooks...

dapper cobalt
#

Go to any text channel > intergrations > create new webhook, then copy the token of the one you've created.

urban shell
#

eh

tawdry perch
#

what sort of shutdown?

bronze pilot
#

Has saved me a good amount of time

bronze pilot
#

So far I've seen stuff like bot.close(), ctx.bot.logout(), and using exit()

#

not sure which ones work though, haven't tried them myself

#

๐Ÿ‘

maiden fable
#

O not documented

tawdry perch
#

did you forget it?

maiden fable
#

!d discord.ext.commands.Bot.close

unkempt canyonBOT
#

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

Closes the connection to Discord.
maiden fable
tawdry perch
#

oh

maiden fable
#

!d exit

unkempt canyonBOT
#

quit(code=None)``````py

exit(code=None)```
Objects that when printed, print a message like โ€œUse quit() or Ctrl-D (i.e. EOF) to exitโ€, and when called, raise [`SystemExit`](https://docs.python.org/3/library/exceptions.html#SystemExit "SystemExit") with the specified exit code.
tawdry perch
#

disnake broke my bot ;-;

maiden fable
slate swan
bronze pilot
#

whats disnake lol

maiden fable
unkempt canyonBOT
slate swan
bronze pilot
#

nah you can go ahead lol I didnt really get it

tawdry perch
bronze pilot
#

So far my understanding is it's an alternative to Discord.py

#

right?

maiden fable
#

Cz it is :D

bronze pilot
#

riiight gotcha ๐Ÿ‘

maiden fable
#

I guess give the code and the error?

#

๐Ÿ˜

bronze pilot
#

just start

#

then we'll build from there

tawdry perch
maiden fable
bronze pilot
#

oh ty

maiden fable
bronze pilot
#

just a random picture from Discord's gif library, not my dog

#

wanted something to go with a background colour since I got the 4.99 nitro and not 9.99

unkempt canyonBOT
maiden fable
#

O

unkempt canyonBOT
maiden fable
#

!d discord.Client.user

unkempt canyonBOT
#

property user: Optional[discord.user.ClientUser]```
Represents the connected client. `None` if not logged in.
maiden fable
tawdry perch
boreal ravine
maiden fable
tawdry perch
#

fk

boreal ravine
#

we don't even have to teach how to define things

#

its basic python

maiden fable
#

๐Ÿ˜

tawdry perch
#

disnake sucks I hate my life

maiden fable
#

I'mma Kms

tawdry perch
#

It worked before

#
text="Sample text", icon_url=member.avatar.url,
AttributeError: 'NoneType' object has no attribute 'url'
``` ;-; I gave it a member
#
    @commands.command()
    @restrict_to_user(534738044004335626)
    async def test(self, ctx, member: disnake.Member):    
        content = await self.modlog.send_log_message(
                self, colour=disnake.Color.red(), title=f"{member} | {member.id}", 
                text="Sample text", icon_url=member.avatar.url, 
                footer="Sample footer"
                #thumbnail="Sample thumbnail"
                )
maiden fable
#

!d discord.Member.display_avatar

unkempt canyonBOT
#

property display_avatar: discord.asset.Asset```
Returns the memberโ€™s display avatar.

For regular members this is just their avatar, but if they have a guild specific avatar then that is returned instead.

New in version 2.0.
maiden fable
#

Why tho

bronze pilot
#

Probably to make one of those lvl up or welcome images

#

image on the left, info on the right

maiden fable
#

Not talking about the other docs

bronze pilot
#

?

maiden fable
#

But skis sent sigh

#

So I sent why tho

maiden fable
#

Bruh

#

Won't work in dpy 2.0

boreal ravine
#

nothings wrong

tawdry perch
#

Nah

boreal ravine
tawdry perch
#

No I did not

#

It has been this always

boreal ravine
#

hm

tiny ibex
#

display avatar url IG

prisma spoke
#

how to make a command that creates a file?

boreal ravine
velvet tinsel
#

MKDIR

prisma spoke
#

u do !create json it will create a json file

velvet tinsel
#

!d os.mkdir

unkempt canyonBOT
#

os.mkdir(path, mode=511, *, dir_fd=None)```
Create a directory named *path* with numeric mode *mode*.

If the directory already exists, [`FileExistsError`](https://docs.python.org/3/library/exceptions.html#FileExistsError "FileExistsError") is raised.

On some systems, *mode* is ignored. Where it is used, the current umask value is first masked out. If bits other than the last 9 (i.e. the last 3 digits of the octal representation of the *mode*) are set, their meaning is platform-dependent. On some platforms, they are ignored and you should call [`chmod()`](https://docs.python.org/3/library/os.html#os.chmod "os.chmod") explicitly to set them.

This function can also support [paths relative to directory descriptors](https://docs.python.org/3/library/os.html#dir-fd).

It is also possible to create temporary directories; see the [`tempfile`](https://docs.python.org/3/library/tempfile.html#module-tempfile "tempfile: Generate temporary files and directories.") moduleโ€™s [`tempfile.mkdtemp()`](https://docs.python.org/3/library/tempfile.html#tempfile.mkdtemp "tempfile.mkdtemp") function.

Raises an [auditing event](https://docs.python.org/3/library/sys.html#auditing) `os.mkdir` with arguments `path`, `mode`, `dir_fd`...
prisma spoke
velvet tinsel
#

This?

velvet tinsel
bronze pilot
#

you can just with open() in a command, no?

tiny ibex
#

user.display_avatar.url

velvet tinsel
#

He want to create one

boreal ravine
prisma spoke
#

i am asking my own question i am not helping u

velvet tinsel
#

Not open it

bronze pilot
#

it will create one if it doesnt exist

#

yeah

tiny ibex
#

That should work ig

prisma spoke
velvet tinsel
#

๐Ÿ’€

boreal ravine
#

!with

unkempt canyonBOT
#

The with keyword triggers a context manager. Context managers automatically set up and take down data connections, or any other kind of object that implements the magic methods __enter__ and __exit__.

with open("test.txt", "r") as file:
    do_things(file)

The above code automatically closes file when the with block exits, so you never have to manually do a file.close(). Most connection types, including file readers and database connections, support this.

For more information, read the official docs, watch Corey Schafer's context manager video, or see PEP 343.

bronze pilot
#

bro I gave the simplest example

tiny ibex
#

Hmm but sometimes it causes errors

bronze pilot
#

search it up

velvet tinsel
#

Canโ€™t you just use os

#

!d os.mkdir

unkempt canyonBOT
#

os.mkdir(path, mode=511, *, dir_fd=None)```
Create a directory named *path* with numeric mode *mode*.

If the directory already exists, [`FileExistsError`](https://docs.python.org/3/library/exceptions.html#FileExistsError "FileExistsError") is raised.

On some systems, *mode* is ignored. Where it is used, the current umask value is first masked out. If bits other than the last 9 (i.e. the last 3 digits of the octal representation of the *mode*) are set, their meaning is platform-dependent. On some platforms, they are ignored and you should call [`chmod()`](https://docs.python.org/3/library/os.html#os.chmod "os.chmod") explicitly to set them.

This function can also support [paths relative to directory descriptors](https://docs.python.org/3/library/os.html#dir-fd).

It is also possible to create temporary directories; see the [`tempfile`](https://docs.python.org/3/library/tempfile.html#module-tempfile "tempfile: Generate temporary files and directories.") moduleโ€™s [`tempfile.mkdtemp()`](https://docs.python.org/3/library/tempfile.html#tempfile.mkdtemp "tempfile.mkdtemp") function.

Raises an [auditing event](https://docs.python.org/3/library/sys.html#auditing) `os.mkdir` with arguments `path`, `mode`, `dir_fd`...
velvet tinsel
#

No?

tiny ibex
#

Good then

tawdry perch
tawdry perch
#

disnake has completely broken my webhooks as well

#

why is this incorrect? ```py
async def send_webhook(self, embed: disnake.Embed):
async with aiohttp.ClientSession() as session:
webhook = disnake.Webhook.partial(
self.webhook_id,
self.webhook_token,
session=session
)
return await webhook.send(embed=embed)

#

if the from_url is removed how would it work?

slate swan
#

from url still exists

boreal ravine
tawdry perch
boreal ravine
#
webhook = ctx.channel.webhooks[0]
await webhook.send("yo")
tawdry perch
#

why ya removed that?

#

let me read the docs

boreal ravine
#

!d discord.Webhook.from_url

unkempt canyonBOT
#

classmethod from_url(url, *, session, bot_token=None)```
Creates a partial [`Webhook`](https://discordpy.readthedocs.io/en/master/api.html#discord.Webhook "discord.Webhook") from a webhook URL.
boreal ravine
#

๐Ÿค”

tawdry perch
#

;-;

#
    async def send_webhook(self, embed: disnake.Embed):
        async with aiohttp.ClientSession() as session:
            webhook = disnake.SyncWebhook.from_url(self.webhook, adapter=AsyncWebhookAdapter(session))
            return await webhook.send(embed=embed)
``` how do I replace the `AsyncWebhookAdapter`?
#

!d discord.Webhook.partial

unkempt canyonBOT
#

classmethod partial(id, token, *, session, bot_token=None)```
Creates a partial [`Webhook`](https://discordpy.readthedocs.io/en/master/api.html#discord.Webhook "discord.Webhook").
tawdry perch
boreal ravine
#

o

tawdry perch
#

discord*

boreal ravine
#

oops disnake

#

Am i doing something wrong ๐Ÿค”

tawdry perch
#

seems like it does not exist anymore

boreal ravine
#

hm

tawdry perch
#

it was removed in 2.0

#

how do I send webhooks in disnake ;-;

maiden fable
tawdry perch
#

Ok how do I do that

maiden fable
tawdry perch
#

So like that or not like that?

drifting tulip
#

Where should i ask for github help

tawdry perch
drifting tulip
#

I don't know how to use .gitignore

tawdry perch
#

Wait...

drifting tulip
#

I'm trying to hide my files

maiden fable
drifting tulip
#

A file....

tawdry perch
drifting tulip
#

I put config.json in the gitignore and i can still see it

tawdry perch
#

In where?

drifting tulip
#

the github

tawdry perch
#

You need to remove it from github first

#

And then remove it from commit as well

tawdry perch
drifting tulip
tawdry perch
#

When you do git add, there should be a remove command for untracked files if not, then I can't help.

#

git -rm --cached file.name could be the command

tawdry perch
#

intensified pain of trying stuff

maiden fable
#

Lol

tawdry perch
#
Command raised an exception: InvalidArgument: Invalid webhook URL given.
``` fk off
maiden fable
#

F

slate swan
#

does your url look like https://discord.com/api/webhooks/......... something?

tawdry perch
#

yes

slow fog
#

What the sus

tawdry perch
#

it is

#

I copy pasted the url 3 times by now

#

fk

#

yep url is correct, but it ain't working

#

    async def send_webhook(self, embed: disnake.Embed):
        async with aiohttp.ClientSession() as session:
            webhook = disnake.SyncWebhook.from_url(url=self.webhook, session=session)
            return await webhook.send(embed=embed)
``` why it ain't work ;-;
thick sigil
#

Why are you trying to await a sync method

tawdry perch
#

it's a sync?

thick sigil
#

SyncWebhook

#

sarthak send the right doc

#

sent*

tawdry perch
#
Command raised an exception: TypeError: expected requests.Session not <class 'aiohttp.client.ClientSession'>
``` what session should I pass instead?
tawdry perch
#

sorry it sent twice

#

finally! it works

tawdry perch
#

thank you!

slow fog
#

in aguoms

tawdry perch
#

nice

prisma spoke
#
@bot.command(aliases=["reg"])
async def register(ctx):


    def check(msg):
        return msg.channel == ctx.channel and msg.author == ctx.author

    view1 = Confirm()


    embed=nextcord.Embed(description="Do you wish to continue?", color=nextcord.Color.blurple())
    await ctx.send(embed=embed,view=view1)
    await view1.wait()

    if view1.value is None:
        embed=nextcord.Embed(description=f"โŽ Timed Out!")
        await ctx.send(embed=embed)
    elif view1.value:
        
        try:
            with open("usersforteams.json", "r") as f:
                users = json.load(f)

            channel = await ctx.author.create_dm()

            
            await channel.send("Please enter your in-game name!")
            msg = await bot.wait_for('message', check=check,  timeout=60)
            ign = msg.content
            await channel.send("Please enter your in-game user ID!")
            msg = await bot.wait_for('message', check=check, timeout=60)
            uid = msg.content




            if str(ctx.author.id) in users:
                return await ctx.send("โŽ You have already registered!")
            elif str(ign) in users:
                return await ctx.send("โŽ This in-game name already exists!")
            elif str(uid) in users:
                return await ctx.send("โŽ This in-game user-id already exists!")
            else:
                users[str(ctx.author.id)] = {}
                users[str(ctx.author.id)]["IGN"] = ign
                users[str(ctx.author.id)]["UID"] = uid
                embed=nextcord.Embed(description=f"โœ… You have been registered!")
                await ctx.send(embed=embed)

                
            with open("usersforteams.json", "w") as f:
                json.dump(users,f)
            return True


        except asyncio.TimeoutError:
            embed=nextcord.Embed(title="โŽ Timeout to respond!",description=f"{ctx.author.mention} this process has timed out! Please re-do the process again if you wish to register!")
            await channel.send(embed=embed)
            return
    else:
        embed=nextcord.Embed(description=f"โœ… Process Cancelled! ")
        await ctx.send(embed=embed)
        return``` this wud just send the msg till please enter your in game name then it wud just show timeout error
#

how to solve this?

tawdry perch
tawdry perch
#

in general, what do you think?

maiden fable
prisma spoke
tawdry perch
maiden fable
#

Discord has added the mute button

maiden fable
#

Click on it and the person gets muted

tawdry perch
maiden fable
#

The function gonna be in disnake as soon as discord opens the endpoint to bots

tawdry perch
#

I don't see that

maiden fable
tawdry perch
#

ohh

#

That's a nice feature, so muted role loses the purpose?

maiden fable
prisma spoke
#

it wud just send one msg

tawdry perch
prisma spoke
#

then wudnt send another msg

maiden fable
prisma spoke
tawdry perch
maiden fable
prisma spoke
tawdry perch
#

how do I convert permission integer to permissions object or smth

maiden fable
tawdry perch
#

uu

#

fk

maiden fable
maiden fable
unkempt canyonBOT
#

await edit(*, name=..., permissions=..., colour=..., color=..., hoist=..., mentionable=..., position=..., reason=...)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).

Edits the role.

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.

All fields are optional.

Changed in version 1.4: Can now pass `int` to `colour` keyword-only parameter.

Changed in version 2.0: Edits are no longer in-place, the newly edited role is returned instead.
maiden fable
tawdry perch
prisma spoke
#

even raise error

#

it wud wait until the time

maiden fable
#
# get data from exception
etype = type(exc)
trace = exc.__traceback__

# 'traceback' is the stdlib module, `import traceback`.
lines = traceback.format_exception(etype, exc, trace)

# format_exception returns a list with line breaks embedded in the lines, so let's just stitch the elements together
traceback_text = ''.join(lines)

# now we can send it to the user
# it would probably be best to wrap this in a codeblock via e.g. a Paginator
await ctx.send(traceback_text)โ€Š
prisma spoke
#

as soon as the msg wud come i gave the msg.content

maiden fable
#

Add this in your on_command_error

prisma spoke
maiden fable
#

exc means the exception

#

Read the comments bruv

upbeat otter
#

LMAO

maiden fable
#

Hi there Eevee. Long time :D

prisma spoke
maiden fable
#

Hahaha thanks for the heart

maiden fable
#

Haha cute. Anyways OT too :D

visual island
upbeat otter
prisma spoke
# maiden fable Haha cute. Anyways OT too :D
  File "C:\Python310\lib\runpy.py", line 196, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "C:\Python310\lib\runpy.py", line 86, in _run_code
    exec(code, run_globals)
  File "c:\Users\admin\.vscode\extensions\ms-python.python-2021.11.1422169775\pythonFiles\lib\python\debugpy\__main__.py", line 45, in <module>
    cli.main()
  File "c:\Users\admin\.vscode\extensions\ms-python.python-2021.11.1422169775\pythonFiles\lib\python\debugpy/..\debugpy\server\cli.py", line 444, in main
    run()
  File "c:\Users\admin\.vscode\extensions\ms-python.python-2021.11.1422169775\pythonFiles\lib\python\debugpy/..\debugpy\server\cli.py", line 285, in run_file
    runpy.run_path(target_as_str, run_name=compat.force_str("__main__"))
  File "C:\Python310\lib\runpy.py", line 268, in run_path
    code, fname = _get_code_from_file(run_name, path_name)
  File "C:\Python310\lib\runpy.py", line 242, in _get_code_from_file
    code = compile(f.read(), fname, 'exec')
  File "c:\Users\admin\Downloads\underdev.py", line 79
    await ctx.send(traceback_text)โ€Š
                                  ^
SyntaxError: invalid non-printable character U+200A```
prisma spoke
maiden fable
prisma spoke
upbeat otter
maiden fable
upbeat otter
prisma spoke
maiden fable
upbeat otter
maiden fable
#

Bro, it's traceback not Traceback

maiden fable
prisma spoke
upbeat otter
prisma spoke
maiden fable
prisma spoke
#

above.

maiden fable
upbeat otter
#

hmm, Good Luck

maiden fable
prisma spoke
maiden fable
prisma spoke
#

solved it

#

one seclemme tryr

maiden fable
#

Mk

#

didn't I tell that before

upbeat otter
#

i'm getting old

prisma spoke
#

same thing