#discord-bots

1 messages · Page 790 of 1

limber isle
#

to pypi

slate swan
#

oh, great!

#

manage_channels

#

lemme check 1 moment

final iron
#

Ew

#

Why do people use pycord anyway

#

It's one of the worst forks

slate swan
#

highly advertised and the name is pretty decent

#

shrug cant talk about features cause there's nothing too amazing there

slate swan
#

!pip pycord , loooli imagine installing this instead of pycord

unkempt canyonBOT
slate swan
#

lmfao

#

anyways, its always me who is working with a module built upon good intentions

final iron
#

How do you even install pycord

slate swan
#

!pip py-cord

unkempt canyonBOT
slate swan
#

wao

final iron
#

Huh

#

Were they too lazy to edit the pypi?

slate swan
#

for everyone role?

#

!d discord.abc.GuildChannel.permissions_for

unkempt canyonBOT
#

permissions_for(obj, /)```
Handles permission resolution for the [`Member`](https://discordpy.readthedocs.io/en/master/api.html#discord.Member "discord.Member") or [`Role`](https://discordpy.readthedocs.io/en/master/api.html#discord.Role "discord.Role").

This function takes into consideration the following cases...
slate swan
#

no

final iron
limber isle
#

What you mean good intnetions

#

What is wrong with Pycord? xD

slate swan
#

!pypi hikari

unkempt canyonBOT
slate swan
#

read the description loooli

slate swan
#

!d asyncio.sleep would be better

unkempt canyonBOT
#

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

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

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

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

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

Example of coroutine displaying the current date every second for 5 seconds:
final iron
limber isle
#

Well, hikari is not a fork so it uses very different implementation. interactions.py is nice but lacking on their discord data models. last I checked pycord and disnake were almost the same but pycord seemed to move faster so I went with pycord

slate swan
#

pycord initially started well

limber isle
#

There is also nextcord which I also thought seemed like pycord but at slower development

slate swan
#
member.created_at.timestamp()

Is this in seconds?

keen talon
final iron
#

...

final iron
slate swan
final iron
#

!e
import datetime
print(datetime.datetime.now().timestamp())

unkempt canyonBOT
#

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

1643562077.934694
final iron
slate swan
#

How?

final iron
#

¯\_(ツ)_/¯

slate swan
#

Does anyone know how to convert unix time to days?

#

!e
import datetime
import time
print(time.time() - timestamp() // 86400)

unkempt canyonBOT
#

@slate swan :x: Your eval job has completed with return code 1.

001 | Traceback (most recent call last):
002 |   File "<string>", line 3, in <module>
003 | NameError: name 'timestamp' is not defined
slate swan
#

nvm it's seconds -_-

#
time.time() - member.created_at.timestamp() // 86400

Will this work?

final iron
#

You tell me

slate swan
#

!e
import time
print(time.time())

unkempt canyonBOT
#

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

1643562606.7080872
final iron
#

You might be able to use strftime

slate swan
#

!e
import time
print(time.time() // 84600)

unkempt canyonBOT
#

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

19427.0
final iron
#

!e
import datetime
print(datetime.datetime.now().strftime("%Y/%m/%D"))

unkempt canyonBOT
#

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

2022/01/01/30/22
final iron
#

Okay what did I do wrong

#

Doesn't matter

slate swan
#

!e
import time
print(time.time().strftime("%Y/%m/%D"))

unkempt canyonBOT
#

@slate swan :x: Your eval job has completed with return code 1.

001 | Traceback (most recent call last):
002 |   File "<string>", line 2, in <module>
003 | AttributeError: 'float' object has no attribute 'strftime'
final iron
#

¯\_(ツ)_/¯

#

Try it

slate swan
#

Do you want to not allow those perms?

#

@slate swan

#
permoverwrite = member:discord.PermissionOverwrite(view_channel=True, connect=True, move_members=True, manage_channels=True, mute_members=True, deafen_members=True, manage_permissions=True, use_voice_activation=True)
#

I use this

#

@slate swan

#

@bot.command()
async def vouch(ctx, *, reason=None):
  user, vouchs = reason.split(':') 
  message = await ctx.send("sending..") 
  time.sleep(0.3)
  await message.edit(content="**vouch received!!!**")
  vouch = 0
name = ("vouches.txt")
o = open(‘vouches.txt')

   user = (f"{ctx.author.mention} vouched {user} reason: {vouchs} ")
vouchs += 1
print(f"{user} | {vouchs}")
o.write(f"{user}\n")``` I’m kinda dumb and bad at py
quaint epoch
#

guys quick how can i download an attachment from a message to my device?

maiden fable
unkempt canyonBOT
#

await save(fp, *, seek_begin=True, use_cached=False)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).

Saves this attachment into a file-like object.
quaint epoch
slate swan
#

How can i set if arg3 not "123" or "abc":

slim ibex
#

!or

unkempt canyonBOT
#

When checking if something is equal to one thing or another, you might think that this is possible:

if favorite_fruit == 'grapefruit' or 'lemon':
    print("That's a weird favorite fruit to have.")

While this makes sense in English, it may not behave the way you would expect. In Python, you should have complete instructions on both sides of the logical operator.

So, if you want to check if something is equal to one thing or another, there are two common ways:

# Like this...
if favorite_fruit == 'grapefruit' or favorite_fruit == 'lemon':
    print("That's a weird favorite fruit to have.")

# ...or like this.
if favorite_fruit in ('grapefruit', 'lemon'):
    print("That's a weird favorite fruit to have.")
solid crypt
#

Yo ppl

#

i need some help anyone here

slate swan
solid crypt
#

guys PES_Cry

#

i need help

#

pls i beg u

#

damn

#

uh bruh how do i do the code thingy

slim ibex
#

What do you need help with? Don’t say you need help and not say what the issue is

solid crypt
#

uh true mb

#

well i need help with this code Below. so basically its for a message being sent. user types $RR and the game starts. Message with the catto_wtf reaction appears. When this appears i want 7 memebers to react to it and all those 7 to be put into a list

def check(r: discord.Reaction, u: Union[discord.Member, discord.User]):
return u.id == ctx.author.id and r.message.channel.id == ctx.channel.id and
str(r.emoji) in ["catto_wtf"]

#

i have put the unicode for the cat emoji dont worry about it. it just transforms into it in discord

slim ibex
#

why are you doing Union for the member and user objects

solid crypt
#

i used this of a doc in github. wanted to pick up the union but wasnt sure if it makes a diff

slate swan
#

