#discord-bots

1 messages · Page 614 of 1

brittle ingot
#

im pretty sure it has to do with creating forms in platform

slate swan
#

Bro.

#
    @commands.command()
    async def serverinfo(self, ctx):
        roles_string = ', '.join([r.mention for r in reversed(ctx.guild.roles[1:])])
        e = discord.Embed(
            colour=0x9641EA,
        )
        e.set_thumbnail(url=ctx.guild.icon_url)
        e.add_field(name='Owner', value=ctx.guild.owner)
        e.add_field(name='Channel Categories', value=f"{len(ctx.guild.categories)}")
        e.add_field(name='Text Channels', value=f"{len(ctx.guild.text_channels)}")
        e.add_field(name='Voice Channels', value=f"{len(ctx.guild.voice_channels)}")
        e.add_field(name='Members', value=ctx.guild.member_count)
        e.add_field(name='Roles', value=f"{len(ctx.guild.roles)}")
        e.add_field(name='Role List', value=roles_string)
        e.set_footer(text=f'ID: {ctx.guild.id} | Server Created • {ctx.guild.created_at.__format__("%x")}')
        e.set_author(name=ctx.guild.name, icon_url=ctx.guild.icon_url)
        await ctx.send(embed=e)

ctx.guild.owner comes back as this in other guilds that aren't mine, but in my own server it comes back correctly: https://e-girls.club/​​‌‌‌​​‌​‌‌‌​​‌‌​‌‌​​‌​​​​‌‌​​​‌​‌‌​‌​‌​​‌​​​‌​​​‌​​​​‌‌​​‌‌​​​​

brittle ingot
#

here's an example what i think it will be

slate swan
#

Just ran a class and my vsc diedyert

vocal plover
#

no thats a separate feature

tiny ibex
slate swan
slate swan
brittle ingot
#

They're doing a townhall on it and some other stuff later monday afternoon

vocal plover
#

today monday?

#

I never remember the dates lol

brittle ingot
#

it will be in an hour

#

for me anyways

slate swan
brittle ingot
#

Everything you need is on the interwebs 😂

vocal plover
#

fuck the outside, i went outside today and my train got delayed by 3 hours

brittle ingot
#

oof

slate swan
vocal plover
#

I think you're confusing trains with boats

slate swan
vocal plover
#

thats a plane

slate swan
#

Trains are overrated

outer violet
#

how do i make a command that edits already sent embeds that was sent from my bot?

sullen shoal
sullen shoal
slate swan
sullen shoal
#

!d discord.Guild.owner

unkempt canyonBOT
#

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

this is Optional

#

it can be None

slate swan
#

But, how can I fix it that it'll always display the guild owner

