#discord-bots

1 messages · Page 473 of 1

warm terrace
#

but where do i put it in the code, ?

hasty iron
#

shouldnt be too hard

warm terrace
#

i meant in this

#

how to tho ?

untold token
#

The docs give you examples

#

You can read those

warm terrace
#

ohk

drifting arrow
#

I need an idea for a bot to make ;-;

heavy folio
#

wdym documentation? do i just need this piece of code?

#

or do i need this too?

#

idk which documentation

maiden fable
untold token
#

What is that

#

The indentation is painful

slate swan
#

can i use both client.event and bot.command()

boreal ravine
drifting arrow
untold token
#

Unless you define and client and bot together, not you cannot

#

And you shouldn't

#

Use bot

maiden fable
#

@heavy folio what's even tagscript tho?

untold token
#

If you are already using it

slate swan
boreal ravine
dapper cobalt
slate swan
maiden fable
untold token
boreal ravine
slate swan
boreal ravine
dapper cobalt
untold token
#

I mean if you do
client = bot = commands.Bot(...)
It would work, but you should never do this

drifting arrow
slate swan
untold token
#

It can cause naming issues and confusion

dapper cobalt
warm terrace
#

is there a way i can check if a song is being played in my bot ?

slate swan
dapper cobalt
warm terrace
dapper cobalt
#

!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)
slate swan
untold token
valid perch
#

Just don't. Use 1

untold token
#

You can only run one constructor

drifting arrow
#

Why are we still discussing the use of bot and client at the same time?

dapper cobalt
warm terrace
untold token
#

bot.run()
client.run() won't work

untold token
hasty iron
#

you can do client.loop.create_task(bot.start())

warm terrace
#

what if i dont want to do it from youtube, then how can i check if it is being played in ?

#

like as in general

dapper cobalt
untold token
#

Background task

#

But why would you do it lol

valid perch
#

Why would you do any of this. just use one

warm terrace
valid perch
#

But its not

untold token
valid perch
untold token
#

Oh

valid perch
#

Wassup

hasty iron
heavy folio
#

u get to make custom commands and if u do the delete block ({delete}) it'll delete command invocation etc

slate swan
#

can you make a bot that keep logs of what commands have been used?

valid perch
#

Yes

high flame
slate swan
valid perch
#

You'd want on_command_completion iirc

heavy folio
valid perch
#

That'd give you every command run. I use it for my command stats command

#

I assume your wanting something like that?

drifting arrow
drifting arrow
valid perch
#

No

drifting arrow
#

sigh

valid perch
#

This bot only has 1 user, so no need

drifting arrow
#

Do you save the commands externally so if the bot goes offline you maintain the statS?

valid perch
#

Correct, all stored in mongo

drifting arrow
#

Noice

valid perch
#

The base of the command is also open source as well cos tut

#

Although I should probably justify string widths lol

slate swan
drifting arrow
valid perch
#

!d discord.on_command_completion

unkempt canyonBOT
#

discord.on_command_completion(ctx)```
An event that is called when a command has completed its invocation.

This event is called only if the command succeeded, i.e. all checks have passed and the user input it correctly.
valid perch
#

Still want that, just save it differently

drifting arrow
#

neat imma create my own commands stats :3

slate swan
drifting arrow
slate swan
slate swan
drifting arrow
#

if it's between txt and csv, go with csv.

agile shale
#

Does anyone have a course suggestion where I can learn the discord module?

valid perch
#

Check pins

hoary gust
#

whats this error

slate swan
high flame
#
{
  "command_name": 54, // usage
  "command_name": 452,
  "command_name": 12
}
#

example pithink

hasty iron
#

that makes 0 sense, and i told you that earlier

hoary gust
hasty iron
#

what is "not working"

hoary gust
#

lemme show

#

wait a sec

summer jungle
#

Does anyone know how people do those menus with the reactions that changes page?

high flame
hasty iron
#

thanks

high flame
#

np

slate swan
#

can someone help me with this?

vc.play(self.source, after= what should be here?)

hasty iron
#

a non-async function

slate swan
#

hmmm ok

summer jungle
untold token
#

You can use discord-ext-menus for pagination

hoary gust
#

@hasty iron

untold token
#

Menus that change pages on reaction

hasty iron
#

ipc client*

hoary gust
summer jungle
#

Is there any way to track if someone reacts to a message

hasty iron
#

because its not running?

hoary gust
#

8888 port should work

#

its running

heavy radish
#

Hello. I'm doing research to make a BOT that reads embeds. I'm tryna code it in Python (obv) where should I learn ?

hasty iron
hoary gust
hasty iron
#

on the same machine

untold token
hoary gust
untold token
#

You need to get the message object that has an embed

heavy radish
untold token
#

For example

heavy radish
#

Yes...

agile shale
#

Does anyone have a up-to-date course suggestion where I can learn the discord module?

hoary gust
hasty iron
#

ok what is it

heavy radish
#

Hopefully reply to my message. I'm gonna get a sip of water

#

I'll be back ASAP

keen comet
untold token
#
Embeds = message.embeds # message is the message object and embeds returns a list of embeds that are in the message itself

print(str(Embeds[0].title)) # if the embed has an title, it will print the content of the title and Embeds[0] is the first embed in the list of embeds that was returned from attribute .embeds```
#

Ofc this is just an example

hoary gust
untold token
#

You can make it much better

hasty iron
#

why is it binding to ipv6

hoary gust
hasty iron
#

::1 is the localhost for IPv6

hoary gust
#

am i supposed to connect to ipv4

hoary gust
hasty iron
#

no clue tbh

dapper cobalt
hasty iron
#

i have no idea why its trying to bind to ::1

untold token
#

Because they are doing this on replit

quasi pawn
#

Why does my commands stop working when I added an event?

untold token
hasty iron
heavy island
#

is it possible to make buttons with discord py

untold token
#

You need to call process_commands in the event or use
@bot.listen()

hasty iron
untold token
#

I am talking about the ipv6 issue

#

::1 thing

hasty iron
#

you have to explicitly pass it in lol

quasi pawn
#

I see

hasty iron
#

either pass in a socket.socket with the AF_INET6 family into loop.create_server or something else

#

replit cant mess with that

untold token
#

Oh I see

untold token
unkempt canyonBOT
#

listen(name=None)```
A decorator that registers another function as an external event listener. Basically this allows you to listen to multiple events from different places e.g. such as [`on_ready()`](https://discordpy.readthedocs.io/en/stable/api.html#discord.on_ready "discord.on_ready")

The functions being listened to must be a [coroutine](https://docs.python.org/3/library/asyncio-task.html#coroutine "(in Python v3.9)").

Example...
untold token
#

Read this for more info about external event listeners

lament mesa
slate swan
#

it says TypeError: <lambda>() takes 0 positional arguments but 1 was given

#

how do i fix this? im doing after = lambda: event_loop.create_task(self.a())

stiff nexus
#

help??

    @discord.ui.button(label="Invite Me", url="https://discord.com/api/oauth2/authorize?client_id=862915751174078465&permissions=8556379383&scope=bot%20applications.commands")
    async def link(self, button: discord.ui.Button, interaction: discord.Interaction):
      pass

error```py
Traceback (most recent call last):
File "main.py", line 22, in <module>
from help import HelpCommand
File "/home/runner/help.py", line 25, in <module>
class about(discord.ui.View):
File "/home/runner/help.py", line 58, in about
@discord.ui.button(label="Invite Me", url="https://discord.com/api/oauth2/authorize?client_id=862915751174078465&permissions=8556379383&scope=bot applications.commands")
TypeError: button() got an unexpected keyword argument 'url'