@slim ibex i have
if arg3 == 'free': and
if arg3 == 'free1':
how can i check
if arg3 not 'free' or 'free1':

solid crypt
#

should i remove like one of them and leave one in there?

quaint epoch
#

does os.rename return the edited file

slim ibex
#

!d os.rename

unkempt canyonBOT
#

os.rename(src, dst, *, src_dir_fd=None, dst_dir_fd=None)```
Rename the file or directory *src* to *dst*. If *dst* exists, the operation will fail with an [`OSError`](https://docs.python.org/3/library/exceptions.html#OSError "OSError") subclass in a number of cases:

On Windows, if *dst* exists a [`FileExistsError`](https://docs.python.org/3/library/exceptions.html#FileExistsError "FileExistsError") is always raised.

On Unix, if *src* is a file and *dst* is a directory or vice-versa, an [`IsADirectoryError`](https://docs.python.org/3/library/exceptions.html#IsADirectoryError "IsADirectoryError") or a [`NotADirectoryError`](https://docs.python.org/3/library/exceptions.html#NotADirectoryError "NotADirectoryError") will be raised respectively. If both are directories and *dst* is empty, *dst* will be silently replaced. If *dst* is a non-empty directory, an [`OSError`](https://docs.python.org/3/library/exceptions.html#OSError "OSError") is raised. If both are files, *dst* it will be replaced silently if the user has permission. The operation may fail on some Unix flavors if *src* and *dst* are on different filesystems. If successful, the renaming will be an atomic operation (this is a POSIX requirement).
slim ibex
slim ibex
#

try if (“free”, “free1”) not in arg3:

#

Can I see the function where this arg3 is

solid crypt
#

yo @slim ibex u mind helping me with the code after u helped others? i also need a second person to try out the code with but if you cant its fine i totally understand aPES_Love

slate swan
slim ibex
#

can I see more code?

#

and I don’t think this is the right channel if it isn’t related to discord bots @slate swan

#

But I’ll help

solid crypt
#

tq FrogBow

#

whenever u are ready

#

i can invite u to my server so we test it out there

#

if u comfortable with that

tidal hawk
#

Does anyone know how to respond nothing to a interaction in disnake?
I could create interaction.send_message(content=''), but i think there's more proper way for it

slim ibex
slate swan
#

if arg3 == 'free':
free = discord.Embed(title=f"McBott")
await ctx.channel.send(embed=free)
if arg3 == 'free1':
free1 = discord.Embed(title=f"McBott")
await ctx.channel.send(embed=free1)
@slim ibex

tidal hawk
#

i want the user to press multiple buttons before bot starting to respond

#

Right now bot starts to think for 5 seconds, and gives interaction failure

slate swan
#

all work but i cant check if (“free”, “free1”) not in arg3:

slim ibex
#

An else statement should be fine

#

Because if the first two if’s aren’t true then it will run the else

#

and replace the second if with elif

tidal hawk
#

I'm sure i need to respond with something here

slate swan
tidal hawk
#

in other library, i had to respond with type 6,

slate swan
#

(“free”, “free1”) not in arg3:
(“free” or “free1”) not in arg3:

#

Xd

slim ibex
#

!d disnake.ui.Select.min_values

unkempt canyonBOT
slim ibex
#

@tidal hawk

tidal hawk
slate swan
#
async def vouch(ctx, *, reason=None):
  user, vouchs = reason.split(':') 
  message = await ctx.send("sending..") 
  time.sleep(0.3)
  await message.edit(content="vouch received!!!")
  vouch = 0
  name = ("vouches.txt")
  o = open('vouches.txt')

  user = (f"{ctx.author.mention} vouched {user} reason: {vouchs} ")
  vouchs += 1
  print(f"{user} | {vouchs}")
  o.write(f"{user}\n")```


It’s not sending vouches to file
solid crypt
#

@slim ibex yo btw i cant send you a message in dms to invite u to my server. accept my friend req

#

nvm u have to add me as friend cause i cant send u a req

slate swan
slate swan
slate swan
slate swan
tidal hawk
#

Can disnake respond to context command with ephemeral true?

slate swan
#

time.sleep isnt async and will stop your whole code

slate swan
tidal hawk
#

:(

slate swan
#

¯\_(ツ)_/¯

tidal hawk
#

going to use slash commands then

#

Damn whoever recommended disnake to me.. I love you.

slate swan
quick gust
marsh kestrel
#

how do i code in jobs to my discord bot? im very new to python and i only watched a 1 hour tutorial

echo wasp
abstract wave
#

!code

#

!code

slate swan
tidal hawk
#

What's the best reliable bot hosting service out there?

#

And why everybody hatin' Heroku

hybrid fjord
#

how do i do this?

#

could someone link the docs for it?

full lily
hybrid fjord
#

i know, is there a library for it yet?

tidal hawk
#

Look's like Select but not sure how those keywords are in Computer Science

limber isle
#

Pycord has them, it is a select with multiple select options

limber isle
#

I top that, I have been using Vultr for a long time now

#

although I have heard about them being a little overpriced

#

I recommend their 5 dollar plan either way

slate swan
slim ibex
#

Vultr does require some setup and minimal Linux knowledge if you deploy to a Linux server

slate swan
marsh kestrel
#

can i dm someone my code and the problem that pops up cuz im over the character limit

unkempt canyonBOT
#

Pasting large amounts of code

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

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

marsh kestrel
#

ok

final iron
slate swan
final iron
#

Can you be more specific?

marsh kestrel
#

import discord
from discord.ext import commands
import json
import os

cmds = commands.Bot(command_prefix = "%")

@client.command()
async def balance(ctx):
await open_account (ctx.author)

async def open_account(user):

users = await get_bank_data()

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

if str(user.id) in users:
return False
else:
users[str(user.id)]["wallet"] = 0
users[str(user.id)]["bank"] = 0

with open("mainbank.json", "r") as f:
json.dump(users,f)
return True

async def get_bank_data():
with open("mainbank.json", "r") as f:
users = json.load(f)

@client.event
async def on_ready():
print("Bot is gay.")
await bot.change_presence
(activity = discord.Game)

@bot.command(description)

#

why doesnt it work it returns import discord
from discord.ext import commands
import json
import os

cmds = commands.Bot(command_prefix = "%")

@client.command()
async def balance(ctx):
await open_account (ctx.author)

async def open_account(user):

users = await get_bank_data()

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

if str(user.id) in users:
return False
else:
users[str(user.id)]["wallet"] = 0
users[str(user.id)]["bank"] = 0

with open("mainbank.json", "r") as f:
json.dump(users,f)
return True

async def get_bank_data():
with open("mainbank.json", "r") as f:
users = json.load(f)

@client.event
async def on_ready():
print("Bot is gay.")
await bot.change_presence
(activity = discord.Game)

@bot.command(description)

client.run("my bot token")

#

oops sorry

cloud dawn
#

Disnake don't have those yet, but tbf pydis prob rushed those multiple select view anyways.

unkempt canyonBOT
#

Here's how to format Python code on Discord:

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

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

unkempt canyonBOT
#

Pasting large amounts of code

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

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

teal plank
#

guys

cloud dawn
#

Where? You just send those whole class.

teal plank
#

i need help with something

slate swan
cloud dawn
#

Refer to that same message.

#

You are giving me a whole class, do you got something specific?

#

nvm i found it.

#

I was asking about the multiple options section.

teal plank
cloud dawn
tidal hawk
#

@slim ibex

slim ibex
#

yes
i believe so

#

i got a free $100 dollar credit which is more than enouugh for many bots

potent spear
#

what site?

#

like most sites have "starts credit" to work with, but this expires within a set period of time ofc

limber isle
#

Yea I also got those $100, it expired after 30 days, so about over half a year ago

#

x)