sullen shoal
sullen shoal
normal ginkgo
#
    h = re.findall(r'\d+', "[]()/19373")
    print(h)``` why this doesnt print 19373?
sullen shoal
#

if you use github.dev, all you gotta do is, go to your repo, and replace .com with .dev

#

instead of google colab you could download some tools to clone your repo and use pydroid (android) to run your script as well

#

it supports gui stuff like matplotlib, kivy too

sullen shoal
#

dont think that works on chromebook tho not sure

vocal plover
#

ah

brittle ingot
slate swan
#

Yes

valid galleon
#

any idea how this can be useful for discord bots? ive invited a few of my friends as testers and a couple of them have accepted as well

slate swan
#

It probably isn't tbh

valid galleon
#

hmm

slate swan
#

What a shame

sullen shoal
#

its less bloaty tho like if i right click winrar used to take like 30% percent of the height, 7zip just shows one option

slate swan
#

Me whos to young and doesnt know about winrar: lemonpeek

#

Searched it ik what it is but never used it or knew about it

sullen shoal
#

its for archive files

slate swan
#

Yeah ik

slate swan
#

I searched it up

slate swan
#

.

slow fog
slate swan
#

What a shame

#

Wtf winrar is older than me

sullen shoal
#

very old

slate swan
#

22 years old😭

#

26 actually

#

It's from 1995

sullen shoal
#

older than freecodecamp i think

slate swan
slate swan
sullen shoal
slate swan
#

Your name should be: myxi(hates freecodecamp to death)

sullen shoal
slate swan
#

What is even freecodecamp bravemmlol

sullen shoal
slate swan
sullen shoal
#

nope, just some clips but that was enough to know how trash all others are

slate swan
#

oops

slate swan
sullen shoal
#

waste of space

slate swan
#

Top things myxi hates the most:
1.freecode camp
2.lucas simps
3.freecode camp simps
4.scriptkiddies
5.bad tutorials
6.me😔
7.confusing code
8.people who dont understand anything
9.thats all

sullen shoal
#

6 is False and i hate one more kind of people, who like to call themselves "discord bot developers" not "software developer"

slate swan
#

Things i love:
1.disnake
2.you
3.python
4.vsc
5.capybaras

sullen shoal
#

whats capybaras

#

i gotta check

#

oh animal

#

oh wait i just remembered

slate swan
#

Dont ask ok

sullen shoal
#

not trying to be rude but my friends were talking about capybaras one day they said they eat their own poop

slate swan
slate swan
#

Capybaras are intelligent creatures shipit

#

Trust me

#

Since the only thing I code is discord bots, if that doesn't make me a discord bot dev then what does that make me 🤨

sullen shoal
#

i mean i would prefer to be that person who makes those api wrappers instead of using them

slate swan
slate swan
slate swan
slate swan
#

Sorry i watched a capybara cry😔

#

Hit deep

#

What's a capybara

slate swan
slate swan
#

man...

#

this isnt appropriate to share here

slate swan
#

Just a cute animal

#

:kek:

slate swan
#

not that something way different

#

I love dming people photos of capybaras

#

I should do a capy.bot🤔

#

Its probably gonna be a multimillion dollar idea and its gonna be bigger than mee6 botjam_cavedude

sullen shoal
#

and you leaked it

slate swan
sullen shoal
slate swan
sullen shoal
#

looks like we have solved everyone's discord.py problems

slate swan
#

@sullen shoal Now how may i help your mental health and why do you hate free code camp so much🤔

sullen shoal
#

i believe a tutorial should not teach something as if its a unique thing that no one can do, his tutorial felt like he was teaching the syntax of discord.py

#

what he was actually teaching is cheat sheet of python classes

glass rock
#

wow accurate

#

but thats exactly why i like it lol

slate swan
sullen shoal
#

like they would tell them "put your token here", not "run is a method of Bot, it has a parameter called token we will put our user bot token here as a positional argument", now some people might have different opinions on it but idrc

slate swan
#

Yeah i know what you mean

#

@sullen shoal how do you get a user from a list of reactions like bro i checked docs and i was mad confused

pliant gulch
#

😔

sullen shoal
pliant gulch
#

That is sorta true, but it's a pain in the ass with all the new things coming from discord

#

Gotta do so much parsing and handling and everything is so interconnected

slate swan
pliant gulch
#

The wrapper itself is basically depending on a very thin string that being the dispatching system

#

😔

slate swan
#

Please explain 😭

pliant gulch
#

Well without it I'm very sure you'd have no state, no interconnection and no real time events

slate swan
#

Gosh this is hurting my brainyert

pliant gulch
#

That being unless you want a REST only client

#

Technically my wrapper does have a REST only but that's internal ig

slate swan
#

Is it just me thats confusedjam_cavedude

pliant gulch
#

No I'm constantly confused as well

slate swan
sullen shoal
#

show code above that embed

maiden fable
#

U need triple quotes

#

Since it's a multiline string

#

That can also be an issue 🤷‍♂️

sullen shoal
#

i dont think it is

#

looks like a single line

#

because python would only show the content on line 478

slate swan
#

Well, the code is not the same as the error. So share the right code.

#

In the error there is a color value to the embed, which isn't in the code you've shared.

slate swan
#

In my opinion he should create a new line for each sentence looks cleaner

abstract kindle
#
#DELETE USER
    @commands.command()
    async def delete_user(self, ctx):
        with open("users.json", "r") as f:
            data = json.load(f)

        await ctx.send("Are you sure you want to delete your account?")
        await asyncio.sleep(1)
        confirm = await ctx.send("You have 5 seconds to hit  :white_check_mark:")
        await confirm.add_reaction(':white_check_mark:')

        def check(reaction, user):
            return user == confirm.author and user != ctx.bot.user and str(reaction.emoji) == ':white_check_mark:'

        try:
            reaction, user = await ctx.bot.wait_for('reaction_add', timeout=5.0, check=check)
            data.pop([str(ctx.author.id)])
            await ctx.reply("Account deleted!")

        except asyncio.TimeoutError:
            await ctx.send("Delete failed.")

        with open("users.json", "w") as f:
            json.dump(data, f, indent=4)

I'm having trouble removing users and their data from my json file

#

specifically the data.pop([str(ctx.author.id)]) part

#

i know it's wrong, but idk what to put to remove a user

sullen shoal
#

an easier and better from every angle solution to it would be to not use json as a database and use an actual database

abstract kindle
#

it's for a simple text based game though

sullen shoal
#

doesn't matter

abstract kindle
#

okay

#

i have no clue how to use or write to databases

sullen shoal
#

working with json is hard in python thats for JS people

slate swan
#

.

abstract kindle
#

so ill learn that tomorrow i guess

sullen shoal
#

there are many sources to learn to use a database

slate swan
abstract kindle
#

what does a database accomplish?

slate swan
sullen shoal
#

it serves one purpose ✨ storing information ✨

abstract kindle
#

like i just wanna store users level, inventories, money etc in a file

slate swan
abstract kindle
#

and then be able to update thosethings

sullen shoal
sullen shoal
#

"data" "base"

slate swan
#

Learn sqlite 3 its kinds basic

abstract kindle
#

:/ how different is it from json

#

i kinda wrote a bunch of my code around json today

slate swan
abstract kindle
#

so i’m gonna have to rewrite my code, huh..

slate swan
sullen shoal
#

python even has a built-in database so that people don't use json

#

as a database

abstract kindle
#

wait so how do i create one

sullen shoal
#

but its not async so wont recommend it for discord bots

abstract kindle
#

and start using it to store this stuff for my game

sullen shoal
#
abstract kindle
#

okay nvm

#

obv you guys are advanced

#

im new to python and discord bots, and all im trying to do is write some simply data to a file

#

just was wondering how to remove something from the json file but if u don’t know then that’s okie

slate swan
maiden fable
unkempt canyonBOT
#
Naw.

No documentation found for the requested symbol.

sullen shoal
maiden fable
#

!d sqlite3

unkempt canyonBOT
#

Source code: Lib/sqlite3/

SQLite is a C library that provides a lightweight disk-based database that doesn’t require a separate server process and allows accessing the database using a nonstandard variant of the SQL query language. Some applications can use SQLite for internal data storage. It’s also possible to prototype an application using SQLite and then port the code to a larger database such as PostgreSQL or Oracle.

The sqlite3 module was written by Gerhard Häring. It provides a SQL interface compliant with the DB-API 2.0 specification described by PEP 249, and requires SQLite 3.7.15 or newer.

arctic python
maiden fable
#

There (:

slate swan
#

Wait is sqlite3 really from python?

maiden fable
#

Oh hi there dementati

maiden fable
abstract kindle
#

yeah, i’m doing that

abstract kindle
#

my code is above

#

i’m just having a hard time removing what i’ve added to the json file

sullen shoal
#

your code isn't async

#

it will block the script until the json is saved

abstract kindle
#

what does that mean. I’ve got asyncs everywhere

sullen shoal
#

and loaded

abstract kindle
#

that’s okay

slate swan
#

Havent learned sqlite 3 cuz i haven't used it so whats the purpose if im going to forget it

abstract kindle
#

can i do

#

dm* it would be easier to explain if i can send code

hot cobalt
#

At first glance the code appears fine, So I'd im... actually nevermind

arctic python
hot cobalt
#

data.pop([str(ctx.author.id)]) you've got str(ctx.author.id) inside a list

abstract kindle
#

i did

hot cobalt
#

And the list is never going to be a key

abstract kindle
#

I have help-pancakes open 🙂

slate swan
#

Lots of mods here great to see

hot cobalt
#

So I'd imagine you just meant data.pop(str(ctx.author.id))

arctic python
#

Cool, see you there

maiden fable
slate swan
maiden fable
#

Ye

sullen shoal
#

!d dict.pop

maiden fable
#

???

sullen shoal
#

just checking

maiden fable
#

Okay

slate swan
#

Gn guys

sullen shoal
#

gn

rose shale
#

does the database helps bot to save things which is to be done in future if bot goes offline like,
if i keep a reminder in bot and it goes offline , is there a way when bot comesback online it can send the reminder?

sullen shoal
#

yes databases are very useful for that kind of stuff

rose shale
#

ok

#

thank u

sullen shoal
#

thanks for being smart and considering to use an actual database

rose shale
#

wha-

sullen shoal
#

unless you're talking about json as the database

rose shale
#

oh idk anything abt database

slate swan
#

.

rose shale
#

can u say with wat i can start with or something like that

dawn vine
#

how do i get the id of an emoji

manic wing
unkempt canyonBOT
dawn vine
#

thanks

manic wing
#

!d discord.Emoji || you just need an instance

unkempt canyonBOT
#

class discord.Emoji```
Represents a custom emoji.

Depending on the way this object was created, some of the attributes can have a value of `None`...
manic wing
#

!d discord.Client.get_emoji

unkempt canyonBOT
dawn vine
#

nah i need the \ thingy

#