boreal ravine
#

@stiff nexus does the button have url kwarg?

boreal ravine
#

does the button have a url kwarg

stiff nexus
#

YES

boreal ravine
#

maybe read the docs on 3rd party libs

hoary gust
#

@hasty iron

#

i fixed those

#

but how can i set a url to my web address

lament mesa
#

what web address?

#

a custom domain?

#

replit will provide a domain iirc @hoary gust

hoary gust
bitter depot
#

@red nest Make sure not to sure your token

red nest
#

oh sorry

bitter depot
#

You should regen your token ^ @red nest

lament mesa
hoary gust
#

tell me how to do it

lament mesa
#

and run the web server on a service like heroku

red nest
hoary gust
#

thats why i need to use it with my bot

lament mesa
#

cant you run the server separately?, no?

hoary gust
hoary gust
#

else ipc is not working

red nest
#

ok can someone help me now it says member not found in the unban command

keen comet
vale root
#

Should discord.member be guild.member?

red nest
red nest
keen comet
#

like 810533927492124693

red nest
#

ok

#

with the id it says the same thing

#

so also with the id it doesn't work

hoary gust
#

@lament mesa

slate swan
#

can someone please help me and tell me why this is ahhpening?
after = lambda: event_loop.create_task(self.next_sound())
it says TypeError: <lambda>() takes 0 positional arguments but 1 was given

dusk star
#

how do i write it so that bot will join my vc when i type (prefix)join?

slate swan
unkempt canyonBOT
#

await connect(*, timeout=60.0, reconnect=True, cls=<class 'discord.voice_client.VoiceClient'>)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).