#

and yes you can

potent spear
#

I have 6 months left on the free AWS EC2 trial

#

but my bot is private, so I don't have to worry about usage etc

limber isle
#

although I am not sure about scaling up

#

I only make bots for my servers, I have about 4/5 bots running at the same time together with a radis db

#

this is what you get with 5 dollars

potent spear
#

I'll only ever pay for a hosting service if it generates income for me

potent spear
solemn holly
#

Does anyone know why my image is being sent separate while it should be in the embed as a thumbnail?

import instaloader
import discord
from discord.ext import commands
import os

client = commands.Bot(command_prefix='.')

@client.event
async def on_ready():
    print('bot ready')

@client.command(name='user')
async def get(ctx, username):
    l = instaloader.Instaloader()
    profile = instaloader.Profile.from_username(l.context, username)

    l.download_profile(username, profile_pic_only=True)
    for filename in os.listdir(username):
        f = os.path.join(username, filename)
        if f.endswith('.jpg'):
            break

    print(f)

    embed = discord.Embed(
        title = f'@{username}',
        color = discord.Color.purple()
    )

    file = discord.File(f, filename=f)

    embed.add_field(name='User ID', value=profile.userid, inline=True)
    embed.add_field(name='Followers', value=profile.followers, inline=False)
    embed.add_field(name='Following', value=profile.followees, inline=False)
    embed.add_field(name='Posts', value=profile.mediacount, inline=False)
    embed.set_thumbnail(url=f'attachment://{f}')

    await ctx.send(embed=embed, file=file)
#

It should look like this

final iron
#

!d discord.Embed.set_thumbnail

unkempt canyonBOT
#