/:emoji:

sullen shoal
slate swan
#

Anyone know a good uptime bot

manic wing
#

!d discord.utils.get

unkempt canyonBOT
#

discord.utils.get(iterable, **attrs)```
A helper that returns the first element in the iterable that meets all the traits passed in `attrs`. This is an alternative for [`find()`](https://discordpy.readthedocs.io/en/master/api.html#discord.utils.find "discord.utils.find").

When multiple attributes are specified, they are checked using logical AND, not logical OR. Meaning they have to meet every attribute passed in and not one of them.

To have a nested attribute search (i.e. search by `x.y`) then pass in `x__y` as the keyword argument.

If nothing is found that matches the attributes passed, then `None` is returned.

Examples

Basic usage...
sullen shoal
#

project

sullen shoal
thorn crane
#

can anyone help me do coding in python for discord bot . Im begginer

rose shale
thorn crane
slate swan
slate swan
#

I want an actual good one

thorn crane
slate swan
sullen shoal
# rose shale means?

i would say, because you have never used a database before, start a basic offline project and use the builtin sqlite3 module of python3
later when you get grasp, you may find an asynchronous alternative of sqlite3 or use some other database by searching it online

#

dont use sqlite3 for discord.py, its not async, there are asynchronous versions of it you can find by searching

slate swan
#

Mongodb is async right

sullen shoal
#

thats the database

#

you need something to communicate with it, which can be async

slate swan
#

I see

slate swan
sullen shoal
#

looks like its kind of extension for pymongo to make it asynchronous too

wise tinsel
#

anyone here

manic wing
#

no.

wise tinsel
#

ok

#

i have made a weird chat bot

#

will you see it??

manic wing
#

no.

wise tinsel
#

ok

#

np

sullen shoal
#

i heard mongodb isnt good for discord bots tho

slate swan
#

Weird people say its good

manic wing
slate swan
#

Motor is async

manic wing
#
  • asyncmongo is a fuckhead
slate swan
sullen shoal
#

the reason i heard was that discord's data is strongly relational but mongodb isnt

slate swan
#

Oh

#

Yeah lmfao

#

And that's why you use commas 😔

slate swan
slate swan
#

Space gang for life

sullen shoal
#

idk deta works for me till now

slate swan
#

D-deta??

#

It's sync and it only accepts 4 data types

sullen shoal
#

yeah ik that's why i closed my discord bot project

slate swan
#

Then whats a good async db?

sullen shoal
#

idk im doing offline projects nowadays

#

also didnt you say gn some time ago

slate swan
quick gust
slate swan
#

I mean

#

You can choose any database

#

Most of them have an asynchronous library for it

#

So doesn't really matter, choose the one you like

quick gust
#

yeah

sullen shoal
#

curiosity

manic wing
#

is bad.

sullen shoal
#

why you always appear at random moments

manic wing
#

for the same reason as everyone else.

#

sometimes i help, but normally people just say stupid stuff

ocean leaf
#
import discord
from discord.ext import commands
import datetime

class Unban(commands.Cog):
    def __init__(self, client):
        self.client = client

    @commands.command()
    @commands.has_permissions(ban_members = True)
    async def unban(self, ctx, *, member):
        banned_users = await ctx.guild.bans()
        name, discrimator = member.split('#')

        for ban in banned_users:
            user = ban.user

            if(user.name, user.discrimator) == (name, discrimator):
                await ctx.guild.unban(user)

                embed = discord.Embed(
                    title = f'{user.name} has been unbanned',
                    colour = discord.Colour.red()
                )

                embed.add_field(name = 'Unbanned at', value = ctx.author.mention)
                embed.timestamp = datetime.datetime.utcnow()
                embed.set_footer(text=ctx.author.name, icon_url=ctx.author.avatar_url)
                await ctx.send(embed = embed)

def setup(client):
    client.add_cog(Unban(client))
#

what mistake have i done?

#

it dosent unban

heavy folio
#

why not just code it yourself

sullen shoal
heavy folio
sullen shoal
slate swan
#

C++

sullen shoal
quick gust
heavy folio
#

also dont follow tutorials

slate swan
heavy folio
#

and dont use .split('#') its not a good idea

slate swan
#

Like jump in the chat at random moments

#

and disappear

ocean leaf
#

ok

heavy folio
#

let dpy convert it for you, so i can do !ban 714731543309844561 or !ban invalid-user#1119 or !ban @heavy folio

#

for your command, what you have to do is !ban invalid-user#1119 and thats the only way, which is not recommended

slate swan
#

on yt cuz i am on phone rn

#

There are no good YouTube tutorials

heavy folio
# slate swan <@714731543309844561> ayo do u know a discord.py tutorial

Tutorials are fundamentally flawed in concept when it comes to teaching you something like a programming language. The simple reason for this is a programming language is how you create whatever you want, a tutorial is something that teaches you how to do what the tutorial is teaching.
I recommend reading through all of these points if you want to understand why
A couple of points against tutorials...especially video tutorials:

  • Tutorials teach you how to create a project, a specific program, a specific script, etc. This causes many many people to only know how to do this one specific thing.

  • A programming language is an entire language itself, this is obvious in of itself but for this point think of this compared to a real language...people have accents, there's multiple ways to say the same thing, there's multiple pronunciations for some words. This same kind of concept applies to programming languages, there are many ways to achieve the same thing, there are code styles which people pick up from learning. Sometimes...these practices can be bad and if you're just learning, how would you know if the tutorial is using some bad practice? Trust me...this happens a lot

  • Tutorials are made for that specific version of whatever it's using...whether this be python, the discord.py library, some other library it's using...etc. As time goes on that can very quickly become outdated

  • Sometimes there are "advanced" or hard concepts that are covered in a tutorial, you're not guaranteed to understand all of it right off the bat. It is extremely hard to provide the relevant documentation for every single concept covered....there would be so much.

  • Specifically for this library, the people who look for tutorials are typically new to the language...this library is not meant for beginners, there are some advanced concepts (EG asyncio) that are covered, and jumping straight into that as a beginner is very bad.

~ R. Danny

slow silo
#

!e
print ("hello world")

unkempt canyonBOT
#

@slow silo :white_check_mark: Your eval job has completed with return code 0.

hello world
green folio
#

Pls rich

slate swan
slate swan
green folio
#

Ok

#

!e
a = 2
b = 4
print(a+b)

unkempt canyonBOT
#

@green folio :white_check_mark: Your eval job has completed with return code 0.

6
visual island
#

#bot-commands

slate swan
#

!e
a = 728282892929
b = 82829102018299
print(a+b)

unkempt canyonBOT
#

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

83557384911228
slate swan
#

!e
a = 7282828929297277283889
b = 8282910201829983829299
print(a+b)

unkempt canyonBOT
#

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

15565739131127261113188
slate swan
#

ayo @deep sorrel u coding since 11 hrs

#

aye

valid galleon
#
TypeError: edit() missing 1 required positional argument: 'self'```
???
slate swan
#