Connects to voice and creates a [`VoiceClient`](https://discordpy.readthedocs.io/en/stable/api.html#discord.VoiceClient "discord.VoiceClient") to establish your connection to the voice server.
sweet merlin
#

any simple way to make space in commands without using message.startswith?

tight obsidian
#

Can you show more code?

slate swan
tight obsidian
slate swan
#

oh

hasty iron
#

you shouldn’t use loop.create_task

#

in the after

#

you should use asyncio.run_coroutine_threadsafe

slate swan
#
@client.command()
async def banner(ctx, *,  bannermember : discord.Member=None):
    if bannermember == None:
     bannermember = ctx.author
    userBannerUrl = user.banner_url
    embed = discord.Embed(title=f"{ctx.author}'s banner", color=0x030203)
    embed.set_image(url=user.banner.url)
    await ctx.send(embed=embed)
#

what am i doing wrong

#

🙏

tight obsidian
hasty iron
#

the docs have it too

#

in the FAQ

tight obsidian
#

that's a weird place to put it

slate swan
#

any help?

hoary gust
#

Fix error plz help

slate swan
#

bannermember not user 😛

tight obsidian
#

if it's part of the contract for this function, it should be in the docs for this function

slate swan
#

you have define the member as bannermember not as user

slate swan
hoary gust
#

Someone tell mee how to add a domain to my flask server

slate swan
#

aight

slate swan
#

still not working lol

@client.command()
async def banner(ctx, *,  bannermember : discord.Member=None):
    if bannermember == None:
     bannermember = ctx.author
    userBannerUrl = bannermember.banner.url
    embed = discord.Embed(title=f"{ctx.author}'s banner", color=0x030203)
    embed.set_image(url=user.banner.url)
    await ctx.send(embed=embed)

heres the code

#

thats the error

#

...

hasty iron
#

you need 2.0 installed

slate swan
hasty iron
#

discordpy 2.0

slate swan
#

ohh

#

Ohhh

#

aight hold on

hasty iron
#

you need to have git to install it too

#

pip install git+<github url>

slate swan
#

ye ik

#

thanks

sweet merlin
rare saddle
#

How to create a category using a bot?

slate swan
unkempt canyonBOT
#

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

Same as [`create_text_channel()`](https://discordpy.readthedocs.io/en/stable/api.html#discord.Guild.create_text_channel "discord.Guild.create_text_channel") except makes a [`CategoryChannel`](https://discordpy.readthedocs.io/en/stable/api.html#discord.CategoryChannel "discord.CategoryChannel") instead.

Note

The `category` parameter is not supported in this function since categories cannot have categories.
rare saddle
empty bough
#

Hi, i don't know nothing about programing

lament mesa
drifting arrow
#

🤔

lament mesa
#

You can have your web-app on heroku and give it a domain

amber imp
#

help pls when i used @bot.event after @bot.command it's not working
y?

lament mesa
hasty iron
lament mesa
#

i think they want a custom domain

hasty iron
#

oh

stark hearth
drifting arrow
#

Is there any way I can align "uses" to the right?

#

so it looks neater.

bitter depot
#

Yes

#

You can use rjust

#

!d str.rjust

unkempt canyonBOT
#

str.rjust(width[, fillchar])```
Return the string right justified in a string of length *width*. Padding is done using the specified *fillchar* (default is an ASCII space). The original string is returned if *width* is less than or equal to `len(s)`.
bitter depot
#

!e py print("hello") print("s") print("s".rjust(5))

unkempt canyonBOT
#

@bitter depot :white_check_mark: Your eval job has completed with return code 0.

001 | hello
002 | s
003 |     s
lament mesa
#

ooh

bitter depot
#

@drifting arrow ^^

quasi pawn
#

How do I use the guild's icon as the author?

boreal ravine
drifting arrow
rare saddle
#

How do I prevent everyone from viewing a category?

turbid pivot
#
@client.command(aliases=['tm'])
async def tempmute(ctx, member: discord.Member, duration: int, time: str, *, reason="None"):
    guild: discord.Guild = ctx.guild
    mutedRole = discord.utils.get(guild.roles, name="Muted")

    if not mutedRole:
      mutedRole = await guild.create_role(name="Muted")

    for channel in guild.channels:
        await channel.set_permissions(mutedRole, speak=False, send_messages=False, read_message_history=True, read_messages=False)

        embed = discord.Embed(title="Muted!", description=f"{member.mention} has been tempmuted ", colour=discord.Colour.light_gray())
        embed.add_field(name="Reason:", value=reason, inline=False)
        embed.add_field(name="Time left for the mute:", value=f"{time}", inline=False)
        await ctx.send(embed=embed)
        await member.add_roles(mutedRole)

        if "s" == time:
                await asyncio.sleep(duration)

        elif "m" == time:
            duration_min = duration * 60
            await asyncio.sleep(duration_min)

        elif "h" == time:
            duration_hour = duration * 3600
            await asyncio.sleep(duration_hour)

        elif "d" == time:
            duration_day = duration * 86400
            await asyncio.sleep(duration_day)

        await member.remove_roles(mutedRole, reason=None)```
#

the code and the error coming when i m running the command

slate swan
#

you use it wrong

#

probably

turbid pivot
#

me?

slate swan
#

yes

bitter depot
# drifting arrow

Having units line up with your hundreds smh. At the very least zfill please

lyric moat
#

why it gives error when i try i:

slate swan
#

lambda

#

not lamba

lyric moat
#

alright thanks

slate swan
#

and vaule?

bitter depot
#

!e py print(100) print(1) print("1".zfill(3)) @drifting arrow

unkempt canyonBOT
#

@bitter depot :white_check_mark: Your eval job has completed with return code 0.

001 | 100
002 | 1
003 | 001
slate swan
#

that also seems wrong...

turbid pivot
slate swan
lyric moat
#

other error py interaction = await client.wait_for("select_option", check = lambda i: i.component[0].vaule == "A")

slate swan
#

where did you do this all

#

it has to be in an event or command

bitter depot
#

!e py print(100) print(1) print(f"{1:>3}")and this if you don't want the leading 0s @drifting arrow

unkempt canyonBOT
#

@bitter depot :white_check_mark: Your eval job has completed with return code 0.

001 | 100
002 | 1
003 |   1
turbid pivot
slate swan
#

1d is a string

lyric moat
slate swan
#

you see

lyric moat
#
@client.command()
async def selectmenu(ctx):
  await ctx.send("Pick one of the buttons.", componets = [Select(placeholder="Select One Of The Values", options=[SelectOption(label="A", value="A"), SelectOption(label="B", vaule="B")])])

interaction = await client.wait_for("select_option", 
check = lambda i: i.component[0].vaule == "A")

await intercation.respond(content = f"You have selected `{interaction.componet[0]. label}`")```
slate swan
#

that's a name error with intercation

#

but that's not for now

drifting arrow
slate swan
#

you indented wrong

lyric moat
#

me?

slate swan
#
@client.command()
async def selectmenu(ctx):
  await ctx.send("Pick one of the buttons.", componets = [Select(placeholder="Select One Of The Values", options=[SelectOption(label="A", value="A"), SelectOption(label="B", vaule="B")])])

  interaction = await client.wait_for("select_option", 
check = lambda i: i.component[0].value == "A")

await interaction.respond(content = f"You have selected `{interaction.componet[0]. label}`")```
lyric moat
#

try that?

slate swan
#

look for your indents mate

#

and try not doing so many typos

bitter depot
#

Imo even justpy mystatuses += f"{self.stats[x]['users']:>3}\n"is an improvement

drifting arrow
turbid pivot
bitter depot
drifting arrow
#

Now I feel violated coz the number is on the left and not centered or right ;-;

slate swan
slate swan
#

how do you want to convert 1d to an int

drifting arrow
#
@commands.command()
    @commands.is_owner()
    async def printstats(self, ctx):
        embed = discord.Embed()
        mystatname = ''
        mystatuses = ''
        embed.add_field(name="Statistics", value="The statistics on how many times you've used each command.", inline="False")
        for x in self.stats:
            print(self.stats[x])
            mystatname += (f"{self.stats[x]['Name']} \n")
            mystatuses += f"{self.stats[x]['users']:>3}\n"
        embed.add_field(name="Commands", value=mystatname, inline="True")
        embed.add_field(name="Uses", value=mystatuses, inline="True")
        # filename and extension have to match (ex. "thisname.jpg" has to be "attachment://thisname.jpg")
        await ctx.send(embed=embed)
slate swan
#

!d discord.Guild.default_role

unkempt canyonBOT
turbid pivot
lyric moat
#

🤨 ...

rare saddle
slate swan
turbid pivot
slate swan
#

ints are numbers

#

blabla is not a number

bitter depot
slate swan
#

so you can't make blabla to a number

turbid pivot
slate swan
#

you can do that

rare saddle
slate swan
#

that's exactly the opposite of the tag

lyric moat
#

wsp with the error

slate swan
#

ctx.guild.default_role

rare saddle
slate swan
#

you'res welcome

bitter depot
lyric moat
#

anyone

turbid pivot
#

@slate swanty that worked

reef shell
drifting arrow
#

No changes @bitter depot

lyric moat
#

for which?

slate swan
boreal ravine
#

his last error lol

lyric moat
#

i am confused

bitter depot
slate swan
lyric moat
#

how i fix this?

boreal ravine
slate swan
#

look at the code maybe

#

cuz he didn't

boreal ravine
#

well it looked liked it

slate swan
#

I dunno, that code just seems right

#

I don't know if he should put that discordcomponents stuff in on_ready

#

probably not

rare saddle
#

Where can I see a list of all channel permissions?

lyric moat
#

so do i do @client.event()??

slate swan
#

!d discord.Member.permissions_in

unkempt canyonBOT
#

permissions_in(channel)```
An alias for [`abc.GuildChannel.permissions_for()`](https://discordpy.readthedocs.io/en/stable/api.html#discord.abc.GuildChannel.permissions_for "discord.abc.GuildChannel.permissions_for").

Basically equivalent to:

```py
channel.permissions_for(self)
slate swan
#

sheesh

bitter depot
slate swan
rare saddle
slate swan
#

np

drifting arrow
#

@bitter depot

#

tbh i think it's just the way discord embs shit

#

coz it even removes spaces

bitter depot
#

yeah, discord does remove spaces

#

If it's all one string though it should work

drifting arrow
#

Apparently in embs as well. coz when I uglify it even more..

bitter depot
#

I mean that is correct though

#

It's alligned in the embeds

drifting arrow
#

indeed

#

so it's just a discord thing? just live with it? 🤔

bitter depot
#

Maybe do inline codeblock instead?

drifting arrow
#

oh

bitter depot
#

See how that looks

drifting arrow
#

so 1 `?

bitter depot
#

And would still format

bitter depot
drifting arrow
#

What started off as a thing I thought would take an hr tops ended up with me spending like 3hrs on ;-;

bitter depot
drifting arrow
#

BUT OH BOY!

inland quailBOT
#
​No Category:
  help Shows this message

Type $help command for more info on a command.
You can also type $help category for more info on a category.
drifting arrow
#

I got a whole new statistics thing

bitter depot
#

I guess it's still worth trying a zws

#

That might make discord keep the spaces

drifting arrow
#

@slate swan Lol

#

I am in certain discords.

#

What's ZWS?

bitter depot
#

!charinfo ​

unkempt canyonBOT
bitter depot
#

zero width space

#

1
​1

#

yeah

#

it works

#

Lemme just remember how to do this

opaque trail
unkempt canyonBOT
#

str.rjust(width[, fillchar])```
Return the string right justified in a string of length *width*. Padding is done using the specified *fillchar* (default is an ASCII space). The original string is returned if *width* is less than or equal to `len(s)`.
bitter depot
#
f"{value['uses']:​>3}\n"```copy-paste this (it has the zws in it)
bitter depot
unkempt canyonBOT
#
Did you mean ...

defaultdict
mutable-default-args

high flame
lyric moat
#

whats the error..

opaque trail
#

the hell

unkempt canyonBOT
high flame
lyric moat
high flame
#

event

lyric moat
high flame
#

bot.event

opaque trail
#

@bot.event without ()

lyric moat
#
@client.event
async def on_ready():
  print("The bot is ready to be used!")
  DiscordComponents(client)```
#

but bot instead of client..?

drifting arrow
high flame
#

You have client so use client ._.

drifting arrow
#

depends on what you are using tbh

opaque trail
#

yes

lyric moat
#

So how i fix it

drifting arrow
#

im using bot so bot for me

lyric moat
#

i did

opaque trail
#

and it should be fine

lyric moat
#

i have it

opaque trail
#

ok and does it work

lyric moat
#

nope

opaque trail
#

hm

drifting arrow
#

Also @bitter depot after this, I get to go back and add these new features to my fun facts code!

#

HECK YEAH!

lyric moat
#

this is confusing

drifting arrow
#

Welcome to code \o/

#

And remember to name stuff properly or else you'll wake up tomorrow being like 'dafuq is this shit do?' and spend like 10 minutes figuring it out

#

and never! EVER! leave your code on an error.

#

fix that error THEN go to bed.

#

Or leave a note.

opaque trail
#

i leave todos and errors when i push to githubaPES_EvilPlan

#

menace to society

drifting arrow
opaque trail
#

I release releases on pypi that include errors 😈 😈 😈 😈

calm ravine
#

print('Hello, world!')

drifting arrow
#

!e print("Hello World")

unkempt canyonBOT
#

@drifting arrow :white_check_mark: Your eval job has completed with return code 0.

Hello World
drifting arrow
#

\o/

opaque trail
#

!e print(eval("2 + 2"))

unkempt canyonBOT
#

@opaque trail :white_check_mark: Your eval job has completed with return code 0.

4
vestal owl
#
@bot.event
            async def on_raw_reaction_add(payload):
                message_id = rct_msg.id
                if message_id == payload.message_id:
                    member = payload.member
                    guild = member.guild
                    emoji = payload.emoji.name
                    if emoji == '👍':
                        member_id = member.id
                        member_id = str(member_id)
                        registered = reg_user.append(member_id)
                        reaction = await bot.wait_for('reaction_add', check = registered, timeout = None)
            message = await bot.wait_for('message', check = lambda message: str(message.author.id) in reg_user and message.channel.id == my_channel.id, timeout = None)
            if message.content.lower() == 'registration complete':
                await my_channel.send(embed = discord.Embed(title = 'Successful!', description = 'All users registered!', color = discord.Color.green()))
                members = ctx.guild.members
                user_id = message.author.id
                for member in members:
                    member_id = member.id
                    if str(user_id) in str(member_id):
                        reg_users = my_channel.overwrites_for(ctx.guild.default_role)
                        reg_users.send_messages = True
                        print('true')
                    else:
                        else_user = my_channel.overwrites_for(ctx.guild.default_role)
                        else_user.send_messages = False
                        else_user = my_channel.overwrites_for(member_id)```
I'm trying to create a feature where if someone reacts to a reaction ``:thumbsup:``, they get appended to a list which gives them access to a particular channel, but I'm having trouble executing this with the error telling me ``my_channel.overwrites_for()`` can't be a string, only a member/role, so what should I do?
opaque trail
#

else_user = my_channel.overwrites_for(member)

vestal owl
#

shouldn't it be reg_users = my_channel.overwrites_for(member)

vestal owl
slate swan
vestal owl
#

but still

#

it doesnt work

slate swan
#

that's still not useful

vestal owl
#

you want the error

slate swan
#

of course

vestal owl
#

there is none

slate swan
#

no error

vestal owl
#

the code just doesn't function as intended

slate swan
#

what does it do

vestal owl
#

as in, when I use my ALT account to view the same channel, it should not be able to send messages in the channel because it didn't register by reacting to the emote

#

but it can send messages

slate swan
#

discord config issue?

vestal owl
#

im not sure to be honest

slate swan
#

should be

#

if he's not in the list

vestal owl
#

then what do I do?

slate swan
#

a config problem

vestal owl
#

there is no feedback from console

slate swan
#

check your channel configurations in the server

vestal owl
#

or maybe my code is messed up

slate swan
#

dunno

vestal owl
#

like how I set up the server?

#

the settings right

slate swan
#

yes

vestal owl
#

nothing is off

#

maybe its my code

lyric moat
#

bro this error

vestal owl
#

send the code

hasty iron
#

its just @bot.event

lyric moat
# vestal owl send the code
import discord
from discord.ext import commands
import random
import os
import aiohttp
from discord_components import *





client = commands.AutoShardedBot
(commands.when_mentioned_or("+"))

@client.event
async def on_ready():
  print("The bot is ready to be used!")
  DiscordComponents(client)

@client.command()
async def selectmenu(ctx):
  await ctx.send("Pick one of the buttons.", components = [Select(placeholder="Select One Of The Values", options=[SelectOption(label="A", value="A"), SelectOption(label="B", value="B")])])

  interaction = await client.wait_for("select_option", check = lambda i: i.component[0].value == "A")

  await interaction.respond(content = f"You have selected `{interaction.component[0].label}`")

  interactionb = await client.wait_for("select_option", check = lambda i: i.component[1].value == "B")

  await interactionb.respond(content = f"You have selected `{interactionb.component[1].label}`")

TOKEN = os.environ ['TOKEN']
client.run(TOKEN)```
lyric moat
crude crater
#

How can I fix a command just not working? Like I type in the command in Discord but nothing happens

maiden fable
#

code?

crude crater
#

No error, nothing. I just type it and it don’t work

#

Yeah 1 sec

#
@client.command(aliases=["SERVERINFO", "Serverinfo", "Serverinformation", "SERVERINFORMATION", "serverinformation"])
async def serverinfo(ctx):
        embed = Embed(title="Server information",
                      colour=ctx.guild.owner.colour,
                      timestamp=datetime.utcnow())

        embed.set_thumbnail(url=ctx.guild.icon_url)


        fields = [("ID", ctx.guild.id, True),
                ("Owner", ctx.guild.owner, True),
                ("Region", ctx.guild.region, True),
                ("Created at", ctx.guild.created_at.strftime("%m/%d/%Y %H:%M:%S"), True),
                ("Members", len(ctx.guild.members), True),
                ("Humans", len(list(filter(lambda m: not m.bot, ctx.guild.members))), True),
                ("Bots", len(list(filter(lambda m: m.bot, ctx.guild.members))), True),
                ("Text channels", len(ctx.guild.text_channels), True),
                ("Voice channels", len(ctx.guild.voice_channels), True),
                ("Categories", len(ctx.guild.categories), True),
                ("Roles", len(ctx.guild.roles), True),
                ("\u200b", "\u200b", True)]

        for name, value, inline in fields:
            embed.add_field(name=name, value=value, inline=inline)

        await ctx.send(embed=embed)
maiden fable
#

do u have an error handler?

#

@crude crater if u want to do like that, I prefer u use this

urban raven
#
@bot.event
            async def on_raw_reaction_add(payload):
                message_id = rct_msg.id
                if message_id == payload.message_id:
                    member = payload.member
                    guild = member.guild
                    emoji = payload.emoji.name
                    if emoji == '👍':
                        member_id = member.id
                        member_id = str(member_id)
                        registered = reg_user.append(member_id)
                        reaction = await bot.wait_for('reaction_add', check = registered, timeout = None)
            message = await bot.wait_for('message', check = lambda message: str(message.author.id) in reg_user and message.channel.id == my_channel.id, timeout = None)
            if message.content.lower() == 'registration complete':
                await my_channel.send(embed = discord.Embed(title = 'Successful!', description = 'All users registered!', color = discord.Color.green()))
                members = ctx.guild.members
                user_id = message.author.id
                for member in members:
                    member_id = member.id
                    if str(user_id) in str(member_id):
                        reg_users = my_channel.overwrites_for(ctx.guild.default_role)
                        reg_users.send_messages = True
                        print('true')
                    else:
                        else_user = my_channel.overwrites_for(ctx.guild.default_role)
                        else_user.send_messages = False
                        else_user = my_channel.overwrites_for(member_id)
maiden fable
#

!d discord.Embed.from_dict

unkempt canyonBOT
#

classmethod from_dict(data)```
Converts a [`dict`](https://docs.python.org/3/library/stdtypes.html#dict "(in Python v3.9)") to a [`Embed`](https://discordpy.readthedocs.io/en/stable/api.html#discord.Embed "discord.Embed") provided it is in the format that Discord expects it to be in.

You can find out about this format in the [official Discord documentation](https://discord.com/developers/docs/resources/channel#embed-object).
unkempt canyonBOT
#

Pasting large amounts of code

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

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

urban raven
#

!paste

crude crater
crude crater
urban raven
#

i just wanna ask

#

How do u make them colour ful 🤣

crude crater
#

!code

urban raven
#

oh thx

crude crater
#

Copy and paste the back ticks with the “py”

urban raven
#
@bot.event
            async def on_raw_reaction_add(payload):
                message_id = rct_msg.id
                if message_id == payload.message_id:
                    member = payload.member
                    guild = member.guild
                    emoji = payload.emoji.name
                    if emoji == '👍':
                        member_id = member.id
                        member_id = str(member_id)
                        registered = reg_user.append(member_id)
                        reaction = await bot.wait_for('reaction_add', check = registered, timeout = None)
            message = await bot.wait_for('message', check = lambda message: str(message.author.id) in reg_user and message.channel.id == my_channel.id, timeout = None)
            if message.content.lower() == 'registration complete':
                await my_channel.send(embed = discord.Embed(title = 'Successful!', description = 'All users registered!', color = discord.Color.green()))
                members = ctx.guild.members
                user_id = message.author.id
                for member in members:
                    member_id = member.id
                    if str(user_id) in str(member_id):
                        reg_users = my_channel.overwrites_for(ctx.guild.default_role)
                        reg_users.send_messages = True
                        print('true')
                    else:
                        else_user = my_channel.overwrites_for(ctx.guild.default_role)
                        else_user.send_messages = False
                        else_user = my_channel.overwrites_for(member_id)
crude crater
#

It’s right next to the 1 on your keyboard to the left

urban raven
#

ik

crude crater
#

Word

maiden fable
#

@crude crater I just linked u to the docs

#

Embed.from_dict()

slate swan
#

discord.py is kinda outdated, idk if buttons work on that, try py-cord

hasty iron
#

they do, you can use 2.0

#

they have views

slate swan
#

hey again
i want to make a log for lets say if someone joins the general call, in a text channel it tags the user and say that he joined
my current code is

#
@commands.Cog.listener()
  async def on_voice_state_update(self, ctx, before, after):
    logschannel = 886341890734186536
    if before.channel is None and after.channel is not None:
        if after.channel.id == 886331304944214077:
            await ctx.logschannel.send("Alarm!")
valid perch
#

And...? Whats the last part, I.e your question / error so we can help

slate swan
#

for some reason all the perms are the same

hoary gust
#

My dashboard working now

slate swan
#

when accessing the value of the key from old_perms they're the same as the ones when i'm looping in after.overwrites (i printed them out, they were the same)

hoary gust
#

@slate swan can I ask u a question?

slate swan
#

what

hoary gust
#

I mean if want to send a msg that I typed in the dashboard but it's not a event nor a cmd so how can I make my bot send the msg

slate swan
#

idk, never made a dashboard

hoary gust
#

I mean is there anything in the dpy lib that can do this

hasty iron
hoary gust
#

@hasty iron I don't mean that

slate swan
#

as i said never made a dashboard

hasty iron
#

a non-web lib having web features

#

seems a bit unlikely

hoary gust
hasty iron
#

i know what you’re asking

hoary gust
#

I mean I want to send a msg from my dashboard but what shall I use in dpy that can help me send the msg cause it is not a cmd nor a event so is there anything else

hasty iron
#

make something yourself, dpy offers nothing to do what you’re thinking

hoary gust
#

I mean any tasks or something like that?

hasty iron
#

tasks?

valid perch
#

You can use ipc for the link, then that calls a function on your bot

hasty iron
#

actually wont you have to write js to make something like user input and make it show

hoary gust
#

@valid perch I am just trying to send a msg but how cause if I even set a msg in dashboard and sent it from there then how will it get triggered in the bot

#

Cause it's not a cmd nor event

#

And that's the place I am getting confused

hasty iron
#

how would the bot know where to send the message

valid perch
hoary gust
#

Ok

slate swan
#

heyo guys if i use prefixes.json and upload it to github will it still work??

#

cause i use heroku

valid perch
#

Probably better to use an external database

reef trail
#

is there a command decorator that allows a specific user do bypass perms? like how there's one for roles, is there one for users?

slate swan
reef shell
#

i use heroku for now

waxen granite
#
    futuredate = datetime.datetime.utcnow() + timedelta(seconds=timewait)
TypeError: function missing required argument 'year' (pos 1)```
slate swan
reef shell
#

and if i ignore the file will it work?

slate swan
reef shell
#

in .gitignore

reef trail
#

put the file name in there

#

and GitHub will ignore it

slate swan
#

to find out

reef shell
#

My question is everytime i push to heorku master it will overwrite it r8?

reef trail
#

no?

#

well wdym by overwrite it

reef shell
#

cuz my local file is not updated

slate swan
reef trail
#

It'll pull the changes you made into your current files

slate swan
reef shell
reef trail
slate swan
#

? for just testing

reef trail
#

go read this pin

reef shell
#

I don't need this rn

#

so maybe later

slate swan
#

ok

#

what bot u working on ?? @reef shell

#

moderation,music,fun,giveaway

#

?

reef shell
slate swan
slate swan
waxen granite
#
    futuredate = datetime.datetime.utcnow() + timedelta(seconds=timewait)
TypeError: function missing required argument 'year' (pos 1)```
valid perch
#

Full error?

waxen granite
#

that is full error

slate swan
#

how can i fix this it says delete is not defined:

 await delete(guild.text_channels, reason=None)
reef shell
#

lmao what are you trying to do

#

it's TextChannel.delete() probably

unkempt canyonBOT
#
NEGATORY.

No documentation found for the requested symbol.

valid perch
#

!d discord.TextChannel.delete

unkempt canyonBOT
#

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

Deletes the channel.

You must have [`manage_channels`](https://discordpy.readthedocs.io/en/stable/api.html#discord.Permissions.manage_channels "discord.Permissions.manage_channels") permission to use this.
reef shell
#

you need to get a channel object first tho

dense walrus
#

Can I have 2 same events in one cog? if yes, how do I do it?

dense walrus
#

I am checking 2 different thing on_member_update and I want to code it organized

#

I can stick with 1 function but I rather 2

slate swan
#

well, commands.Cog.listener would work in multiple cogs for sure

#

in 1 cog, idk....

dense walrus
#

mhm

slate swan
#

!d discord.ext.commands.Cog.listener

unkempt canyonBOT
#

classmethod listener(name=None)```
A decorator that marks a function as a listener.

This is the cog equivalent of [`Bot.listen()`](https://discordpy.readthedocs.io/en/stable/ext/commands/api.html#discord.ext.commands.Bot.listen "discord.ext.commands.Bot.listen").
slate swan
#

not said

dense walrus
#

well I'll just stick with 1 event itll be good

slate swan
#

well it doesn't have any pros to have it in 2 events....

stiff nexus
#

anyone got the link to the github page where there was a list of bad words??

valid perch
#

Google probably does

dapper cobalt
high flame
#

it doesn't require anything

#

!d datetime.timedelta

unkempt canyonBOT
#

class datetime.timedelta(days=0, seconds=0, microseconds=0, milliseconds=0, minutes=0, hours=0, weeks=0)```
All arguments are optional and default to `0`. Arguments may be integers or floats, and may be positive or negative.

Only *days*, *seconds* and *microseconds* are stored internally. Arguments are converted to those units...
high flame
#

all are optional

spare agate
#

change_presence() missing 1 required positional argument: 'self', does anyone know how to fix it?

async def on_ready(self):
        self.client_id = (await self.application_info()).id
        
        activity = discord.Game(name= "-help", type= 3)
        await commands.Bot.change_presence(status=discord.Status.idle, activity=activity)
manic wing
#

you need to make an instance of bot o.O

high flame
#

you need a commands.Bot instance

#

and not copy paste it in your code pithink

spare agate
#

ok

high flame
#

you have bot?

#

or client

#

or whatever your commands.Bot is, just use it instead of commands.Bot

spare agate
#

ok

spare agate
#

I have bot = commands.Bot

craggy cloak
#

Why is this idle thing not working? await client.change_presence(status=discord.Status.idle)

slate swan
#

gamesession is not defined

kindred epoch
#

it takes some seconds to change it to idle

craggy cloak
#

no?

#

o k

slate swan
#

Can anyone help me

kindred epoch
#

dont ask to ask

slate swan
#

how to make a bot to send message in one channel

kindred epoch
#

use get_channel to get the channel by using its id and then use .send to send a message to that channel

#

!d discord.ext.commands.Bot.get_channel

unkempt canyonBOT
reef shell
#

I use heroku for hosting for now.. I tried adding *.json in gitignore file so that it ignores my local changes in json file . But it doesn't work, any solution to this?

minor totem
rare saddle
#

How to install lavalink?

reef shell
slate swan
#
@client.command()
async def eat(ctx, member:discord.Member=None):
  wc = Image.open('cats-eating-bananas2.jpg')

  draw = ImageDraw.Draw(wc) 
  font = ImageFont.truetype("font.otf", 40)
  text = (f"{ctx.member.name}")
  draw.text((394,340), text, (255,255,255), font=font)
  wc.save('eatmeme.jpg')
  await ctx.send(file = discord.File('eatmeme.jpg'))
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: AttributeError: 'Context' object has no attribute 'member'
reef shell
#

It's ctx.user

slate swan
#

how do i create an invite for a guild

#

what i did didnt work but i suck at using docs so i'm not suprised

reef shell
#

Oops

slate swan
#

bro what

wicked atlas
unkempt canyonBOT
#

Microsoft Visual C++ Build Tools

When you install a library through pip on Windows, sometimes you may encounter this error:

error: Microsoft Visual C++ 14.0 or greater is required. Get it with "Microsoft C++ Build Tools": https://visualstudio.microsoft.com/visual-cpp-build-tools/

This means the library you're installing has code written in other languages and needs additional tools to install. To install these tools, follow the following steps: (Requires 6GB+ disk space)

1. Open https://visualstudio.microsoft.com/visual-cpp-build-tools/.
2. Click Download Build Tools >. A file named vs_BuildTools or vs_BuildTools.exe should start downloading. If no downloads start after a few seconds, click click here to retry.
3. Run the downloaded file. Click Continue to proceed.
4. Choose C++ build tools and press Install. You may need a reboot after the installation.
5. Try installing the library via pip again.

rare saddle
reef shell
#

!source

unkempt canyonBOT
slate swan
#
l = await guild.create_invite(reason="New Guild",max_age=0, max_uses=0)
``` wont work
kindred epoch
#

show the whole code

slate swan
#
@bot.event
async def on_guild_join(guild):
    db[f"{guild.id} welc"] = f"NEW GUILD {guild.id}"
    db[f"{guild.id} msg"] = f"`SET NEW MESSAGE`"
    db[f"{guild.id} footer"] = f"SET NEW FOOTER"
    l = await guild.create_invite(reason="New Guild",max_age=0, max_uses=0)
    embed = discord.Embed(description=f"New Guild Joined\nGuild Name: `{guild.name}`\nMember Count: `{guild.member_count}`\nGuild Owner: `{guild.owner}`",color=color)
    channel = bot.get_channel(887497183203581982)
    await channel.send(embed=embed,
    components=[
        Button(
            style=ButtonStyle.URL,
            label="Guild Invite",
            url=l
        )
    ]
    )
reef shell
#

It's against ToS

slate swan
#

huh ?

reef shell
#

Creating invite without a server's consent upon joinng or later is considered as a privacy breach

slate swan
#

that is the dumbest shit ive ever heard im sorry so ima have to ask if i can invite someone to a server like what ?/

kindred epoch
#

?

#

do you own the server?

slate swan
#

yes

#

the server im tryna get the inv from

reef shell
#

Then no problem, i just reminded you

#

Lol

kindred epoch
#

is the bot private or public?

slate swan
#

.gg/python 💀

#

public

kindred epoch
#

lol

reef shell
#

lmaoooo

kindred epoch
#

"dumbest shit ive ever heard"

wicked atlas
reef shell
kindred epoch
#

manz literally said its privacy breach

slate swan
wicked atlas
#

You need to create an invite on a channel object

slate swan
#

thought so

reef shell
#

!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.

slate swan
#

NOTHING IS BEING BROKEN

#

im searching thru the tos ren

kindred epoch
#

bruh

#

lmao

reef shell
#

Nvm

wicked atlas
#

Hmm, I mean, it could be kinda mean if your bot is invited to a private server and it sends you an invite

reef shell
#

Lmao It's clear

hasty iron
#

it could also used for other things

slate swan
#

nothing...

hasty iron
#

what a smart look up

kindred epoch
#

👏

reef shell
#

Indeed

wicked atlas
# slate swan nothing...

I mean, you spelled inviting wrong, but I don't think its going to be written exactly in the TOs

#

Welp, I guess when people invite the bot they do consent for it to be creating invites since it's a permission

wicked atlas
#

Although would not suggest doing it. People don't like that sort of thing.

reef shell
#

He's gonna end up getting reported if his bot ever be used in public/private servers

#

Like this

slate swan
#

any way to access someones profile banner while using dpy before 2.0

hasty iron
#

no

#

you could call the raw api though

slate swan
#

ur chats wont load

#

Bruh

reef shell
#

?

hasty iron
#

what

slate swan
#

ur chats werent loading

slate swan
hasty iron
#

werent loading? what

slate swan
#

wifi problem

#

..

hasty iron
#

oh

slate swan
#

yea

reef shell
#

Lmao i thought it was like loading videos

hasty iron
#

well it showed up on my screen

quiet coral
#

Hello guys I wanna get into coding python discord bots but because discord.py is dead what would be the best alternative ?

wicked atlas
slate swan
#

@hasty iron @reef shell got it thank u guys

slate swan
#

much love

hasty iron
slate swan
#

🙏

quiet coral
wicked atlas
#

Not sure

#

Honestly some forks I would suggest over others, since they don't change it too much

slate swan
#

You've got the best implementation of slashes so far and the lib is really up-to-date unlike other libs in some parts

#

The syntax is identical to the one of dpy 2.0

quiet coral
slate swan
#

Yw

unkempt hamlet
#

hey, does anybody know how to search youtube instead of using urls with ffmpeg and youtube_dl? here's my code: ```py
@commands.command()
async def play(self,ctx,url):
ctx.voice_client.stop()
FFMPEG_OPTIONS = {'before_options': '-reconnect 1 -reconnect_streamed 1 -reconnect_delay_max 5', 'options': '-vn'}
YDL_OPTIONS = {'format':"bestaudio"}
vc = ctx.voice_client

    with youtube_dl.YoutubeDL(YDL_OPTIONS) as ydl:
        info = ydl.extract_info(url, download=False)
        url2 = info['formats'][0]['url']
        source = await discord.FFmpegOpusAudio.from_probe(url2, **FFMPEG_OPTIONS)
        vc.play(source)
        await ctx.send(f"Now Playing {url}")```
hasty iron
#

!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)
unkempt hamlet
#

oh right youtube hates music bots

hasty iron
#

it’s called copyright laws

#

you could use your own music and only ncs music

unkempt hamlet
#

lol

slate swan
#

Sending logs each 15 seconds shouldn't be API abusing right? I have events for whenever a Role is changed/added/deleted, when a member/user updates their profile and all the other events which are appended to a list making a list of embeds and with a task.loop I'm having it send using the embeds kwarg via a webhook in the logs channel

#

Shouldn't be too spammy right? pithink

hasty iron
#

yeah

#

i thought of saying to use a semaphore or a lock then at second thought, that wouldn’t work

wicked atlas
#

Webhooks have a ratelimit that I think is about 30 messages per 10 minutes per channel

#

Something close to that

slate swan
#

I think I've sent more than 30 messages in 10 minutes

kindred epoch
#

same

slate swan
hasty iron
#

nevermind it, i am dumb

#

but if you’re curious, its a asyncio.Lock

wicked atlas
#

Ok, just looked it up. It's like 30/minute

#

Or something

slate swan
#

Ah 30 messages/minute sounds good

#

Since I can send 10 embeds per message

#

That would mean 300 embeds per minute 😱

flat solstice
#

DMs to a member who has DMs closed falls under HTTP Exceptions right?py elif isinstance(error, discord.HTTPException): await ctx.send(embed=discord.Embed(title="Unknown HTTP Exception", description=f"Please report this in the support server.\n`{error.text}`", colour=self.bot.error_colour,))

median isle
#

whats the error here

vale pendant
#

I don't think you can put a number in the name when you are defining a command

#

so instead of _8ball, try _ball

flat solstice
#

it should accept it with a _8ball, now 8ball itself will probs produce a error

vale pendant
#

yes 8ball itself will produce a error but maybe _8ball might as well

hasty iron
#

it wont

vale pendant
#

but then again, we don't know the error

hasty iron
#

also killmode command seems kinda

#

uh

vale pendant
#

lmao

hasty iron
#

spammy?

vale pendant
#

definitely

flat solstice
# median isle

is it giving you an errors in the terminal when you run the bot?

slate swan
#
@bot.command(aliases=["mc", "members"])
async def membercount(ctx):
    guild = ctx.guild
    members = await ctx.guild.fetch_members().flatten()
    member_by_status = Counter(str(m.status) for m in guild.members)
    online = (f'Online: {member_by_status["online"]}\n'
              f'Idle: {member_by_status["idle"]}\n'
              f'Do Not Disturb: {member_by_status["dnd"]}')
    offline = (f'Offline: {member_by_status["offline"]}')
    count = sum(1 for people in members if people.bot)
    real = f"{members}-{count}"
    embed = discord.Embed(
        description=
        f"```Total Members: {ctx.guild.member_count}\nBots: {count}\nHumans: {eval(real)}\n{online}\n{offline}```",
        color=discord.Colour.from_rgb(114, 137, 218))
    await ctx.send(embed=embed)
``` explaintion on why this wont owrk
reef shell
#

use guild.members insted

#

in line 4

slate swan
#

Command raised an exception: AttributeError: 'Guild' object has no attribute 'get_members'

reef shell
#

my bad

vale pendant
#

did you mean len(guild.members) ?

slate swan
#

Command raised an exception: TypeError: 'list' object is not callable

vale pendant
#

what

reef shell
#

wait, why would you need that member var.

slate swan
#

Why my slash command dont work?

reef shell
#

is that a question?

slate swan
#

bro it just created more errors

reef shell
#

ok nvm use fetch_members then

#

but what errors did you get in the first place

slate swan
#

Why my slash command dont work?

median isle
#

i cant run the bot

flat solstice
#

so what error is it giving you in the terminal

reef shell
slate swan
reef shell
#

duh

#

wdym

#

tokens are meant to be kept secret

slate swan
#

I can regenerate it thats not problem slash is the problem

stark hearth
slate swan
#

okay

hardy yoke
#

my initial assumption is that you're expecting it to appear immediately but since it's a global slash command it'll take ~1hr

slate swan
stark hearth
#

!d discord.Intents

unkempt canyonBOT
#

class discord.Intents(**kwargs)```
Wraps up a Discord gateway intent flag.

Similar to [`Permissions`](https://discordpy.readthedocs.io/en/stable/api.html#discord.Permissions "discord.Permissions"), the properties provided are two way. You can set and retrieve individual bits using the properties as if they were regular bools.

To construct an object you can pass keyword arguments denoting the flags to enable or disable.

This is used to disable certain gateway features that are unnecessary to run your bot. To make use of this, it is passed to the `intents` keyword argument of [`Client`](https://discordpy.readthedocs.io/en/stable/api.html#discord.Client "discord.Client").

New in version 1.5...
stark hearth
#

did you try guild = guild.members ?

#

wait nm you did

#

hold on

#

try client.get_guild(GUILD ID) @slate swan

slate swan
# slate swan

I think /commands are only for professional bots like arcane and stuff and you leaked your token that's meant to be a secret that's your bots password

stark hearth
#

they realized lol

slate swan
slate swan
neat bridge
slate swan
stark hearth
midnight oyster
#

Are there any python libraries that support / commands?

hardy yoke
midnight oyster
#

Much appreciated

unkempt canyonBOT
slate swan
#

how can i make it so i dont have to mention a role i can just type the role name but it still works

dapper cobalt
dapper cobalt
#

!d discord.Role

unkempt canyonBOT
#

class discord.Role```
Represents a Discord role in a [`Guild`](https://discordpy.readthedocs.io/en/stable/api.html#discord.Guild "discord.Guild")...
slate swan
#

say whatt

#

Typehint??

dapper cobalt
#

Typehint means something:something.

#

For example:

async def rolename(ctx, role:discord.Role):
  print(role.name)
slate swan
#

oh i have tha

dapper cobalt
#

Then you already don't need to mention the role.

slate swan
#

@bot.command()
async def role(ctx, member:discord.Member,role:discord.Role):
await bot.fetch_ctx.guild.roles()
await member.add_roles(role)
embed = discord.Embed(description=f"{check} gave {role.name} to {member}",color=color)
await ctx.send(embed=embed)

#

its not gonna make me mention?

dapper cobalt
#

You don't need to, no.

#

What's fetch_ctx?

#

Remove the await bot.fetch_ctx.guild.roles() since it will just raise an error.

slate swan
#

yea ik i fixed it

slate swan
#

do you think i'll get terminated for having this watchinf thing in my status, even tho i'm using a google extension

dapper cobalt
slate swan
#

because like i know you could do the activities with a selfbot so i jsut wanna make sure i don't get terminated

midnight oyster
#

Anyone use discord-components? How do I make my buttons have like red and green color?

visual rivet
#

does anyone know how to make an arguement be abl to include spaces?
(reply if you respond)

midnight oyster
#

@visual rivet
async def command(self, ctx, *, arg):

#

!command all of this will be in arg

#

arg would be all of this will be in arg

visual rivet
#

oh ok thanks

slate swan
#

where is this located ? like can someone find me the link

#

please

vale pendant
#

?

slate swan
#

does anyone know how to do this

vale pendant
slate swan
#

oh thanks

vale pendant
#

mhm

slow epoch
vale pendant
slow epoch
#

not u

#

@slate swan

slate swan
#

yeh i was lmao

#

@slow epoch

slate swan
#

i didnt know how to put in in words but thats what i was finna ask

slate swan
vale pendant
crude crater
#
@client.command(aliases=["SERVERINFO", "Serverinfo", "Serverinformation", "SERVERINFORMATION", "serverinformation"])
async def serverinfo(ctx):
        embed = Embed(title="Server information",
                      colour=ctx.guild.owner.colour,
                      timestamp=datetime.utcnow())

        embed.set_thumbnail(url=ctx.guild.icon_url)


        fields = [("ID", ctx.guild.id, True),
                ("Owner", ctx.guild.owner, True),
                ("Region", ctx.guild.region, True),
                ("Created at", ctx.guild.created_at.strftime("%m/%d/%Y %H:%M:%S"), True),
                ("Members", len(ctx.guild.members), True),
                ("Humans", len(list(filter(lambda m: not m.bot, ctx.guild.members))), True),
                ("Bots", len(list(filter(lambda m: m.bot, ctx.guild.members))), True),
                ("Text channels", len(ctx.guild.text_channels), True),
                ("Voice channels", len(ctx.guild.voice_channels), True),
                ("Categories", len(ctx.guild.categories), True),
                ("Roles", len(ctx.guild.roles), True),
                ("\u200b", "\u200b", True)]

        for name, value, inline in fields:
            embed.add_field(name=name, value=value, inline=inline)

        await ctx.send(embed=embed)
slate swan
#

how do i make it orange

crude crater
slate swan
#

one sec ima show what i mean

crude crater
#

`` < 3 of these

slate swan
#

like that

crude crater
#

I don't know

slate swan
#

or like a certain color

#

@slate swan

crude crater
slate swan
#

thx

#
Object of type Invite is not JSON serializable
``` whats that mean
pliant raven
#

hello

#

im making a discord bot for my school server

#

and i need to be able to display lists in anmbed

#

im using replit

#

please ping me if you can help me

exotic patrol
pliant raven
#

ok

#

so will this seperate this line by line?

exotic patrol
pliant raven
#

or will this put it horizontally

exotic patrol
#

horizontal

pliant raven
#

oh ok

#

so can i just do this?
print(listname + "/n")

slate swan
#

pretty sure that works

drifting arrow
#

uhh

zenith flicker
#
print("\n".join(listname))
#

that will print everything in the list on separate lines

drifting arrow
#

What's a cool project I could make using a discord bot? 🤔

slate swan
drifting arrow
#

Lol

rugged tinsel
#

hey can anyone teach me how to make a kill command in discord.py?

drifting arrow
#

What do you mean by kill command?

rugged tinsel
#

like

#

if I do kill @testguy the bot will say @rugged tinsel killed @testguy

#

or something like that

drifting arrow
#

so like $kill @taggedperson
@Gnomeslayer killed @taggedperson?

rugged tinsel
#

yes

drifting arrow
#

Just get the mentions.

#

Create a new command called "kill" or whatever you want.
Then grab the mention of the author. and the person they mentioned

rugged tinsel
#

ahh ok

#

thanks

drifting arrow
#

No worries mate

#

No need for age here adrian

sick talon
drifting arrow
#

dont give him the answers! I get yelled at whenever I do it. stop it. @sick talon

rugged tinsel
#

why? is it againest the rules?

drifting arrow
#

idk probably. something something spoonfeeding etc.

rugged tinsel
#

oh

sick talon
#

didn't knew about it

drifting arrow
#

tbh i have nothing against it. Sometimes people need examples to learn

#

It's just all the whining and nagging. gets at ya.

#

Anyway

#

@rugged tinsel @sick talon this is what I wrote

@commands.command(help='[Pew Pew.]')
    @commands.is_owner()
    async def kill(self,ctx, member : discord.Member):
        if ctx.author.mention == member.mention:
            await ctx.send(f'{ctx.author.mention} has just killed himself.. for the 16th time..')
        else:
            await ctx.send(f'{ctx.author.mention} has killed {member.mention}. <Sigh> _Not again._')

took some creative liberties

#

Could even create a list of random remarks the bot will append to the end of the 'kill'

rugged tinsel
#

nice!

fleet oracle
#

help, how can i make when i can't find a user, send a message?

drifting arrow
sick talon
fleet oracle
drifting arrow
#

use a try/except?

fleet oracle
fleet oracle
drifting arrow
#

This is the error you'll get if you cant ban someone discord.ext.commands.errors.MemberNotFound: Member "@Oliveoil#9305#212" not found. so either yeet a try/except in there or search the actual discord for its members

fleet oracle
#

I do not talk a lot of english, sorry