set_thumbnail(*, url)```
Sets the thumbnail for the embed content.

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

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

I am right

potent spear
#

you are indeed

solemn holly
#

So I don't know what's going on haha

quaint epoch
#

does disnake.FFmpegOpusAudio.from_probe accept file paths?

potent spear
limber isle
limber isle
#

so to each their own

#

¯_(ツ)_/¯

potent spear
solemn holly
#

But scraping the image url from an instagram page seems kinda complicated lol, but I'll try

potent spear
limber isle
#

As in I enjoy minor devops and bot coding as hobby, and I get fun out of it

potent spear
#

I get that, you just rather code and spend money on that than do nothing and spend money on a streaming service

limber isle
#

Yup, pretty much x)

tidal hawk
#

Do you guys earn money by creating bots?

vale wing
#

Some work at freelance

#

Some add purchasable stuff and earn money from it

tidal hawk
#

mhm

#

Thinking about learning bots in nodejs, so I can integrate websites with them 🤔

vale wing
#

You can integrate websites with python bots as well why not

slim ibex
#

you can do thesame with python

#

flask exists

vale wing
#

API generally

slim ibex
#

mhmmh

tidal hawk
#

I mean if the website & bot is in same language, it's bit easier to integrate them with eachother

vale wing
#

Maybe you are right in some terms

#

But imo python bots are more convenient to write than nodejs

tidal hawk
#

Mhm

vale wing
slim ibex
#

vultr

vale wing
#

Ok ima check it out 9839megaflushed

#

Need some free server

tidal hawk
#

Heroku 😋

final iron
#

You get like 4 cores and 24gb of ram

vale wing
#

What the heck

#

I just got 8gb ram server on digital ocean for free xdxdxdxd

#

For 2 months

limber isle
quaint epoch
#

guys

timber cape
#

!e

unkempt canyonBOT
#
Command Help

!eval [code]
Can also use: e

*Run Python code and get the results.

This command supports multiple lines of code, including code wrapped inside a formatted code block. Code can be re-evaluated by editing the original message within 10 seconds and clicking the reaction that subsequently appears.

We've done our best to make this sandboxed, but do let us know if you manage to find an issue with it!*

quaint epoch
#

nvm

dry kelp
#

why i can't make a self bot?

timber cape
#

Idk

plucky shoal
#

!rule 5

unkempt canyonBOT
#

5. Do not provide or request help on projects that may break laws, breach terms of services, or are malicious or inappropriate.

plucky shoal
#

It's very much against discord tos

dry kelp
#

i do this on my own risk

#

i know they are against tos

#

but is not for something bad

#

i just tryna create a loop

plucky shoal
#

We still don't help with them here

slim ibex
#

remove bot = False

cold sonnet
potent spear
#

selfbots are against ToS and pretty useless if you'd ask me

cold sonnet
#

they could be useful

#

even too useful

limber isle
#

Yep, that is how everyone keeps getting scam messages

potent spear
#

The only thing they could "exploit" is other bots systems

cold sonnet
#

and you could bump your server with it every 2 hours on disboard

potent spear
#

still not useful

cold sonnet
#

I find that useful

limber isle
#

They can scrape member lists

#

I mean, to someone with good intentions they are useless

#

imo

vale wing
potent spear
#

scamming or free advertisement isn't useful

#

and a chatBOT... what's in a name?

limber isle
#

lmao

#

You know something I have always wanted to find but every time I looked for it I would only find SelfBots

#

BotSelfs

vale wing
#

The only fun thing about selfbots is you can send embeds from non bot account

potent spear
#

still not useful

limber isle
#

that is sometime I would like to find on github

cold sonnet
vale wing
#

I never said it's useful 🙄

potent spear
cold sonnet
#

u give them your account?

potent spear
#

why would you even want to answer everyone if it isn't coming from you?

vale wing
#

I once made a simple AI responder for a bot but it went aids

cold sonnet
#

tell them to speak to someone else

potent spear
potent spear
cold sonnet
#

but on your own account cuz people are dumb enough to message you

potent spear
#

you can always try

cold sonnet
#

why are we talking about the priorities of something illegal

limber isle
#

x)

cold sonnet
#

what's that

#

what are those lmao

limber isle
#

Like where people make interfaces to talk through a bot

cold sonnet
#

oh

#

well I've seen one of those but idk how he did it

#

and I think it's just as much against ToS as selfbots

limber isle
#

I never found anyone saying that it is against ToS

cold sonnet
#

did you find anyone talking about it

limber isle
#

also It doesnt make much sense for it to be against ToS, because there is nothing privileged about a bot

cold sonnet
#

it's free nitro

limber isle
#

yep, free nitro in all the servers you are admin sure

#

You cant even join servers without people adding you

#

Would be a pretty pathetic nitro experience xD

cold sonnet
#

well

potent spear
#

no idea how their detection system works, but I wouldn't like to be the one to find out

cold sonnet
#

sending embeds

#

oops

#

got his account terminated in a day

#

I think

#

not sure, his name still appears

limber isle
#

Can't you do that with also tos breaking alternative clients?

cold sonnet
#

no, his account still exists

limber isle
#

Like better discord

cold sonnet
#

did you say that cuz of my screenshot

limber isle
#

Yeah

cold sonnet
#

damnit

limber isle
#

What? xD

cold sonnet
#

nobody has to know

velvet tinsel
cold sonnet
#

yeah they can

#

but they don't

#

it's like youtube and ytdl

velvet tinsel
#

ok

#

there is a YouTube API, don't know why they use ytdl

cold sonnet
#

don't you need an API key for that

velvet tinsel
#

ytdl breaks youtube TOS

#

I think pydis is trying to strain the use of ytdl as much as possible

#

!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)
wicked atlas
velvet tinsel
wicked atlas
#

yeah, i know

velvet tinsel
#

why do people even use it

wicked atlas
#

because it lets them download videos

limber isle
#

😂

visual yarrow
cold sonnet
#

NO

wicked atlas
#

lmao

visual yarrow
#

The mods are always watching hyperlemon

cold sonnet
#

stalkers

visual yarrow
#

Nah jk.

cold sonnet
#

we both exposed ourselves now, didn't we

velvet tinsel
#

how dare thou

cold sonnet
#

you're on a public server

velvet tinsel
cold sonnet
#

still stalkers

velvet tinsel
vale wing
#

It has a normal limit

#

Iirc 10k queries per day

solemn holly
#

Does anyone know how to make the title in an embed a hyperlink (url)?

@client.command(name='user')
async def get(ctx, username):
    r = requests.get(f'https://www.instagram.com/{username}/?__a=1')

    embed = discord.Embed(
        title = discord.Embed(title=f'{username}', url='www.instagram.com'),
        color = discord.Color.purple()
    )

    embed.add_field(name='User ID', value=r.json()['graphql']['user']['id'], inline=True)
    embed.add_field(name='Followers', value=r.json()['graphql']['user']['edge_followed_by']['count'], inline=False)
    embed.add_field(name='Following', value=r.json()['graphql']['user']['edge_follow']['count'], inline=False)
    embed.add_field(name='Posts', value=r.json()['graphql']['user']['edge_owner_to_timeline_media']['count'], inline=False)
    embed.set_thumbnail(url=r.json()['graphql']['user']['profile_pic_url_hd'])

    await ctx.send(embed=embed)
cold sonnet
#

yeah that's too much of enough for discord

#

url kwarg

cold sonnet
#

!d discord.Embed.url

unkempt canyonBOT
cold sonnet
#

there

#

rick rolled people with this

solemn holly
#

discord.ext.commands.errors.CommandInvokeError: Command raised an exception: AttributeError: type object 'Embed' has no attribute 'set_url'

vale wing
#

I am pretty sure you can use it there as well

cold sonnet
#

hmm

#

let me know if that works

#

curiosity intensifies

vale wing
#

Yeah check it please I can't myself

solemn holly
#

let me check

cold sonnet
#

if it does not

cold sonnet
rare saddle
#

How to fix the error when leaving the voice channel

solemn holly
#
embed = discord.Embed(
        title = discord.Embed(title=f'(text)[https://instagram.com]'),
        color = discord.Color.purple()
    )
vale wing
#

!e

embed = discord.Embed(title='(gogel)[https://google.com]', description='Sample text')
await ctx.send(embed)```
unkempt canyonBOT
#

@vale wing :x: Your eval job has completed with return code 1.

001 |   File "<string>", line 2
002 | SyntaxError: 'await' outside function
solemn holly
#

what am i doing wrong ://

cold sonnet
vale wing
#

Or I did something wrong

cold sonnet
#

you can't

vale wing
rare saddle
cold sonnet
#

whaaaat

#

what lib are you using?

vale wing
#

Um what args does that event even accept

solemn holly
rare saddle
# cold sonnet whaaaat

When a person enters the voice channel, the bot should create a voice channel with the name of the author and move it there

cold sonnet
rare saddle
cold sonnet
#

as in dpy, they are both member objects

#

in disnake, they are VoiceStates

vale wing
cold sonnet
#

!d disnake.VoiceState

unkempt canyonBOT
vale wing
#

!d discord.on_voice_state_update

unkempt canyonBOT
#