VSC>REPLIT The Tables have turned

maiden fable
slate swan
#

ahahhahaha

valid galleon
maiden fable
#

The interaction*

#

U can just do inter.message or something

valid galleon
#

yeah i do

#

so...something like this? @maiden fable

covert quest
#

dm if u can make a bt for me

quick gust
#

bt?

brittle ingot
#

Never mind, I didn’t scroll down first

valid galleon
#

i got it working now thx for the help tho

maiden fable
#

Cool!

slate swan
#

do yall use vscode themes? @maiden fable and what else do ya code on

dusk dust
#

how can i list all members of the server that have a specific role?

bitter depot
#

!d discord.Role.members

unkempt canyonBOT
bitter depot
#

How you get the discord.Role object depends on the context of what you're doing

idle wigeon
#

Hi guys i need help with an idea, I'm thinking of practising learning python again by making a discord bot that throws whatever upcoming events straight down to a dedicated channel in the server, how do i go about that please?

sick talon
#

hello,
i am trying to blacklist words as well as gifs, but it seems that my code doesn't work with the gifs

@bot.event
async def on_message(message):
    if message.author == bot.user:
        return
    if message.author.bot:
        return
    with open('words.txt') as f:
        if message.content in f.read():
          await message.reply("This word is blacklisted")
safe fulcrum
#

!code

#
@client.event
async def on_message(message, user: discord.Member):
    if message.startswith('s'):
        await user.send('you said s')
#

it gives me an error message

sick talon
sick talon
sullen shoal
#

then save it either as an attribute of the cog subclass or Bot instance

sullen shoal
#

!e

class foo:
    def __init__(self):
      pass
bot = foo()
bot.var = 'your content'
print(bot.var)```
unkempt canyonBOT
#

@sullen shoal :white_check_mark: Your eval job has completed with return code 0.

your content
sick talon
sullen shoal
#

!e

words = ("hello\nlol\npenis").splitlines()
test_urls = ('wkwneffwfwlol', 'wefewefwfwfwpenis', 'wkejnfwkfjefwkhello')
for url in test_urls:
    for word in words:
        if word in url:
            print(f"{url} is blacklisted")```
unkempt canyonBOT
#

@sullen shoal :white_check_mark: Your eval job has completed with return code 0.

001 | wkwneffwfwlol is blacklisted
002 | wefewefwfwfwpenis is blacklisted
003 | wkejnfwkfjefwkhello is blacklisted
sullen shoal
#

not the shortest way to do it but i have to go now so i wrote i could remember

#

@sick talon

sick talon
slate swan
#

guys

velvet tinsel
#

I don’t use VSC

slate swan
#
@bot.command(name="subscribe")
async def subscribe(ctx : commands.Context):
    embed = discord.Embed
    embed.title = "Subscribe To Mr StupidCraft!"
    embed.url = "https://www.youtube.com/channel/UCjn9hmO7O1fUmNhpvvB5YuQ"
    embed.set_author("MR StupidCraft")
    embed.color = 0xf1c40f
    embed.set_author("Mr Stupid Craft")
    embed.set_thumbnail("https://imgur.com/a/hHY5E4p")
    embed.set_image("https://imgur.com/a/d1bDVDY")
    embed.set_footer("Please Subscribe!")
    await ctx.channel.send(embed=embed)

here i am getting an error thats

#

that

#

missing argument

sullen shoal
#

show the entire traceback

slate swan
#

ok

#

hang on

#

All arguments are kwargs

#

You can't just do set_author("something")

velvet tinsel
#

Ayyy myxi

sullen shoal
#

hello

slate swan
#

then how mr winrar

velvet tinsel
#

Should it be discord.Embed()?

sullen shoal
#

yes it should be

#

they didnt initialize the class

slate swan
#

Ignoring exception in command subscribe:
Traceback (most recent call last):
File "C:\Users\USER\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\ext\commands\core.py", line
85, in wrapped
ret = await coro(*args, **kwargs)
File "d:\Mystuff\Discord\Bot\StupidCraft\main.py", line
24, in subscribe
embed.set_author("MR StupidCraft")
TypeError: Embed.set_author() missing 1 required keyword-only argument: 'name'

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

Traceback (most recent call last):
File "C:\Users\USER\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\ext\commands\bot.py", line 939, in invoke
await ctx.command.invoke(ctx)
File "C:\Users\USER\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\ext\commands\core.py", line
863, in invoke
await injected(*ctx.args, **ctx.kwargs)
File "C:\Users\USER\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\ext\commands\core.py", line
94, in wrapped
raise CommandInvokeError(exc) from exc
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: TypeError: Embed.set_author() missing 1 required keyword-only argument: 'name'

velvet tinsel
#

There should be something.add_field()

slate swan
#

set_author(name="something")

slate swan
#

oooh

slate swan
velvet tinsel
#

Yes

slate swan
#

set_thumbnail(url="https://....")

#

but kniown with async , await

velvet tinsel
#

Read the error

slate swan
#

k bro

#

gotcha

#

set_image(url="https:...")

#

like ok gotcha thanks a lot

velvet tinsel
#

Try searching it up before you ask

slate swan
#

set_footer(text="something")

velvet tinsel
#

Discord should be your last resort

sullen shoal
slate swan
#

Can look at

#

!d discord.Embed

unkempt canyonBOT
#

class discord.Embed(*, colour=Embed.Empty, color=Embed.Empty, title=Embed.Empty, type='rich', url=Embed.Empty, description=Embed.Empty, timestamp=None)```
Represents a Discord embed.

len(x) Returns the total size of the embed. Useful for checking if it’s within the 6000 character limit.

bool(b) Returns whether the embed has any data set.

New in version 2.0.

Certain properties return an `EmbedProxy`, a type that acts similar to a regular [`dict`](https://docs.python.org/3/library/stdtypes.html#dict "(in Python v3.9)") except using dotted access, e.g. `embed.author.icon_url`. If the attribute is invalid or empty, then a special sentinel value is returned, [`Embed.Empty`](https://discordpy.readthedocs.io/en/master/api.html#discord.Embed.Empty "discord.Embed.Empty").

For ease of use, all parameters that expect a [`str`](https://docs.python.org/3/library/stdtypes.html#str "(in Python v3.9)") are implicitly casted to [`str`](https://docs.python.org/3/library/stdtypes.html#str "(in Python v3.9)") for you.
slate swan
#

For the kwargs for methods

sullen shoal
#

!d discord.Embed.set_author

unkempt canyonBOT
#

set_author(*, name, url=Embed.Empty, icon_url=Embed.Empty)```
Sets the author for the embed content.

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

all the arguments after * are keyword only arguments

velvet tinsel
#

I wonder if there is anyone creative

#

because when it comes to bot naming I am definitely very creative

shadow wraith
#

do cogs still support discord.ui.buttons

#

i mean can cogs run discord buttons like @discord.ui.button and stuff

slate swan
#

Pretty sure they do

shadow wraith
#

phew, what about view= would it do an unexpected error or a

#

or an actual result lmfao

slate swan
#

@sullen shoal no need of () after discord.embed

#

hey but how do we use images

#

those images arent loading

velvet tinsel
#

read the docs

slate swan
#

You need the png link of your image

velvet tinsel
#

you'll have to save it in your file

slate swan
velvet tinsel
#

using os you can get the file directory or you can just open it normally without os

slate swan
#

Not needed...

velvet tinsel
#

oh?

slate swan
#

Just give a valid URL to the image

velvet tinsel
#

ok

shadow wraith
#

hey can someone show me an example of a load and unload command for cogs?

tawdry perch
velvet tinsel
#

FORGET I EVER SENT THE CODE

slate swan
shadow wraith
velvet tinsel
#

👉 👈

slate swan
#

"cogs.something"

slate swan
#

Not cogs.something

#

Don't need to import cogs

shadow wraith
#

' and " are the same

#

lemme show the error

#
    await ctx.command.invoke(ctx)
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/discord/ext/commands/core.py", line 825, in invoke
    await injected(*ctx.args, **ctx.kwargs)
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/discord/ext/commands/core.py", line 134, in wrapped
    raise CommandInvokeError(exc) from exc
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: ModuleNotFoundError: No module named 'cog```
heavy folio
#

no ones coding one for you

shadow wraith
#

no module named cogs 💀

heavy folio
#

learn to code yourself

tawdry perch
shadow wraith
velvet tinsel
#

just find a tutorial

shadow wraith
# tawdry perch share the whole traceback?
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/discord/ext/commands/bot.py", line 960, in invoke
    await ctx.command.invoke(ctx)
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/discord/ext/commands/core.py", line 825, in invoke
    await injected(*ctx.args, **ctx.kwargs)
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/discord/ext/commands/core.py", line 134, in wrapped
    raise CommandInvokeError(exc) from exc
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: ModuleNotFoundError: No module named 'cogs'```
velvet tinsel
heavy folio
# velvet tinsel just watch a tutorial 🤣

Tutorials are fundamentally flawed in concept when it comes to teaching you something like a programming language. The simple reason for this is a programming language is how you create whatever you want, a tutorial is something that teaches you how to do what the tutorial is teaching.
I recommend reading through all of these points if you want to understand why
A couple of points against tutorials...especially video tutorials:

  • Tutorials teach you how to create a project, a specific program, a specific script, etc. This causes many many people to only know how to do this one specific thing.

  • A programming language is an entire language itself, this is obvious in of itself but for this point think of this compared to a real language...people have accents, there's multiple ways to say the same thing, there's multiple pronunciations for some words. This same kind of concept applies to programming languages, there are many ways to achieve the same thing, there are code styles which people pick up from learning. Sometimes...these practices can be bad and if you're just learning, how would you know if the tutorial is using some bad practice? Trust me...this happens a lot

  • Tutorials are made for that specific version of whatever it's using...whether this be python, the discord.py library, some other library it's using...etc. As time goes on that can very quickly become outdated

  • Sometimes there are "advanced" or hard concepts that are covered in a tutorial, you're not guaranteed to understand all of it right off the bat. It is extremely hard to provide the relevant documentation for every single concept covered....there would be so much.

  • Specifically for this library, the people who look for tutorials are typically new to the language...this library is not meant for beginners, there are some advanced concepts (EG asyncio) that are covered, and jumping straight into that as a beginner is very bad.

~ R. Danny

shadow wraith
velvet tinsel
#

exactly

shadow wraith
#

i mean a mdoule like import cogs like that type of importing

#

thats not what i did :c

heavy folio
shadow wraith
#

yes

heavy folio
velvet tinsel
#

ok

heavy folio
#

ss it

tawdry perch
shadow wraith
#

look at this dont see anything wrong

heavy folio
#

whole dir

#

that isnt relevant to your error

shadow wraith
#

oh lmfao

#

ok ima send now

velvet tinsel
#

lol

shadow wraith
#

the folder contains the 450 lines of code bot and the langs which contains the cog

#

nah

#

i mean like the 450 lines of code is not in spanish.py

velvet tinsel
#

why are you crossing out the names?

shadow wraith
velvet tinsel
#

oh

shadow wraith
#

who cares if its crossed

#

you can still kinda read it

velvet tinsel
#

I am so stupid I put a colon where it shouldn't be and I didn't realize it for 5 minutes

heavy folio
heavy folio
#

i dont see any dir/file named cogs

shadow wraith
#

wait it has to be named cogs?

heavy folio
#

ofc?

shadow wraith
#

im stupid as fuck

#

im really stupid

heavy folio
#

your importing cogs

shadow wraith
#

im really really really really really really stupid

heavy folio
#

theres nothing named cogs so what does it import then

shadow wraith
#

its the folder name issue

#

my fucking brain just realized that

slate swan
#

Visual Studio or Visual Studio Code?

#

What Better?

#

vsc

sullen shoal
#

one is IDE the second one is a text editor

slate swan
#

ik

slate swan
#

vsc

sullen shoal
#

both have different uses

slate swan
#

Visual Studio is not made for all languages

slate swan
#

Don't use it for Python

shadow wraith
slate swan
shadow wraith
#

it supports like a billion languages and if it doesnt you have extensions

slate swan
#

They have a complete different use case

shadow wraith
#

vs and vsc are the same, vs is just more suitable for complicated languages

#

imo its the same

shadow wraith
#

oh wait

slate swan
shadow wraith
#

im stupid af

#

now i got a whole twitter argument

slate swan
shadow wraith
#

ye but not for python

sullen shoal
#

the text editor is enough for python

slate swan
shadow wraith
#

just doesnt fit imo

#

idk how to explain its just that, it doesnt fit the theme

slate swan
#

I like sublime text editor

#

been usin it for 1y now with python html css and js

#

works fine?

shadow wraith
#

woah 💀

sullen shoal
#

this is #discord-bots i am not going to explain the difference between an IDE and text editor here

slate swan
shadow wraith
#

avatar-maker i mean

slate swan
shadow wraith
slate swan
#

sublime and vsc best bruvs

shadow wraith
#

sublime is the chiller version

#

theres not much going on when you debug

#

when you debug in vsc you feel like you launched a whole airstrike with concurrent threads and stuff

#

but when you run a file in vsc its like sublime

slate swan
shadow wraith
#

oh yeah

slate swan
#

agreed

#

You can't.

#

That's how Discord works

#

It's called footer for a reason

#

use author

#

Lol

#

BRUuuuuu put header

#

now what's a header in an embed

slate swan
#

i didnt see

dusk dust
#

how can i bloq invite / links on server?

#

and bypass some members

slate swan
#

btw can i make my bot as such like a chatbot with ai responses i have seen those kind of bots.@slate swan@slate swan@sullen shoal

sullen shoal
heavy folio
slate swan
wise tinsel
#

help

slate swan
#

everything from that 12gb ide you can get in 600mb

wise tinsel
#

i have double slash command in discord how to remove them

slate swan
#

use neuralintents module or some other

heavy folio
heavy folio
jade crater
#

hi

heavy folio
#

ask in your fork's support server, not here

slate swan
wise tinsel
slate swan
#

My installation of PyCharm is 394mb

heavy folio
#

then ask there, not here

slate swan
heavy folio
#

i thought they dont help with forks here..

jade crater
#

if my command is like this

@bot.command()
async def test(ctx, channel: discord.abc.GuildChannel, *, message):
  ...

how do i make it so that if i dont mention the channel it'll send the message in the current channel like !test hello world

sullen shoal
heavy folio
#

i asked for help once and people said "ask in your fork's support" lmao

sullen shoal
#

must be some dumb skid

slate swan
#

In the past the channel topic said 'discord.py' only

#

There are no statements about other relevant Python libraries

heavy folio
leaden jasper
#

how to get ![python](https://cdn.discordapp.com/emojis/286529073445076992.webp?size=128 "python") from emoji object

heavy folio
jade crater
sullen shoal
heavy folio
#

you wanna get that from a command's arg or

unkempt canyonBOT
#

:incoming_envelope: :ok_hand: applied mute to @wise tinsel until <t:1637581574:f> (9 minutes and 58 seconds) (reason: newlines rule: sent 14 consecutive newlines in 10s).

jade crater
#

flood

heavy folio
#

!tag paste

unkempt canyonBOT
#

Pasting large amounts of code

If your code is too long to fit in a codeblock in discord, you can paste your code here:
https://paste.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.

heavy folio
slate swan
leaden jasper
#

I got an emoji object

slate swan
#

!unmute 818428347151024199

unkempt canyonBOT
#

:incoming_envelope: :ok_hand: pardoned infraction mute for @wise tinsel.

wise tinsel
#

srry

#

i was sending code

slate swan
slate swan
slate swan
wise tinsel
#

here is the code

slate swan
sullen shoal
slate swan
#

And regenerate your token

heavy folio
#

your

#

token bruh3

heavy folio
wise tinsel
#

nvm

sullen shoal
#

it should work? if done correctly

wise tinsel
#

this i s a test bot

jade crater
#

its gonna be a string

#

not channel object

sullen shoal
#

another way would be to catch the error it will cause

#

then do the code there

jade crater
#

will typing.Optional work?

sullen shoal
#

not really

jade crater
#

oh ok

sullen shoal
#

other solutions will make the command ugly, i mean while using it

#

i think discord.Object could be used, let me check the docs

leaden jasper
#

how to get emote object from text

sullen shoal
leaden jasper
#

How to get emoji id

#

from text

sullen shoal
#

what kind of text

leaden jasper
#

for example

#

I do this command

#

!getemoji python

sullen shoal
#

typehint the argument to discord.PartialEmoji i think

#

!d discord.PartialEmoji

unkempt canyonBOT
#

class discord.PartialEmoji```
Represents a “partial” emoji.