discord.on_voice_state_update(member, before, after)```
Called when a [`Member`](https://discordpy.readthedocs.io/en/master/api.html#discord.Member "discord.Member") changes their [`VoiceState`](https://discordpy.readthedocs.io/en/master/api.html#discord.VoiceState "discord.VoiceState").

The following, but not limited to, examples illustrate when this event is called...
vale wing
#

Ok nvm

cold sonnet
#

I don't see his params

rare saddle
atomic zealot
#

Is there a way to code a discord bot to search a website for somethin? For example Im coding a bot for an equestrian server, and one of the things we want is have a command where we put the name of the racehorse we want searched, and it comes up with information or a link to that horses page on the website equibase

cold sonnet
#

I see, I thought you used dpy

cold sonnet
#

urllib good

rare saddle
#

Maybe someone knows how to fix this?

vale wing
#

Voice is weird

#

With those protocols and states

cold sonnet
#

if after.channel == None:

rare saddle
cold sonnet
#

even with is instead of ==

#

pep8

flat solstice
#

can someone link me to the dpy docs on chunk_guilds_at_startup as i can't seem to find them

velvet tinsel
#

👍

vale wing
flat solstice
cold sonnet
#

!d discord.ext.commands.Bot

unkempt canyonBOT
#

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

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

This class also subclasses [`GroupMixin`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.GroupMixin "discord.ext.commands.GroupMixin") to provide the functionality to manage commands.
cold sonnet
#

it's not there

rocky trench
#

How could I bass boost input in vc from my bot?

cold sonnet
#

couldn't sound more like a music bot

rocky trench
#

Bass boost a song

cold sonnet
green bluff
#

what does courotine mean

rocky trench
#

Is it an ffmpeg option?

cold sonnet
green bluff
#

oh ok

cold sonnet
unkempt canyonBOT
#

5. Do not provide or request help on projects that may break laws, breach terms of services, or are malicious or inappropriate.

rocky trench
#

Im playing a file from my pc...

#

That's not breaking anything

limber isle
#

public domain right?

#

xD

rocky trench
#

^^

cold sonnet
rocky trench
#

I got some non copyright songs downloaded on my pc, and want to bass boost them

#

Well it's about a discord bot...

#

I don't know what I should use to bass boost it

cold sonnet
#

!d discord.FFmpegAudio

unkempt canyonBOT
#

class discord.FFmpegAudio(source, *, executable='ffmpeg', args, **subprocess_kwargs)```
Represents an FFmpeg (or AVConv) based AudioSource.

User created AudioSources using FFmpeg differently from how [`FFmpegPCMAudio`](https://discordpy.readthedocs.io/en/master/api.html#discord.FFmpegPCMAudio "discord.FFmpegPCMAudio") and [`FFmpegOpusAudio`](https://discordpy.readthedocs.io/en/master/api.html#discord.FFmpegOpusAudio "discord.FFmpegOpusAudio") work should subclass this.

New in version 1.3.
cold sonnet
#

no bass kwarg or anything

rocky trench
cold sonnet
#

the module

#

you have to get the audio boosted before playing it

rocky trench
cold sonnet
#

oh well ask that somewhere else now

rocky trench
#

Yh indeed

cold sonnet
#

we are specialised of discord bots

cosmic flume
#

so I tired following a youtube tutorial to make a bot but it doesn't want to run at all and won't let me name the secondary file .env

rocky trench
green bluff
cold sonnet
cold sonnet
velvet tinsel
#

i'm screaming at the screen because of the lack of PEP8

green bluff
cold sonnet
#

well I don't use pep8 either, I've got my own habits

green bluff
#

how to set image as a file

cold sonnet
#

!local-file

unkempt canyonBOT
#

Thanks to discord.py, sending local files as embed images is simple. You have to create an instance of discord.File class:

# When you know the file exact path, you can pass it.
file = discord.File("/this/is/path/to/my/file.png", filename="file.png")

# When you have the file-like object, then you can pass this instead path.
with open("/this/is/path/to/my/file.png", "rb") as f:
    file = discord.File(f)

When using the file-like object, you have to open it in rb mode. Also, in this case, passing filename to it is not necessary.
Please note that filename can't contain underscores. This is a Discord limitation.

discord.Embed instances have a set_image method which can be used to set an attachment as an image:

embed = discord.Embed()
# Set other fields
embed.set_image(url="attachment://file.png")  # Filename here must be exactly same as attachment filename.

After this, you can send an embed with an attachment to Discord:

await channel.send(file=file, embed=embed)

This example uses discord.TextChannel for sending, but any instance of discord.abc.Messageable can be used for sending.

cold sonnet
slim ibex
#

don't be sorry. moai is here

cold sonnet
#

I'm a beginner with a year of experience

slate swan
#

Ffmpeg is a tool for working with audio files

green bluff
#

like my bot has made the image

cold sonnet
#

save it

green bluff
#

it doesnt have a path

#

how would i save it

cosmic flume
cold sonnet
green bluff
#

i already have this

cold sonnet
#

and no env file is required

#

only if you wanna post it on github publicly

green bluff
#

mc.save

cold sonnet
#

file = discord.File("/this/is/path/to/my/file.png", filename="file.png")
embed.set_image(url="attachment://file.png")

green bluff
#

ohhh ok

cold sonnet
#

and your send needs a file kwarg too

#

it's kinda weird

green bluff
cosmic flume
cold sonnet
#

this seems exactly like it

green bluff
#

perfect thanks

cold sonnet
#

👍🏿

green bluff
#

how to mention in embeds

#

i tried {member.mention}

#

but it just shows the @ plus the id

#

ripppppp

vocal snow
#

Mentions will render in the embed description or field values but they won't actually ping

green bluff
#

oh no this a test , in the actual one its on an on_member_join event

#

also i get this error

potent spear
#

ctrl+f on that, people who have seeked help previously about this topic probably do

green bluff
#

isnt it member.guild_count

potent spear
#

close

unkempt canyonBOT
#

property members: List[discord.member.Member]```
A list of members that belong to this guild.
green bluff
#

no it used to work

potent spear
#

it's because you forgot something

green bluff
#

this was my old imasge

unkempt canyonBOT
#

property member_count: int```
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://discordpy.readthedocs.io/en/master/api.html#discord.Intents.members "discord.Intents.members") to be specified.
potent spear
#

member.guild**.member**_count

green bluff
#

oh

potent spear
#

makes more sense, right?

green bluff
#

yea

#

perfect ty

green bluff
#

just a test command why isnt this formatted

#

nvm

split merlin
#

Hi, a quick question, how can i async my youtube downloads in pytube?
like i am trying to download a couple of videos from a playlist but it keeps blocking my bot from responding to other commands

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)
split merlin
#

alr, thanks for responding

frank tartan
#

how can I check a user for a sertain role in a role list? But also return the sertain role?

#

I tried doing

if author.roles in info.roleList:

but when I have role names in roleList, it doesnt work. But if I have role objects, I just get a syntac error.

final iron
#

Loop through the list and compare

#

!e

author_roles = ["a", "b", "c", "1"]
roles = ["j", "1", "b"]
for i in author_roles:
    if i in roles:
        print(i)
unkempt canyonBOT
#

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

001 | b
002 | 1
pliant gulch
#