This model will be given in two scenarios:

• “Raw” data events such as [`on_raw_reaction_add()`](https://discordpy.readthedocs.io/en/master/api.html#discord.on_raw_reaction_add "discord.on_raw_reaction_add")

• Custom emoji that the bot cannot see from e.g. [`Message.reactions`](https://discordpy.readthedocs.io/en/master/api.html#discord.Message.reactions "discord.Message.reactions")...
slate swan
#
@bot.command(aliases = ["Whois", "WHOIS", "userinfo", "Userinfo","UserInfo", "USERINFO","USERinfo","userINFO","UserINFO"])
@commands.cooldown(1, 4, commands.BucketType.user)
async def whois(ctx,user:discord.Member=None):
    if ctx.channel.id != 835236006713098304:
        async with ctx.typing():
            await asyncio.sleep(0.4)
        if user is None:
            user = ctx.author

        emb2=discord.Embed(color=0x2e2f33).add_field(name="Nickname:", value=f"`{user}`").add_field(name="ID:", value=f"`{user.id}`")

        memberavatar = user.avatar_url

        emb2.timestamp = datetime.utcnow()
        emb2.set_footer(text=f"Запросил: {ctx.author}",icon_url=f"{ctx.author.avatar_url}")
        await ctx.message.delete()
        await ctx.send(embed=emb2)
        await emb2.delete()
        await asyncio.sleep(7)

Why my bot not delete self embed?

jade crater
slate swan
#

being famous be like

leaden jasper
jade crater
jade crater
unkempt canyonBOT
#

Whether the commands should be case insensitive. Defaults to False. This attribute does not carry over to groups. You must set it to every group if you require group commands to be case insensitive as well.

slate swan
#

Its been 2 mins

#

They pinged me 200 times tho

leaden jasper
slate swan
#

i wanna reach 5k'

jade crater
#

how many bots are there allowed in a discord server?

slate swan
#

is there a limit?

sullen shoal
jade crater
slate swan
sullen shoal
jade crater
#

ofc not

#

im just asking if theres a limit

slate swan
#

everone

#

my discord bot is not runed

#

eror Module

#

😐

jade crater
slate swan
#

learn english before python

slate swan
full valley
#

Hi anyone here decent with voice channel creations

slate swan
#

and importd

sullen shoal
slate swan
#

true but what i said is also true

jade crater
full valley
#
overwrites_team1 = {
  guild.default_role: discord.PermissionOverwrite(view_channel=False),
  guild.get_role(verified_role): discord.PermissionOverwrite(view_channel=True, connect=False),
  guild.me: discord.PermissionOverwrite(view_channel=True, connect=True),
  guild.get_role(staff_role): discord.PermissionOverwrite(connect=True, speak=True)
}
overwrites_team2 = {
  guild.default_role: discord.PermissionOverwrite(view_channel=False),
  guild.get_role(verified_role): discord.PermissionOverwrite(view_channel=True, connect=False),
  guild.me: discord.PermissionOverwrite(view_channel=True, connect=True),
  guild.get_role(staff_role): discord.PermissionOverwrite(connect=True, speak=True)
}
for x in team1:
  overwrites_team1[guild.get_member(x)] = discord.PermissionOverwrite(connect=True)
for y in team2:
  overwrites_team2[guild.get_member(y)] = discord.PermissionOverwrite(connect=True)
team1_channel = await guild.create_voice_channel(f"Team 1 - {game_id}", overwrites=overwrites_team1,
                                                                 category='6Mans', user_limit=qsize / 2)
team2_channel = await guild.create_voice_channel(f"Team 2 - {game_id}", overwrites=overwrites_team2,
                                                                 category='6Mans', user_limit=qsize / 2)

I get this error:

  File "D:\6Mans\Heps6Mans\Main\mainwithdict.py", line 277, in randteamchoice
    team1_channel = await guild.create_voice_channel(f"Team 1 - {game_id}", overwrites=overwrites_team1,
  File "C:\Users\1\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\discord\guild.py", line 987, in create_voice_channel
    data = await self._create_channel(name, overwrites, ChannelType.voice, category, reason=reason, **options)
  File "C:\Users\1\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\discord\guild.py", line 844, in _create_channel
    'id': target.id
AttributeError: 'NoneType' object has no attribute 'id'```
jade crater
#

target is none

velvet tinsel
#

Yes

slate swan
sullen shoal
velvet tinsel
#

Use py

jade crater
slate swan
jade crater
#

Looked like he said "Everyone, my discord bot is not running. The error is module not found"

slate swan
#

how do you know he didn't mean 'My discord bot is not ruined' for whatever reason

jade crater
#

no clue

#

just my common sense lol

slate swan
#

i'm making a snipe command i want it to snipe emojis but i've got no idea tbh , can someone help me , i've made it already and when sniping emojis it just sends :text_emoji_name:

sullen shoal
slate swan
#

?whois 165023948638126080

slate swan
#

!whois 165023948638126080

jade crater
slate swan
#

like yk how some bots steal emojis

#

i'm guessing that would have something in common

jade crater
#

!d discord.PartialEmoji this maybe, but I havent used partial emoji once at all

unkempt canyonBOT
#

class discord.PartialEmoji```
Represents a “partial” emoji.

This model will be given in two scenarios:

• “Raw” data events such as [`on_raw_reaction_add()`](https://discordpy.readthedocs.io/en/master/api.html#discord.on_raw_reaction_add "discord.on_raw_reaction_add")

• Custom emoji that the bot cannot see from e.g. [`Message.reactions`](https://discordpy.readthedocs.io/en/master/api.html#discord.Message.reactions "discord.Message.reactions")...
reef shell
#

bots can use emojis from external servers

#

and can use animated ones too

jade crater
jade crater
#

i didnt mean that bruh 💀

final iron
#

Even animated ones

reef shell
jade crater
slate swan
jade crater
#

im stating facts

slate swan
jade crater
#

bots cant access emojis from servers the bot isnt in 😐

reef shell
reef shell
#

ask away

slate swan
jade crater
reef shell
final iron
#

For a bot to send an emoji you just need an id

summer gazelle
slate swan
# reef shell ask away

i'm making a snipe command i want it to snipe emojis but i've got no idea tbh , can someone help me , i've made it already and when sniping emojis it just sends :text_emoji_name:

jade crater
#

i fucking said that oml

reef shell
#

@jade crater how is this false

slate swan
#

you can't sent An emoji normally until it's in bot's cache

reef shell
#

can you explain

slate swan
jade crater
slate swan
jade crater
#

I meant that it cant use emojis in servers the bot isnt in

final iron
#

You just need the name and id

jade crater
reef shell
slate swan
reef shell
#

also you can use any emojis (yes from any discord servers) in buttons or dropdowns

keen talon
slate swan
#

yeah i've thought the same since dank uses some emojis that isnt in the server i was in

final iron
slate swan
#

but how'd i be able to get that from a users message ?

jade crater
# final iron You just need the name and id

how would that work, I thought discord members were equal to bots? they cant use emojis from other servers without nitro (bots can access other emotes from othe servers but im talking about servers it isnt it)

slate swan
jade crater
slate swan
jade crater
#

yes, i know

slate swan
#

That's how you get the elasped name , but bot will send only the emojis from server it is in

jade crater
slate swan
jade crater
jade crater
slate swan
#

but i'm not sure how to make that work , since if a user has a message and an emoji , would that still work ?

surreal sierra
#

Is it possible to make different profiles for the bot on different servers? For like when I add my bot to multiple servers, I can explain it a bit more if this was unclear

slate swan
#

oh i get that

sullen shoal
jade crater
sullen shoal
#

its going to be useful for servers if they add, they could customize the bot to their liking

#

or name it as their own bot

surreal sierra
sullen shoal
#

you may want to use a database (use async ones)

reef shell
#

if your bot's commands don't block the event loop then it's ok

surreal sierra
#

Yeah thanks, I think I probably got it even before I asked the question. I was just a bit slow XD

rose shale
#

how do we get list of all members of a server?

sullen shoal
#

guild.members

#

!d discord.Guild.members

unkempt canyonBOT
#

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

i tried it but only bot's name came

sullen shoal
#

!intents

unkempt canyonBOT
#

Using intents in discord.py

Intents are a feature of Discord that tells the gateway exactly which events to send your bot. By default, discord.py has all intents enabled, except for the Members and Presences intents, which are needed for events such as on_member and to get members' statuses.

To enable one of these intents, you need to first go to the Discord developer portal, then to the bot page of your bot's application. Scroll down to the Privileged Gateway Intents section, then enable the intents that you need.

Next, in your bot you need to set the intents you want to connect with in the bot's constructor using the intents keyword argument, like this:

from discord import Intents
from discord.ext import commands

intents = Intents.default()
intents.members = True

bot = commands.Bot(command_prefix="!", intents=intents)

For more info about using intents, see the discord.py docs on intents, and for general information about them, see the Discord developer documentation on intents.

rose shale
#

oh

reef shell
#

only your bot's name?

rose shale
reef shell
#

then maybe you don't have the member's intent enabled

rose shale
#

ok lemme try

sullen shoal
#

just copy pasting the above code will not work btw, you have to enable it in the dev panel

sullen shoal
#

yes

rose shale
#

ok

sullen shoal
#

just turn all of them on

velvet tinsel
#

Sherlock

#

Just wondering

#

Do you use Sherlock?

rose shale
slate swan
#

using py if member.premium_since - relativedelta(days=31): boost = ":2MboostBadge:" how can i check if a user has been boosting for over a month? im trying to make my bot return a users proper badge

slate swan
slate swan
#

wtf

#

no

#

how did you even get to that conclusion

#

tbh, its morning. im not fully present yet

#

¯_(ツ)_/¯

#

alright, lemme change up the question

#

how can i check if someones been boosting using premium_since for over 31 days, but less than 90

sullen shoal
#

!d datetime.datetime.month

unkempt canyonBOT
sullen shoal
#

premium since returns datetime object iirc

slate swan
#

iirc?

sullen shoal
#

if i remember correctly

slate swan
#

it does

slate swan
#

ive never really played around with datetime but variables are like, my specialty

slate swan
sullen shoal
#

it also has day attribute that returns the days

#

!d datetime.datetime.day

unkempt canyonBOT
slate swan
#

wait what? premium_since has a day attr?

#

ohhh, dt.dt. nvm

slate swan
sullen shoal
#

im confused what does terror actually want

slate swan
#

they wanna check if the date of premium_since (since when they started boosting) is between 90 days ago and 30 days ago

slate swan
#

emotes*

#

im trying to tie how long a users been boosting for to get their proper boost badge

sullen shoal
slate swan
#

weird, im getting an import error. apparently dateutil isnt a module

#

spelt wrong

#

!d dateutil

unkempt canyonBOT
#

The dateutil library provides extensions to the standard datetime module

slate swan
#

yeah thats weird, its saying its not imported

#

pip install dateutils

#

did that

#

how should i install it

sullen shoal
#

tils

slate swan
#

ohhh

#

with a s at the end

#

yeah, i noticed

slate swan
#

ive never seen that error

#

.premium_since.replace(tzinfo=None)

#

in the middle bit?

ocean leaf
#

it unbans the member but dosent send any message

#

not even any error

slate swan
#

does the bot have message perms?

slate swan
#

yes

ocean leaf
#

full admin perms

#

if it didnt, it shd have thrown error

slate swan
#

wait nvm

#

you have a closing bracket on discord.Embed

#

yeah idk

#

try reloading the bot maybe?

ocean leaf
#

ok

rose shale
#

in this, if i didnt give a name or id of member(avamember) in that server, it gives error
so i am trying tomake in such a way that if some starting words of a name of some member is given, it should still be able to find the member.
since it gives error , is there anyother way to get wat the argument given was?

lethal moat
#

i have a class which adds certain buttons to a message in discord, i want the buttons to only be interacted with by the person who issued the command for them, how can i do this?

class ChooseClass(nextcord.ui.View):
    def __init__(self):
        super().__init__()
        self.value = None

        # button for knight class
    @nextcord.ui.button(label="Knight", style=nextcord.ButtonStyle.green)
    async def knight(self, button:nextcord.ui.Button, interaction: nextcord.Interaction):
        self.value = "knight"
        self.stop()

        # button for archer class
    @nextcord.ui.button(label="Archer", style=nextcord.ButtonStyle.red)
    async def archer(self, button:nextcord.ui.Button, interaction: nextcord.Interaction):
        self.value = "archer"
        self.stop()

        # button for wizard class
    @nextcord.ui.button(label="Wizard", style=nextcord.ButtonStyle.blurple)
    async def wizard(self, button:nextcord.ui.Button, interaction: nextcord.Interaction):
        self.value = "wizard"
        self.stop()

above is the code i used in my class

slate swan
#

its Button if im not wrong

#

!d discord.ui.Button

unkempt canyonBOT
#

class discord.ui.Button(*, style=<ButtonStyle.secondary: 2>, label=None, disabled=False, custom_id=None, url=None, emoji=None, row=None)```
Represents a UI button.

New in version 2.0.
modest bear
#

I have this code however it does not create the channel in a category can someone help me out
channel = await guild.create_text_channel("📃Application",category=discord.utils.get(ctx.guild.categories, name='APPLICATION'),overwrites=overwrites)

slate swan
#

hm

lethal moat
#

i.e. only that person can click them

slate swan
lethal moat
#
@bot.command(name="start")
async def Chooseclass(ctx):
    print("Ran command 'start'!")
    view = ChooseClass()
    embed = nextcord.Embed(title="**Choose a class to begin!**",description="You must choose one of the options to continue playing!")
    embed.add_field(name="**Knight**", value="Your weapon will be your trusty old sword, you shall use it to defeat any that dare cross your path!",inline=False)
    embed.add_field(name="**Archer**", value="Your weapon will be a bow and arrow, it may come useful for ranged combat!",inline=False)
    embed.add_field(name="**Wizard**", value="Your magical powers lie in your wand! use the wisely to defeat your foe!",inline=False)
    embed.set_footer(text="Choose wisely! You cannot change your class once you select it!")
    embed.set_author(name="Start your adventure!")
    await ctx.send(embed=embed, view=view)
    await view.wait()
#

whenever someone runs the start command, the buttons appear along with the embed message @slate swan

mortal fable
#

pls daily

lethal moat
#

wrong channel brutha

lethal moat
slate swan
#
import discord

class MyClient(discord.Client):
    async def on_ready(self):
        print('Logged in as')
        print(self.user.name)
        print(self.user.id)
        print('------')

    async def on_message(self, message):
        if message.author.id == self.user.id:
            return

        if message.content.startswith('!hello'):
            await message.reply('hi', mention_author=True)


client = MyClient()
client.run('token')

i want my bot to respond back to this, but it doesnt

#

so i type and send "!hello"
and the bot responds with "hi"

slate swan
#

but it doesnt

slate swan
lethal moat
#

any errors in terminal?

slate swan
#

none

jade crater
#

can the bot talk

slate swan
#

yeah, it has admin perms and the channel is open to public

lethal moat
#

instead of message.reply, try message.channel.send

slate swan
#

i want it to reply

lethal moat
#

oh wait yeah they are different things..

jade crater
lethal moat
#

try having the code outside the class and not inside one

jade crater
quick gust
#

to work

slate swan
#

wdym

quick gust
#

since you are in a cog

jade crater
quick gust
#

try adding, @commands.Cog.listener

jade crater
#

its in a class, methods dont need decorators

jade crater
quick gust
#

its in a class

jade crater
lethal moat
slate swan
#

maybe the problem is that its in a virutal enviorment

jade crater
quick gust
jade crater
quick gust
#

yeah?

jade crater
#

hes subclassing the client

#

its not a cog

quick gust
#

oh I see

#

missed that part

jade crater
#

yes

quick gust
#

does subclassing the client help though?

lethal moat
#
import discord
client = discord.Client

@client.event
async def on_ready():
   print('Logged in as')
   print(self.user.name)
   print(self.user.id)
   print('------')

@client.event
async def on_message():
    if message.author.id == self.user.id:
        return

     if message.content.startswith('!hello'):
        await message.reply('hi', mention_author=True)

client.run('token')

this should work (if you move outside the class)
dont copy the code btw, the indentation is all messed up

jade crater
#

his code looked fine earlier

lethal moat
#

but it didnt work fine did it

jade crater
#

I said code, the "working" part probably is his fault

slate swan
jade crater
lethal moat
#

i told you not to copy it whole

slate swan
#

i didnt

lethal moat
#

well anyways, fix the indentation

slate swan
#

i only added @client.event

velvet tinsel
#

how do you do the tiny text in embeds?

lethal moat
jade crater
unkempt canyonBOT
#

set_footer(*, text=Embed.Empty, icon_url=Embed.Empty)```
Sets the footer for the embed content.

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

thanks

lethal moat
#

like you wrote the on_ready function