!e ```py
roles1 = set([1, 2, 3])
roles2 = set([2, 3])

print(roles1.intersection(roles2))

unkempt canyonBOT
#

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

{2, 3}
pliant gulch
#

You can use set here because it's 100% that a member does not have the same role twice

final iron
#

Oh interesting

#

You learn something new every day

gentle badger
#

How to mention a role in a message

#

In the bot's message

#

someone?

limber isle
#

What code is responsible for sending the message?

#

@gentle badger

gentle badger
#

in line 35

limber isle
#

alright, so where are you getting the role from

#

are you just hardcoding?

#

if so

#
role_id = ...
await message.channel.send(f'<@{role_id}>')
gentle badger
#

OK thanks

slate swan
unkempt canyonBOT
slate swan
#

Another way to do it is <@&role_id>

frank tartan
pliant gulch
#

I construct the set's with a list for each one. You can imagine the lists instead has the roleList and roles in your situation

limber isle
pliant gulch
frank tartan
pliant gulch
#

You'd check the intersection on the info.roleList to author.roles

frank tartan
pliant gulch
#

you need to actually construct the sets

frank tartan
pliant gulch
#

Your checking the intersection on info.roleList, not the newly created set roleList and your roleList is a set of strs, not a set of discord.Role objects which is what author.roles is

#

Once you fix those two it will capture the intersection of the two sets into returnedRole

frank tartan
frank tartan
pliant gulch
frank tartan
frank tartan
#
roleList = [<Role id=926477597355962401 name='member', <Role id=926477597372727374 name="mod"]

it looks like that. I got this stuff from this command

@client.command()
@commands.has_permissions(administrator=True)
async def roleINFORMATION(ctx, type=None):
    client.memberList = []

    await ctx.reply("Working...")

    amount = len(info.roleList)
    i = 0
    for i in range(0, amount):
        try:
            role = discord.utils.get(ctx.guild.roles, name=info.roleList[i])
        except:
            await ctx.reply("You are missing some roles... Please fix them, then redo the command.")
            return
        client.memberList.append(role)
        i = i+1

    await ctx.reply(client.memberList)
pliant gulch
#

then check the intersection of info.roleList to the other

frank tartan
#

when I try to run it says that the line that roleList is on has a syntac error

pliant gulch
#

Can you show the error

frank tartan
pliant gulch
#

Not a very helpful snippet

#

Send the full traceback

frank tartan
surreal sierra
#

hey, could someone explain to me why my code cant load the file commands.py?
this is my main.py file


if __name__ == '__main__':
    for extension in extensions:
        try:
            bot.load_extension(extension)
        except Exception as error:
            print(colored(f'{format(extension)} cannot be loaded. [{format(error)}]', 'red'))

and my commands.py file

class c_cog(commands.Cog):
    def init(self, bot):
        pass
# a lot of code and commands... 
# ... 


def setup(bot):
    bot.add_cog(c_cog(bot))
slim ibex
#

first off, follow naming conventions

final iron
#

^

slim ibex
#

class names should be in PascalCase

final iron
#

pep8 is coming to get you

surreal sierra
slim ibex
slim ibex
#

^

final iron
#

pep8 says thats a nono

slim ibex
#

its

def __init__(self, bot):
  self.bot = bot
surreal sierra
#

I have tried that also but it didnt work either

slim ibex
#

your init method isn't even dunder

slate swan
#

or magic method

atomic zealot
#

I have the code for an API, but im confused on how I make the command to search using the API?

slate swan
slim ibex
#

GET request

slate swan
#

you can use aiohttp for it

surreal sierra
final iron
slim ibex
#

holy the whole squad showed up

slate swan
slim ibex
#

code that works isn't always code that is good

slate swan
#

^ theres always something better you can do with it

#

depends on the commands even if your the owner of the guild it wont affect any command only if theres something in it that will

surreal sierra
#

yeah of course there will always be something better, this was just the way I was learned to do it and that's the reason why I did it in this way. but if this is wrong I will try to change it

final iron
#

It is wrong

frank tartan
# pliant gulch Send the full traceback

ok so cuz i couldnt send the whole list, here is just one of them in a variable

C:\Users\toren\OneDrive\Desktop\newCode>python main.py
Traceback (most recent call last):
  File "C:\Users\\OneDrive\Desktop\newCode\main.py", line 12, in <module>
    import info
  File "C:\Users\\OneDrive\Desktop\newCode\info.py", line 17
    role1 = <Role id=926477597355962401 name='member'>
            ^
SyntaxError: invalid syntax
slate swan
#

!pep8 check it out

unkempt canyonBOT
#

PEP 8 is the official style guide for Python. It includes comprehensive guidelines for code formatting, variable naming, and making your code easy to read. Professional Python developers are usually required to follow the guidelines, and will often use code-linters like flake8 to verify that the code they're writing complies with the style guide.

More information:
PEP 8 document
Our PEP 8 song! :notes:

slate swan
#

and hey andy

frank tartan
signal slate
#

hi

pliant gulch
frank tartan
pliant gulch
#

Delete that line??

#

I don't even know what you are trying to do with that

frank tartan
pliant gulch
#

that's not roleLIst... thats role1

#

role1

frank tartan
pliant gulch
#

Can you show your roleList again

#

Cause for whatever reason, it changed from the one you showed me before apparently

frank tartan
#
roleList = [<Role id=926477597355962401 name='member', <Role id=926477597372727374 name="mod"]
pliant gulch
#

Oh wait that isn't the repr of the role

#

You copy pasted the repr in roleList instead of having actual role objects.

#

You need to make roleList have ACTUAL role objects

#

Once you do that, construct the set then check the intersection

frank tartan
# pliant gulch You need to make `roleList` have **ACTUAL** role objects

??? they are the actual role objects... at least i think so, i get them from this cmd

@client.command()
@commands.has_permissions(administrator=True)
async def roleINFORMATION(ctx, type=None):
    client.memberList = []

    await ctx.reply("Working...")

    amount = len(info.roleList)
    i = 0
    for i in range(0, amount):
        try:
            role = discord.utils.get(ctx.guild.roles, name=info.roleList[i])
        except:
            await ctx.reply("You are missing some roles... Please fix them, then redo the command.")
            return
        client.memberList.append(role)
        i = i+1

    await ctx.reply(client.memberList)
frank tartan
final iron
#

Function names should not be in camelCase, they should be in snake_case

slate swan
#

use the name kwarg if you want to name your commands that way

final iron
#

Same thing for variables

pliant gulch
frank tartan
frank tartan
final iron
#

And bad practice

frank tartan
#

its faster tto type

slate swan
pliant gulch
# frank tartan now im confused

Whats to be confused about? You just need to make roleList have actual role objects. You did something weird and copy pasted the repr's of some roles into the list.

#

reprs are representations of an object. Not the object itself

frank tartan
#

and if so, how do i hard code that in?

slim ibex
#

don't make the pep8 officer mad

final iron
#

When a user has a default avatar it returns None

pliant gulch
slate swan
#

Member does not have a avatar , use member.display_avatar maybe

final iron
#

Consider using display_avatar instead as it will always return an avatar

frank tartan
final iron
#

!d disnake.Member.display_avatar

unkempt canyonBOT
#

property display_avatar: disnake.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.
pliant gulch
final iron
#

andy is so smart smh

frank tartan
unkempt canyonBOT
#

disnake/role.py lines 211 to 213

def __repr__(self) -> str:
    return f"<Role id={self.id} name={self.name!r}>"```
pliant gulch
final iron
slate swan
#

Doesn't matter ,it's same.

frank tartan
final iron
#

...

frank tartan
final iron
slate swan
slim ibex
#

^

slate swan
#

python is based on objects shipit ...

frank tartan
slate swan
#

did you learn classes?

#

everything in python is an object

frank tartan
slate swan
#

....

final iron
#

!e

print(type("a"))
slate swan
#

what was that even supposed to imply?

unkempt canyonBOT
#

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

<class 'str'>
frank tartan
#

nvm, goodbyue

final iron
#

See, object

slim ibex
#

this dude

final iron
#

I don't think he learned the fundamentals

slate swan
#

Atleast they may try to learn it after being asked to :)

final iron
#

I doubt it, barely anyone actually does. I understand why, you don't want to go back to learning basics after you tasted the sweet nectar of an interesting project

#

It's understandable but people should actually try

slate swan
#

its ok if they dont master it, but having a basic idea is always good

#

I have downloaded dotenv multiple time
can someone help me here

final iron
slate swan
#

I was taking code from a website

#

I'm new to this

final iron
#

You don't need it

slate swan
#

oh

#

okay

#

only replit does since its public

#

and you should use the bot framework

#

meh you dont require that even in replit

#

just use os.getenv

#

or os.environ

#

yeah

final iron
#

Why do people even use replit

#

Just use the oracle free tier

#

Boom, free hosting

echo wasp
#

How do I help this person?

#

I can,xt fix it without an error code

final iron
echo wasp
#

@silk lynx

#

There

final iron
#

State your issue, any errors and what you need

slate swan
#

and your code

unkempt canyonBOT
#

Pasting large amounts of code

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

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

final iron
#

Channel is dead

#

Give me code to troubleshoot

#

I'm bored af

slate swan
#

do homework like me

final iron
#

I only have a group project

#

And my group members are being (redacted) and not working

pliant gulch
final iron
#

I think thats a bit too complicated for me

slate swan
#

Can someone please help me

final iron
slate swan
#

@final iron

final iron
#

We only help with Python code

#

!guilds

unkempt canyonBOT
#

Communities

The communities page on our website contains a number of communities we have partnered with as well as a curated list of other communities relating to programming and technology.

slate swan
#

Oh

final iron
#

Check in here, they might have a server for js

#

@slate swan

#

Here

final iron
#

Both

final iron
#

This channel died hard

slate swan
maiden fable
slate swan
#

feel free to facepalm but I'm new at discord.py and I want to make a command which reads values, how do I do it?

spring flax
unkempt canyonBOT
#

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

Waits for a WebSocket event to be dispatched.

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

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

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

This function returns the **first event that meets the requirements**...
spring flax
#

You'd have to use that ^, input() won't work for a discord bot

slate swan
#

thanks

brave ravine
#

Cannot have install fields on a private application what does that mean

#

its on the discord dev/app portal for my bot

brave ravine
#

it pops up when i try to change my bot from public to private

pliant gulch
# brave ravine

You have to remove your “add server” first before setting to private

brave ravine
#

thank you

karmic lintel
#

my buttons are not arranged in row the are arranged in columns

#

@slate swan

karmic lintel
slate swan
#

that library will stop working soon

karmic lintel
#

i just wanna know can i increase width of my embed?

karmic lintel
green bluff
#
@client.command()
async def pdoubles(ctx):
    mc = Image.open("teamcard.png")
    
    font = ImageFont.truetype("playfair-font.ttf", 55)
    channel = ctx.author.voice.channel

    members = channel.members


    memberlist = [] 
    for member in members:
        memberlist.append(member.mention)

    random.shuffle(memberlist)
    team11 = memberlist[0:1]
    team12 = memberlist[1:2]
    team21 = memberlist[2:3]
    team22 = memberlist[3:4]
 

    

    draw = ImageDraw.Draw(mc)
    draw.text((48,106),f"{team11}",(220,20,60),font=font)
    draw.text((290,313),f"#",(220,20,60),font=font)

    
    
    




    
    mc.save("profile.png")
    

    file = discord.File("profile.png", filename="nice.png")


    embed = discord.Embed(title=f'Welcome',description=f'{ctx.author}', colour = discord.Colour.green())
    embed.set_image(url="attachment://nice.png")
    await ctx.send(file=file, embed=embed)
#

why doesnt this send the embed

slate swan
#

How come this no work? I wanna announce a gg message everytime we get 100 members.

So 1000, 1100, etc.

spring flax
green bluff
#

so

#

for member in channel.members:

#

member.mention?

slate swan
#

is it possible to have to prefixes ?
for one bot
like +one, -one

maiden fable
#

U can pass in a list to command_prefix

slate swan
#

How good are you with bot code?

maiden fable
slate swan
#

Well I was trying to make a command like when I invoke it, the bot sends a dm to the owner of every guild my bot is in containing my message and I’ve tried so many things and none of them worked and now I’m just looking to see if anyone knows code for one…

maiden fable
#

I won't code directly but I can help u do so

#

!d discord.Client.guilds

unkempt canyonBOT
#

property guilds: List[discord.guild.Guild]```
The guilds that the connected client is a member of.
maiden fable
#

!d discord.Guild.owner

unkempt canyonBOT
#

property owner: Optional[discord.member.Member]```
The member that owns the guild.
burnt heath
#

i need help w this

maiden fable
#

If the owner is returning None, then that means that y need members intent

maiden fable
burnt heath
#

i regened

maiden fable
#

!pypi python_dotenv

unkempt canyonBOT
burnt heath
#

copied

maiden fable
#

Use the load_dotenv() method

slate swan
# maiden fable If the owner is returning None, then that means that y need members intent

This is what i got ```py
@commands.is_owner()
async def broadcast(ctx, message):
for guild in client.guilds:
# get the owner of guild
owner = guild.owner

    # check if dm exists, if not create it
    if owner.dm_channel is None:
        await owner.create_dm()
  
    # if creation of dm successful
    if owner.dm_channel is not None:
        await owner.dm_channel.send(message)

    for channel in guild.channels:             
        if channel.name == 'general':                 
            await channel.send(message)
burnt heath
maiden fable
maiden fable
burnt heath
#

k

slate swan
#

Do you have them defined?

maiden fable
#

It takes about an hour for them to get registered

slate swan
#

What program you using?

maiden fable
#

Then what's the issue

burnt heath
slate swan
#

The is_me func isnt checking any condition?

slate swan
#

Of course, it has to, dude

burnt heath
#

also can u tell me how to use python_dotenv, i dont really understand, like am i just supposed to add load_dotenv to my code?

maiden fable
burnt heath
#

i tried to import, results in an error

slate swan
#

!pypi dotenv

unkempt canyonBOT
slate swan
#

Yeah, check the ids

maiden fable
maiden fable
#

If he doesn't wanna check anything

#

Might as well remove the check

slate swan
#

Yeah

#

Check the perms then

slate swan
maiden fable
#

Yea changed the code

maiden fable
slate swan
#

what if the dms are closed or the bot isnt in any server

slate swan
#

its about the client/bot

maiden fable
maiden fable
silk lynx
# burnt heath

from dotenv import load_dotenv this is the correct usage

maiden fable
#

Yups

#

My bad, got confused

slate swan
# maiden fable wym

all i can say is most of my code is kind of messy and rn it says bot is not defined when it is

maiden fable
#

@burnt heath restart VSCode

#

It doesn't detect new modules while running

burnt heath
#

ok

silk lynx
maiden fable
#

Since u r in a cog

slate swan
burnt heath
#

i uninstalled, reinstalled, restarted still.

silk lynx
burnt heath
#

ye it probs is

grim oar
burnt heath
#

i had the same problem with requests

burnt heath
grim oar
#

No

burnt heath
#

then'?

grim oar
#

!d venv

unkempt canyonBOT
#

New in version 3.3.

Source code: Lib/venv/

The venv module provides support for creating lightweight “virtual environments” with their own site directories, optionally isolated from system site directories. Each virtual environment has its own Python binary (which matches the version of the binary that was used to create this environment) and can have its own independent set of installed Python packages in its site directories.

See PEP 405 for more information about Python virtual environments.

burnt heath
#

p sure im not using that

grim oar
burnt heath
#

guess it isnt

slate swan
burnt heath
grim oar
#

No need

slate swan
grim oar
#

can you try using pip list and see if dotenv is in there?

burnt heath
#

k wait

#

yea it isnt

grim oar
#

install it then

burnt heath
#

also im using discord.py, should i just change to pycord

grim oar
#

pip install -U dotenv

#

discord py is not maintained anymore so yeah use some other lib/fork

burnt heath
#

that gives error

grim oar
#

Huh

burnt heath
#

ok wait now dot env is there

grim oar
#

and it's working?

burnt heath
#

nope

#

dont understand this anymore, pip list shows python_dotenv and this shows no module named python_dotenv

tawdry perch
#

Are you in venv by any change?

burnt heath
#

no

tawdry perch
#

Correct python version?

burnt heath
#

3.9?

tawdry perch
#

Have you restarted the vsc?

burnt heath
#

yep

tawdry perch
#

Weird

slate swan
burnt heath
#

wait do u mean the dotenv file? where am i supposed to check that

#

or the env file where the token is

slate swan
#

Show the latest code

#

And make sure your bot has the permissions to delete messages

grim oar
#

Well, the error says that dotenv is not installed, it doesn't have anything to do with the env file you have

burnt heath
#

pip list shows dot env is there

tawdry perch
#

!pypi python-dotenv

unkempt canyonBOT
tawdry perch
#

This one?

burnt heath
#

yep

slate swan
#

Try doing it again

#

Installing*

burnt heath
#

done it 2 times

slate swan
#

And restart vsc

maiden fable
#

@burnt heath

slate swan
#

Oh

burnt heath
#

yes

maiden fable
#

You got more than one Python versions?

burnt heath
#

how can i check that

#

because i think i do

maiden fable
#

Control Panel

burnt heath
#

yeah i hve 3.7

maiden fable
#

Programs and Features

#

And?

burnt heath
#

3.9

maiden fable
#

There the issue is

slate swan
#

Does it fail to respond?

maiden fable
burnt heath
#

oh frick

maiden fable
#

There (:

burnt heath
#

ahhhhh

maiden fable
#

Now do py -3.9 -m pip install python_dotenv

slate swan
#

Hmm, try using dummy prints and see where the error is

maiden fable
#

Who would have guessed about two Python versions

burnt heath
#

tysm @maiden fable

maiden fable
#

(:

slate swan
maiden fable
#

BTW uninstall Python 3.7 since its more or less dead (according to me at least)

maiden fable
burnt heath
#

yep that works yet my final issue isnt resolved, still got about 200more errors to fix

tawdry perch
#

Painful

slate swan
maiden fable
keen talon
#

Sup everyone

maiden fable
#

Show a screenshot of the whole cog

keen talon
burnt heath
#

idt u can help with this?

maiden fable
#

the token is wrong

burnt heath
#

regen token and put it?

maiden fable
#

Still

#

I would advise u to put it directly

#

No need to regen

maiden fable
burnt heath
burnt heath
#

ok

maiden fable
burnt heath
#

the token error got fixed but this.

maiden fable
#

tf?

#

Lmao

#

u sure u put the correct token?

burnt heath
#

p sure

oblique cobalt
maiden fable
#

there must be 2 periods in it

maiden fable
burnt heath
#

there arent

maiden fable
#

The token format is like stuff.stuff.stuff

burnt heath
#

how am i supposed to get it right, i put what regened token gave

maiden fable
#

Mind showing a pic?

grim oar
#

that's client secret most likely

maiden fable
#

Yea

#

That's what am thinking too

burnt heath
maiden fable
#

Ah thought so

burnt heath
#

wait

maiden fable
#

Hahaha

burnt heath
#

im not supposed to do from there lmao

maiden fable
#

No

#

Go to the bot tab

#

Create Bot

#

Then copy the token

burnt heath
#

ty

maiden fable
slate swan
maiden fable
#

Anyone else here got this except me?

maiden fable
unkempt canyonBOT
#

Pasting large amounts of code

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

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

burnt heath
#

i got it too

maiden fable
slate swan
#

Everyone has it

maiden fable
#

Verified bots gotta request it

#

They don't have it by default