#discord-bots

1 messages · Page 781 of 1

tender estuary
#

I can't seem to figure

#

how I can give a count of the number of bots that have admin perms

slate swan
#

Get all the bot member objects and iterate through the perms, append the True condition to a list

tender estuary
#

so basically

light violet
tender estuary
#
[b for b in member.bot if b.guild_permissions.administrator]

but here how does it know which guild or something

slate swan
#

Otherwise if you wanna shorthen, best of luck

tardy plume
#

how can i make my bot create new channel and add that channel to my channel_id = 'here'

slate swan
light violet
#

guild = ctx.message.guild
r = [r for r in guild.roles if r.role_permissions.administrator]
await ctx.send(f'{len(r)}')

what is the prob in it

#

@tender estuary

tender estuary
#

ctx.author.guild first of all

light violet
#

then?

tender estuary
light violet
#

yes

#

@tender estuary

#

;

tender estuary
#

just a sec

light violet
#

ok

tender estuary
#
guild = ctx.author.guild
await ctx.send(len[r for r in guild.roles if r.role_permissions.administrator]))

Btw what error do you get?

light violet
#

no error is shown in console

#

btw cmd not working

true moon
#

multiple cooldowns for single command like if a user is not donator his cooldown is 10s and if he is then set the cooldown to 5s

slate swan
true moon
#

but how?

quick gust
#

!d discord.ext.commands.Command.reset_cooldown

unkempt canyonBOT
quick gust
#

@true moon ^^

#

what's IPC

#

also you shared the wrong imports, the ones you shared are different than what it shows in the error

boreal ravine
#

discord-ext-ipc, inter process communication

#

people use it for a bot dashboard

tacit token
#

My bot gets admin by default, but still the error code is that you don't have the right to ban. Why is that?

boreal ravine
#

who did you try to ban? the owner?

tacit token
#

nope, im the owner and i try ban my test acc

#

but nothing

#

Since I put an error system in it, it hasn't been good.

boreal ravine
tacit token
#

so go but this bot is not a servereb you have

#

translate shit

#

now i delet the error system and works

#

BROO token

stray adder
quick gust
#

already told that we won't help you

#
  • you leaked your token
stray adder
#

@quick gust this is not

quick gust
#

It's not a nuker?

stray adder
#

@quick gust this is not any nuker

quick gust
#

well i already had answered you aswell

#

commands.Bot, capital B

stray adder
#

Oo

tacit token
#

client = commands.Bot(command_prefix = "")

#

pip install discord

slate swan
stray adder
#

@quick gust thanks working now

#

@slate swan 😅

tacit token
#

😐

slate swan
stray adder
#

@slate swan then where should I host

slate swan
quick gust
marsh heron
#

He’s doing this for fun he shouldn’t buy hosting

slate swan
quick gust
stray adder
#

@slate swan reptl is enough I don't have money🥲

slate swan
#

never knew discord bots were F.U.N ¯\_(ツ)_/¯

tacit token
tacit token
quick gust
#

Goes against the rule 5

tacit token
#

Bruh. 642695801788956675

#

"I'm funny because I'm killing a server" clowning

stray adder
#

The nuker is already working but don't know to add more cmmds for kicking admins

Pls not asking doubt just saying

quick gust
#

Ok

tacit token
#

Helper or anybody?

slate swan
#

Imagine using a part of your life for making a nuker

#

F.U.N

stray adder
#

What's is this event thing

#

What will this code do

#

@slate swan

#

@quick gust

quick gust
#

First of all stop pinging

stray adder
#

Ok sorry

#

🙏🙏

rocky trench
#
    #pingreact
    @commands.Cog.listener()
    async def on_message(self,message):
        prfx = await db.fetchrow('''SELECT prefix FROM setup WHERE guild = $1''', message.guild.id)
        prefix = prfx["prefix"]
        db.close()
        mention = f'<@{self.bot.user.id}>'
        if (mention == message.content):
            await message.channel.send(f'My prefix here is ``{prefix}``')
        pcmention = f'<@!{self.bot.user.id}>'
        if (pcmention == message.content):
            await message.channel.send(f'My prefix here is ``{prefix}``')```ping react stopped working
slate swan
stray adder
#

@slate swan srry 🙏🙏

slate swan
#

alright then

rose gyro
# stray adder

There's a few issues with this code.

1)on_message takes a "message" parameter.

  1. author.content doesn't exist. I think you mean message.content

So how it works:
when a message is dispatched it is printed to the console, then when a message is deleted, it is printed in the console, along with the content and the author name

placid skiff
#

uhm

slate swan
# stray adder

the on_message event requires a message parameter typehinted as discord.Message

stray adder
slate swan
#

¯_(ツ)_/¯

#

phone and replit

#

were never meant to be used together

rose gyro
#

syntax is odd, but it's probably because of ^

placid skiff
#

!d disnake.ext.commands.when_mentioned_or

unkempt canyonBOT
#

disnake.ext.commands.when_mentioned_or(*prefixes)```
A callable that implements when mentioned or other prefixes provided.

These are meant to be passed into the [`Bot.command_prefix`](https://docs.disnake.dev/en/latest/ext/commands/api.html#disnake.ext.commands.Bot.command_prefix "disnake.ext.commands.Bot.command_prefix") attribute.

Example

```py
bot = commands.Bot(command_prefix=commands.when_mentioned_or('!'))
```...
placid skiff
#

here, use this

stray adder
#

Any one know how to make cmmd for kick and ban of members

slate swan
#

huh?

#

async is-

#

wtf, do you know what async does?

stray adder
#

@slate swan nop I also have that doubt

slate swan
stray adder
#

Coroutines means

placid skiff
slate swan
#

Why should I talk, plus no one listens to me assuming I'm too dumb for this shit pithink

#

async is a keyword not an attribute or a method smh

stray adder
#

@placid skiff I just search for some cods and combine them

slate swan
#

I would strongly recommend you to learn asynchronous programming

placid skiff
#

my god

slate swan
#

anyways, I have class, dont ping, bye

rose gyro
#

there is pycord which is just a fork of dpy which is still maintained

stray adder
#

@rose gyro I want to add kick/ban members for my bot can you help me

placid skiff
stray adder
#

@rose gyro I didn't understand anything

#

I'm a noob

rose gyro
#

from what I understand from the docs, it's just a set of libs regarding networking

#

like, asyncio, socket etc

placid skiff
#

Lol but first of all, how you want to use something that you don't even know what it is

#

and second, i have used a lot of fork and never heard of this "ipc"

rose gyro
placid skiff
#

can you link it?

placid skiff
#

i have some free time from my work cuz i'm waiting a client to response my mail xD

stray adder
#

How to make a command and what's is coroutine

#

🥲

placid skiff
rose gyro
stray adder
#

How to study

placid skiff
#

it's useless to give him examples xD, he can't understand them

stray adder
#

@placid skiff u are right

#

I'm just a commerce student

atomic canopy
#

so uh what happens if i select and what happens if i dont

rose gyro
#

Are you familiar with virtual envs?

placid skiff
#

found the link? you can send it to me in pm or it will be consider as spam

stray adder
#

From were
can I learn python

placid skiff
#

yes, I want to check it

placid skiff
rose gyro
#

docs, too. helped me a lot personally

stray adder
#

@placid skiff what should I learn first and where can I try them

#

I don't have pc

placid skiff
rose gyro
#

learn the basics, then start applying them to various projects. even a simple program means a lot

stray adder
#

Oo kk

#

I know to print hello world🥲

rose gyro
#

docs can be used along with tutorials since they go more in depth into the language concepts

stray adder
#

YouTube are full of English viedos and I'm a mallu 🙃

heavy folio
#

nvm its under classes

placid skiff
#

lol

placid skiff
stray adder
#

@placid skiff yss

placid skiff
#

you can't start programming without knowing english

slate swan
#

even python is half english words ¯_(ツ)_/¯

stray adder
#

@slate swan ya

placid skiff
#

python is meant to be a lot like english language lol

slate swan
placid skiff
#

yes of course hahaha

slate swan
stray adder
#

I know English but don't understand some words they say

junior verge
#

How does this not work?

    @commands.command(name='Warnings',aliases=["warns"])
    @commands.has_permissions(manage_messages=True)
    async def warnings(self, ctx, user:discord.Member=None):
slate swan
#

the decorator command name rules out the function name

cedar stream
slate swan
#

and the decorator command name has a capital W

placid skiff
#

commands can't have capitals, but i think you can use the name attribute to give a different name to your command, it should work

junior verge
slate swan
#

probably

placid skiff
#

No they can't, tried it already

#

only slash commands can

slate swan
junior verge
#

okay

slate swan
cedar stream
slate swan
#

^^

#

but it affects some features ig

cedar stream
#

Does it?

junior verge
#

Thanks it works

cedar stream
#

Which?

slate swan
#

dunno for sure, I read it somewhere

#

wait

slate swan
rose gyro
junior verge
#

And also got 1 question I got a @commands.has_permissions but how do I make it when soemone without that permissions tries the command that is just await.ctx something

cedar stream
stray adder
#

What is parameters

slate swan
unkempt canyonBOT
#

exception discord.ext.commands.MissingPermissions(missing_permissions, *args)```
Exception raised when the command invoker lacks permissions to run a command.

This inherits from [`CheckFailure`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.CheckFailure "discord.ext.commands.CheckFailure")
slate swan
placid skiff
#

oh he meant that

junior verge
cedar stream
stray adder
#

Wht is parameters

slate swan
cedar stream
placid skiff
junior verge
#

How do I do that?

slate swan
slate swan
cedar stream
rose gyro
#

there are some examples there that will help you understand

slate swan
#

huwunter

maiden fable
#

It's a bot event which takes in two args, the ctx which represents the context and the error which is the error that was raised. U can use isinstance to control how the bot should parse/act when a specific error comes

stray adder
#

Can anyone tell me wht is variables

junior verge
#

How do I define client here

maiden fable
#

ctx.bot

junior verge
#

found it

#

wait no

#

Get this error now

maiden fable
#

Ah that

junior verge
#

Yeah

maiden fable
#

self, ctx, error

junior verge
#

Got a idea?

maiden fable
#

Also u can do @commands.Cog.listener()

junior verge
#

I already did

maiden fable
#

Since u r in a class

junior verge
#
class Warn(commands.Cog):
    def __init__(self, client):
        self.client = client
    
    @commands.command()
    @commands.has_permissions(manage_messages=True)
    async def warn(self, ctx, user:discord.Member=None, *, reason=None):
        id= user.id
        if collection.count_documents({"memberid":id}) == 0:
            collection.insert_one({"memberid":id,"warns": 0})

        if reason==None:
            return await ctx.send("Please mention a reason")
        elif user==None:
            return await ctx.send("Please mention a user!")

        warn_count = collection.find_one({"memberid":id})

        count = warn_count["warns"]
        new_count = count + 1

        collection.update_one({"memberid":id},{"$set":{"warns": new_count}})

        await ctx.send(f"Warned {user.name} for **{reason}** in **{ctx.guild}** | They now have **{new_count}** warnings!")

    @commands.Cog.listener()
    async def on_command_error(ctx,error):
        if isinstance(error,commands.MissingPermissions):
            await ctx.send("You can't do that")
            await ctx.message.delete


        

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

That is my code

maiden fable
#

I told ya

#

on_connand_error(self, ctx, error):

#

Also add an else statement like

else:
    raise error
junior verge
#

ah

#

self bc in cogs

#

was that why

maiden fable
#

Mm

maiden fable
#

In the command error event

atomic canopy
#

can someone link me a tutorial i could follow to setup a bot

maiden fable
#

Which bot

junior verge
#

nvm

zealous dagger
#

Ok

slate swan
zealous dagger
#

Ok

slate swan
#

¯_(ツ)_/¯

flat solstice
#

so i'm not very familiar with writing these (functions?) so i'm not sure if I'm doing it right. This is taking place inside of a on_member_join, What I want to check is that the member who joined is the same person who reacted with the emoji and if they are then it deletes the msg but if the person who adds a reaction is not the person who joined then it just ignores the reaction

This is my errorpy Ignoring exception in on_member_join Traceback (most recent call last): File "/usr/local/lib/python3.8/dist-packages/discord/client.py", line 343, in _run_event await coro(*args, **kwargs) File "/home/modmail/cogs/events.py", line 322, in on_member_join reaction, user = await self.bot.wait_for('raw_reaction_add', check = check) File "/usr/lib/python3.8/asyncio/tasks.py", line 455, in wait_for return await fut File "/usr/local/lib/python3.8/dist-packages/discord/client.py", line 370, in dispatch result = condition(*args) TypeError: check() missing 1 required positional argument: 'user'and this is my code```py
await error_message.add_reaction("akoalathumbsup")

def check(reaction, user):
return user == member and str(reaction.emoji) == 'akoalathumbsup'

reaction, user = await self.bot.wait_for('raw_reaction_add', check = check)
await error_message.delete()```

potent spear
brisk brook
#

how do I make an embed without a value?

#

like an addfield

pine crown
#

How to make it so that if the bot joins a new server, it sends a message

potent spear
potent spear
pine crown
flat solstice
potent spear
pine crown
potent spear
pine crown
#

but theres no error coming in console

potent spear
#

because you have to use a decorator on top of the event 🧠

gaunt ice
#

do u use mongo db

flat solstice
gaunt ice
#

i want someone to helpme with mongo

potent spear
gaunt ice
#

no one respondig there ;-;

potent spear
#

can be 2 options;

  • vague question
  • no one is active there
#

don't ask if you can ask a question, we're not in school

#

just ask straight away

slate swan
#

Guys who do i keep getting that error in my hosting

gaunt ice
#

asyncio

#

did u install it?

#

wait

slate swan
gaunt ice
#

im... newbie

slate swan
#

plus, who imports modules at line 27 pithink

potent spear
#

asyncio is preinstalled with discordpy python, no need to worry about that

gaunt ice
#

oh

#

ok...

boreal ravine
#

asyncio is a built in module how exactly is it preinstalled into d.py

potent spear
#

edited

slate swan
#

lol

brisk brook
slate swan
potent spear
#

unless you want free errors

brisk brook
#

I see

slate swan
pine crown
pine crown
#

ashley*]

#

[

slim ibex
#

hello

slate swan
pine crown
#

h

#

i need h

slate swan
#

huh?

#

then ask for h

#

if you need h

pine crown
#

H

potent spear
slate swan
#

easy

pine crown
#

ok

brisk brook
#

how do I do random.randrange 3 different times?

pine crown
brisk brook
#

do I do it by using a for loop?

pine crown
#

my bot is client

potent spear
potent spear
slate swan
pine crown
potent spear
brisk brook
#

anyone?

slate swan
#

whats the issue, band?

potent spear
#

or use google for quicker answers

brisk brook
#

do I use a for loop for that?

slate swan
potent spear
#

you also have built-in functions / methods which create random lists for you...

brisk brook
#

for i in range(3):
random.randrange(0,51)

#

???

slate swan
#

his question isn't related to discord bots

brisk brook
slate swan
potent spear
brisk brook
slate swan
#

mfw people judge too quickly without considering the context of a situation

#

lol

brisk brook
#

ion wanna roast someone on a coding server

#

i wanna be sane for once

potent spear
#

what have you tried googling?

brisk brook
potent spear
#

what have you googled?

slate swan
slate swan
# brisk brook it will help my discord bot

Well but it isn't related to discord bots. It's about your question and not what you're building tbh. If you're making a web application and need to know how to print first, you'd ask in a general help channel and not in some specialized server meant for web applications specifically

#

^^

brisk brook
#

how do use random.randrange 3 different times

potent spear
pine crown
potent spear
slate swan
brisk brook
#

ayo if you wanna say something to me

#

say it upfront

slate swan
#

she did though

brisk brook
#

tf

slate swan
brisk brook
#

get yo anime looking bonified genderfluid headass outta here

potent spear
#

get out

slate swan
#

Lmao

brisk brook
#

tf xe/xim looking mf

#

mf be dreamsexual

#

omnisexual looking head ass

slate swan
#

That should be enough ¯_(ツ)_/¯

potent spear
#

ok, done yet?

slate swan
#

who's posting server invites 💀💀

pine crown
#

not me

boreal ravine
#

xGrx, remove the server invite from your code

slate swan
potent spear
#

or just

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.

brisk brook
slate swan
boreal ravine
slate swan
boreal ravine
#

what

slate swan
#

@brisk brook Can I screenshot?

slate swan
#

Your pfp hits hard

pine crown
brisk brook
slate swan
#

thanks bro

brisk brook
#

lowkey kinda fresh with it

#

yw homes

maiden fable
#

Lol

slate swan
#

cof cof

maiden fable
slate swan
#

hunter your about me is missing a curly brace

scenic viper
#

How do I send a POST request of a message with one image attachment, using synchronous requests.post? I keep getting this response: b'{"message": "Cannot send an empty message", "code": 50006}'. I am printing the body of my request and my message is there, with payload_json and content seemingly in the right place (Content-Disposition: form-data; name="payload_json"\r\nContent-Type: application/json\r\n\r\n{"content": "My great message"}\r\n--1041de0a2d52d6e387c3fc61182138c9\r\nContent-Disposition: form-data; name="file[0]")

maiden fable
slate swan
fervent shard
#

help?

@bot.event
async def on_ready():
    Channel = bot.get_channel('919761341277949965')
    Text= "**support team**/n hai there! looking to help out <@&932598948663812146>?/n react with :writing_hand: if you are,/n- always available to answer member’s questions/n- always alert and ready to take action/n- can always fix problems maturely/n receiving the support team role means you **strictly** need to follow the rules above. any disrespect or ignorance will have your role removed. thank you."
    Moji = await bot.send_message(Channel, Text)
    await bot.add_reaction(Moji, emoji=':writing_hand:')
@bot.event
async def on_reaction_add(reaction, user):
    Channel = bot.get_channel('919761341277949965')
    if reaction.message.channel.id != Channel
    return
    if reaction.emoji == ":writing_hand:":
      Role = discord.utils.get(user.server.roles, name="Trial Mod")
      await bot.add_roles(user, Role) ```error
```  File "main.py", line 167
    if reaction.message.channel.id != Channel
                                            ^
SyntaxError: invalid syntax```
slim ibex
#

no :

fervent shard
#

oh-

maiden fable
#

Old syntax

slim ibex
#

if reaction.message.channel.id != Channel:

slate swan
slim ibex
#

and indent the return inside that block'

boreal ravine
maiden fable
#

bot.add_reaction and bot.send_message isn't a thing anymore

slate swan
#

probably copy pasted 🥶

slate swan
maiden fable
#

U can now just do Channel.send()

slim ibex
fervent shard
boreal ravine
maiden fable
slim ibex
fervent shard
slate swan
#

imagine imagining that "a while"

#

lol

maiden fable
fervent shard
slate swan
maiden fable
#

The forks use v9

slate swan
fervent shard
# slate swan no?

i didnt do anything. and i didnt copy and paste, i had an argument with you last month. im just trying to get help from a simple old code, what do you want from me? leave me alone.

slate swan
#

I argued?

#

I mean...I usually do but for what lmfao

maiden fable
# slate swan why is the default version deprecated

Cz it provides the most basic syntax of the current implementation of send messages and stuff, like it doesn't has action rows and stuff, but got stuff like Channel.send or smth? I don't really know, sorry

slate swan
hollow quarry
potent spear
slate swan
hollow quarry
#

You shouldn't use v6 anymore, you should manually specify the v9 in the url

slate swan
maiden fable
#

Yea

pine crown
#

why nonone help me

slate swan
#

ask

maiden fable
slate swan
#

how old would you think it is, hunter

fervent shard
maiden fable
#

I don't really know, it's only been 1 year since I have been into discord bot deving scene

boreal ravine
maiden fable
#

can u both just ignore that and move on

#

Or take it to DMs

slate swan
maiden fable
#

Actually u should

slate swan
#

don't forget what they took from you

slate swan
#

nvm

maiden fable
#

Anyways, if u still don't wanna forget it, then just try remembering it in DMs

slate swan
#

their dms gonna be spicy 🥵

maiden fable
#

¯_(ツ)_/¯

slate swan
slate swan
pine crown
#
@client.event
async def on_guild_join():
  print("hello")

what the hell how does this not even work

slate swan
maiden fable
#

on_guild_join(guild)

#

Then it will work

#

!d discord.on_guild_join

unkempt canyonBOT
#

discord.on_guild_join(guild)```
Called when a [`Guild`](https://discordpy.readthedocs.io/en/master/api.html#discord.Guild "discord.Guild") is either created by the [`Client`](https://discordpy.readthedocs.io/en/master/api.html#discord.Client "discord.Client") or when the [`Client`](https://discordpy.readthedocs.io/en/master/api.html#discord.Client "discord.Client") joins a guild.

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

hunter pro

scenic viper
boreal ravine
maiden fable
#

gateway is the websocket where u get the events, http is the API which is used to send messages

#

Since components are a part of API v9

boreal ravine
#

o

torpid kraken
#

hey i needed some help 😅

#

why am i getting invalid string format in this line

if i use %S instead of $s it does not gives error but locks on to a date jan 1 1970

potent spear
torpid kraken
#

oke

potent spear
#

if you see in the docs under member.created_at, what does it return?

torpid kraken
#

the member acc create date

potent spear
#

I want to hear the datatype

torpid kraken
#

oh

#

hmm normal date i dont remember the data type 😅
i tried that

potent spear
#

the docs will tell you

#

don't ever doubt yourself

slim ibex
#

||datetime.datetime||

potent spear
#

spoiler

slim ibex
#

shit

#

u didn't see that 🙃

torpid kraken
#

u were talking abt this right ?

potent spear
torpid kraken
#

no 😅

potent spear
#

it's right under the text

torpid kraken
#

got it

potent spear
#

there you go

torpid kraken
potent spear
#

bruh

#

ok, so to show a timestamp, you need to CONVERT your datetime to a timestamp

#

google can help you with those simple questions

torpid kraken
#

hm oke let mee see

boreal ravine
#

which one looks nicer?

final iron
quick gust
#

2nd imo

potent spear
#

I don't see any differences besides the 2 dropdowns

boreal ravine
#

2nd*

#

hm

final iron
#

I don't like 2 drop downs

quick gust
potent spear
#

depends on what they're for

quick gust
#

2nd just looks cleaner, if 2 dropdowns are not needed then go with 2nd

boreal ravine
potent spear
boreal ravine
#

hm

potent spear
#

I'd use buttons for the commands which turn green / red if enabled/disabled

#

and an embed on top to explain their use

scenic viper
#

So, I cannot tell what the Python code for my Discord bot is doing wrong. I am trying to send a POST request which contains a message with an attached image. I cannot see where what I am sending differs from https://discord.com/developers/docs/resources/channel#create-message and https://discord.com/developers/docs/reference#uploading-files.

This integrates with an existing application, so I must use synchronous requests. Thus, I cannot use disnake's methods to send the message; I am using requests.post instead. When passed a files argument, that method sets the request's Content-Type to multipart/form-data, as required by the docs. I print out the request and I see my image, represented as bytes. I also send a JSON payload containing the message text and an attachments list, referencing the file I am sending. That JSON has a Content-Type of application/json, as required by the docs. I can paste here the POST request, trimmed of the gibberish image bytes, if it would help you to help me.

What am I doing wrong?

Discord Developer Portal

Integrate your service with Discord — whether it's a bot or a game or whatever your wildest imagination can come up with.

Discord Developer Portal

Integrate your service with Discord — whether it's a bot or a game or whatever your wildest imagination can come up with.

boreal ravine
#

uh

pine crown
potent spear
pine crown
potent spear
#

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

potent spear
#

put your code here, don't leak the token

maiden fable
#

!d discord.Intents.guilds

unkempt canyonBOT
maiden fable
#

U got these?

pine crown
potent spear
#

that's my suspicion, his intents

pine crown
potent spear
#

can you add this to your bot constructor:

#

is your client a commands.Bot or a discord.Client?

torpid kraken
#

hmm so i went and saw some but did not really understood :(

potent spear
#

anyways, just add intents = discord.Intents.default() in that method

pine crown
potent spear
pine crown
#

?

tender estuary
#

how long does rate limit last?

potent spear
#

just add what I typed above in the Bot()

torpid kraken
potent spear
#

no idea what you tried

torpid kraken
#

u were telling me ?

slate swan
#

it is something wrong whit the module, not my code

slate swan
pine crown
#

sigh why is my bot broken

potent spear
#

I haven't seen any code from you

pine crown
#
@client.event
async def on_guild_join(guild):
  print("hello")
potent spear
#

it's just
commands.Bot(whatever, intents = discord.Intents.default())

pine crown
#
intents = disnake.Intents.default()
intents.members = True
intents.guilds = True
client = commands.Bot(command_prefix=prefix, intents=intents, case_insenstivive = True)
client.remove_command('help')
potent spear
#

also, case_insensitive

pine crown
#

ok

pine crown
#

why my bot bully me

cold sonnet
#

commands.Bot has a help_command kwarg

#

you can set that to None

potent spear
pine crown
#

full

#

done

pine crown
potent spear
#

unless you're in a class, then you have to add self as first parameter

potent spear
#

code?

pine crown
#

class link(disnake.ui.View):
    def __init__(self):
        super().__init__()
        self.add_item(disnake.ui.Button(label=':white_check_mark: Support Server', style=disnake.ButtonStyle.blurple, 
                                        url='e'))
        self.add_item(disnake.ui.Button(label=':globe_with_meridians: Website', style=disnake.ButtonStyle.blurple, 
                                        url='e'))


@client.event
async def on_guild_join(guild):
  joinchannel = guild.system_channel
  embed=disnake.Embed(color=0x8400a8, title="Thank You For Adding PexiBot To Your Server!", description="Here are the basics to get you started.\n\n**Commands**:\n`/help` and `!info`\n\n**Support Server:**\nBot Support\n[PexiBot Support]e)\n\n**Vote/Review PexiBot:**\n[top.gg/PexiBot](e)\n\n**Issues?**\nMake sure the bot has administrator permissions.\nJoin the [support server](https://e) if there is any other issues.")
  await joinchannel.send(embed=embed, view=link())
  client.warnings[guild.id] = {}
pine crown
potent spear
#

and also, a traceback is there for a reason
it has an error AND tells you WHERE to error is

potent spear
#

now a full error traceback
not the last 3 lines

paper snow
#

Hikari question: How do I send a message? I am not using lightbulb or any sort of command library.

fresh orchid
#

how can I access this variable

@client.event
async def on_ready():
  
    global start_time
    start_time = datetime.now()

In a cog like this

class uptime(commands.Cog):

    def __init__(self, client):
        self.client = client



    @commands.command()
    async def uptime(self, ctx):
        delta_uptime =  datetime.now() - start_time
potent spear
# fresh orchid how can I access this variable ```python @client.event async def on_ready(): ...

Need to keep track of a variable between functions? No problem!

⚠️ Careful what you name it though, else you might overwrite something ⚠️

Just add it to your commands.Bot or discord.Client instance like so:

bot = commands.Bot(...)
bot.my_variable = 0

async def foo():
    bot.my_variable += 1

# In a cog
@commands.command()
async def counter(self,ctx):
    await ctx.send("Current Counter is at {}".format(ctx.bot.my_variable))

This also allows you to access this from other cogs/extensions/functions. Anywhere you have access to the bot instance

potent spear
pine crown
pine crown
potent spear
pine crown
#

ok

unkempt canyonBOT
#

Python allows you to set custom attributes to most objects, like your bot! By storing things as attributes of the bot object, you can access them anywhere you access your bot. In the discord.py library, these custom attributes are commonly known as "bot variables" and can be a lifesaver if your bot is divided into many different files. An example on how to use custom attributes on your bot is shown below:

bot = commands.Bot(command_prefix="!")
# Set an attribute on our bot
bot.test = "I am accessible everywhere!"

@bot.command()
async def get(ctx: commands.Context):
    """A command to get the current value of `test`."""
    # Send what the test attribute is currently set to
    await ctx.send(ctx.bot.test)

@bot.command()
async def setval(ctx: commands.Context, *, new_text: str):
    """A command to set a new value of `test`."""
    # Here we change the attribute to what was specified in new_text
    bot.test = new_text

This all applies to cogs as well! You can set attributes to self as you wish.

Be sure not to overwrite attributes discord.py uses, like cogs or users. Name your attributes carefully!

pine crown
potent spear
maiden fable
#

(:

potent spear
round folio
#

hello

velvet tinsel
potent spear
#

the plug?

velvet tinsel
#

that was before I realized that it was broken and had to get a new one

potent spear
#

desktop pc be like

velvet tinsel
#

it was for charging my computer

velvet tinsel
#

random bullshit go

slate swan
velvet tinsel
slate swan
#

well, idk

#

because on my pc it works perfectly

slate swan
#
if [[ -d .git ]] && [[ 0 == "1" ]]; then git pull; fi; if [[ ! -z ${PY_PACKAGES} ]]; then pip install -U --target /home/container/ ${PY_PACKAGES}; fi; if [[ -f /home/container/requirements.txt ]]; then pip install -U --target /home/container/ -r requirements.txt; fi; /usr/local/bin/python /home/container/main.py
#

not that , the python version, requirements TXT , additional package etc

#

now it is nothing

#

because i dont want the packages to be installed a few time

flat solstice
#

is there a way to count how many messages a user has sent on a server, ik i can use history to search a channels history but is there a way to search the entire servers history rather than a channel or would I need to search through every channel and then combine each channel's history to one counter

slate swan
#

it was like

discord-componentes==3-4-3

#

and stuff like that

#

And the python docker image version?

#

try changing it to 3.8+ ...

#

choose 3.9 or 10

slate swan
#

you removed the requirements file

#

ahrixjam so discord is no longer there

slate swan
#

let me try

#

let me try

#

and we are back to this error

flat solstice
slate swan
fervent shard
#

rushed this command, am i suppose to use it like "?slowmode {channel} {seconds}"?

@bot.command()
async def slowmode(ctx, seconds: int):
    await ctx.channel.edit(slowmode_delay=seconds)
    em1=discord.Embed(description="the `slowmode` has been **set** to {seconds} seconds", colour=discord.Colour.green())
    await ctx.send(embed=em1)```
flat solstice
#

if I'm only adding one role to someone do I need the top 2 lines of this code? py tmp = [] tmp.append(discord.Object(797166495993692160)) await after.add_roles(*tmp, reason = f"{after} received the {tmp} role as they meet all of the criteria.", atomic = True)

maiden fable
#

No

flat solstice
# maiden fable No

So could I swap *tmp out for just the role ID or would it need to be *role-ID, or would I need to do tmp = self.bot.get_role(ID = role-ID then do add_role(tmp, reason)

maiden fable
#

u either need discord.Object or a discord.Role object

flat solstice
maiden fable
#

Yea

minor panther
#

hello guys, can you tell me the event name to control nick changng?

#

nick changing*

scarlet snow
#

I would assume on_member_update

#

!d discord.on_member_update

unkempt canyonBOT
#

discord.on_member_update(before, after)```
Called when a [`Member`](https://discordpy.readthedocs.io/en/master/api.html#discord.Member "discord.Member") updates their profile.

This is called when one or more of the following things change:

• nickname

• roles

• pending...
scarlet snow
#

@minor panther ^

desert cosmos
#

how to set it default in context manager
this is giving error

neat kestrel
#

coming back into this lib after 1 year any thing to note?

neat kestrel
#

yea

desert cosmos
#

its closed by its developer xD

#

you can use its forks though

neat kestrel
#

so its come to an end?

scarlet snow
scarlet snow
desert cosmos
scarlet snow
#

is that a cog or just a regular class?

#

well anyways

desert cosmos
#

cog

scarlet snow
#

wait cog?

desert cosmos
#

yup

#

like i will be using this context manager in a cog

#

does that has to do something with it

#

i don't think so ?

scarlet snow
#

not actually

slate swan
#

why do i get this error?

desert cosmos
scarlet snow
#

oh i'm dumb should be async tho

#

i would pass args in that function + turn into async

desert cosmos
#

yeah but its a context manager so i would be using it something like this

#

and i want to remove that delete_after=3.0 part

scarlet snow
#
async def funcname(self, content, dl):
    await self.ctx.channel.send(content, delete_after=dl)
#

right

scarlet snow
desert cosmos
#

i have like so many commands like this

#

so it would be pain to write it in all of em

scarlet snow
neat kestrel
#

how do i add the discord developer portal custom games things with discord.py?

#

can someone send me docs on on_ready?

spring flax
unkempt canyonBOT
#
Nuh-uh.

No documentation found for the requested symbol.

spring flax
#

!d discord.on_ready

unkempt canyonBOT
#

discord.on_ready()```
Called when the client is done preparing the data received from Discord. Usually after login is successful and the [`Client.guilds`](https://discordpy.readthedocs.io/en/master/api.html#discord.Client.guilds "discord.Client.guilds") and co. are filled up.

Warning

This function is not guaranteed to be the first event called. Likewise, this function is **not** guaranteed to only be called once. This library implements reconnection logic and thus will end up calling this event whenever a RESUME request fails.
spring flax
#

Are allowed mentions for send only for that specific message?

slate swan
valid galleon
#

so a lot of my friends asked me to make a discord bot for our class, which keeps track of the timetable and reminds them what class it is, by pinging a role. For this, i want to trigger events only when it is a certain day and time, in IST. is there any way i can do that?

neat kestrel
#
@tasks.loop(seconds = 600)
async def member():
    name1 = (f"Member Count : {member.guild.member_count}")
    chan = member.guild.get_channel(877784914668437508)
    await chan.edit(name=name1)``` why wont this work im sure im missing an attribute not sure what it would be tho
spring flax
#

member is the function name, not a member object

#

also you need
member.start() of course

neat kestrel
#

whats member.start?

kindred drum
#

how do I get the channel a user sends a message in

potent spear
kindred drum
#

not using ctx

#

using message

potent spear
#

message.channel

kindred drum
#

ahokay

neat kestrel
#
@tasks.loop(seconds = 600)
async def member(ctx):
    member.start()
    name1 = (f"Member Count : {ctx.guild.member_count}")
    chan = ctx.guild.get_channel(877784914668437508)
    await chan.edit(name=name1)```
#

makes sence?

potent spear
#

this is a risky function name

neat kestrel
#

why?

potent spear
#

member can be used as a variable name
also, you don't start a loop in the loop itself

neat kestrel
#

right

potent spear
#

also, your task shouldn't have the ctx parameter

neat kestrel
#

never used this function sorry

spring flax
#

Are allowed mentions for send only for that specific message?

potent spear
#

"oh, but how do I get the guild and channel then?"
get_guild, get_channel

neat kestrel
#

oh i see

potent spear
neat kestrel
#

can you give an example?

potent spear
neat kestrel
#

i see

#
@tasks.loop(seconds = 600)
async def member():
    name1 = (f"Member Count : {get_guild.member_count}")
    chan = get_guild.get_channel(877784914668437508)
    await chan.edit(name=name1)```
#

this?

kindred drum
#
  @commands.Cog.listener()
    async def on_message(self, message):
        if message.author == bot:
            return
    
        print(message.author)
        if content_list_complied.search(message.content) is not None:
            
            await message.channel.send(message.content)
        else: 
            print("hellos")
                ``` why doesn't this not ignore the bot
potent spear
#

it needs an id as argument

neat kestrel
#

oh i see

potent spear
#

better option:
if message.author.bot: return
=> ignores ALL bots

wispy spade
#

If it is, then yeah, bot.user will do if you want to ignore your bot.

neat kestrel
#
@tasks.loop(seconds = 600)
async def member():
    name1 = (f"Member Count : {bot.get_guild.member_count}")
    chan = bot.get_guild.get_channel(877784914668437508)
    await chan.edit(name=name1)
potent spear
neat kestrel
#

can i have the docs lol

slate swan
#

guys why when i run my code in my hosting i get that error? on my pc it works just fine

quick gust
#

You need to provide get_guild a guild ID

neat kestrel
#

oh i see

wispy spade
#

!d discord.ext.commands.Bot.get_guild

unkempt canyonBOT
quick gust
#

you can do bot.get_guild(guild_id).get_channel(channel_id) i think

potent spear
#

indeed

#

bit long, but yeah

slate swan
#

why not just get_channel?

quick gust
#

yep, i figured they wanted to do it in one line or something

quick gust
potent spear
#

if you specify a guild, I'd think it'll go a bit faster

slate swan
#

mhm makes sense

#

but , it gets the guild first , and then the channel ... so it may take kinda same time

oblique cobalt
shadow wraith
#

so i have this command

#
@bot.command()
@commands.has_role("Bot Developer")
async def speak(self, ctx, channel_id, *, message):
    channel_used = int(channel_id)
    await channel_used.send(message)
#

but for some reason, whenever i try to run it, it just says "this command cannot be used in private messages."

#

i do have an on_command_error event and that's what it said

neat kestrel
#

guild_id gives id or is it for mt referne?

potent spear
#

because you have to unwrap the error, it's throwing an CommandInvoke error

potent spear
oblique cobalt
neat kestrel
#

guild_id gives id or is it for my reference?

final iron
oblique cobalt
neat kestrel
#
@tasks.loop(seconds = 600)
async def member():
    name1 = (f"Member Count : {bot.get_guild(guild_id).member_count}")
    chan = bot.get_guild(guild_id).get_channel(877784914668437508)
    await chan.edit(name=name1)```
final iron
#

So are you in a cog or not?

neat kestrel
#

this?

oblique cobalt
potent spear
neat kestrel
#

i asked that lol

potent spear
#

you can hardcode it in there

shadow wraith
neat kestrel
#

what if i wanted the guild id tho

potent spear
#

also, not a good idea to get the guild twice
just
guild = bot.get_guild(..)

#

use the guild object later

oblique cobalt
shadow wraith
#

the bot is only in 1 server tho

final iron
shadow wraith
#

ok

shadow wraith
#
Infinity lounge
Ignoring exception in command speak:
Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/disnake/ext/commands/bot_base.py", line 560, in invoke
    await ctx.command.invoke(ctx)
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/disnake/ext/commands/core.py", line 921, in invoke
    await self.prepare(ctx)
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/disnake/ext/commands/core.py", line 842, in prepare
    if not await self.can_run(ctx):
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/disnake/ext/commands/core.py", line 1168, in can_run
    return await disnake.utils.async_all(predicate(ctx) for predicate in predicates)  # type: ignore
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/disnake/utils.py", line 547, in async_all
    for elem in gen:
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/disnake/ext/commands/core.py", line 1168, in <genexpr>
    return await disnake.utils.async_all(predicate(ctx) for predicate in predicates)  # type: ignore
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/disnake/ext/commands/core.py", line 1901, in predicate
    raise NoPrivateMessage()
disnake.ext.commands.errors.NoPriva
#

i dont see my code

neat kestrel
#
Traceback (most recent call last):
  File "C:\Users\Nitin\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\ext\tasks\__init__.py", line 101, in _loop
    await self.coro(*args, **kwargs)
  File "C:\Users\Nitin\OneDrive\Desktop\New bot\main.py", line 52, in member
    name1 = (f"Member Count : {guild.member_count}")
AttributeError: 'NoneType' object has no attribute 'member_count'``` this is not a method for it?
shadow wraith
#

oh yeah and the bottom part is

    raise NoPrivateMessage()
disnake.ext.commands.errors.NoPrivateMessage: This command cannot be used in private messages.
neat kestrel
#
@tasks.loop(seconds = 600)
async def member():
    guild = bot.get_guild(877784914668437504)
    name1 = (f"Member Count : {guild.member_count}")
    chan = guild.get_channel(877784914668437508)
    await chan.edit(name=name1)


member.start()```
neat kestrel
oblique cobalt
neat kestrel
oblique cobalt
wispy spade
#

which executes when yk... someone joins

shadow wraith
oblique cobalt
neat kestrel
#

oh i could use that didnt think of that

potent spear
neat kestrel
#

i see

wispy spade
neat kestrel
#
async def member():
    await bot.wait_until_ready()
    guild = bot.get_guild(877784914668437504)
    name1 = (f"Member Count : {guild.member_count}")
    chan = guild.get_channel(877784914668437508)
    await chan.edit(name=name1)


member.start()```
quick gust
#

Test it now

neat kestrel
#

ill check

potent spear
#

you don't need the () in name1

neat kestrel
#

actually i dont but it wont give an error else ways

#

btw works now thanks! also sorry since I'm coming back to this lib after 2 years

quick gust
#

No worries

neat kestrel
#

now gotta try it with member join

potent spear
#

you don't want to update whenever a member joins / leaves

neat kestrel
#

why not?

quick gust
#

I think that might get you ratelimited if you have a popular server where people keep joining and leaving

potent spear
#

^^

oblique cobalt
unkempt canyonBOT
#

discord/ext/commands/bot.py line 507

return func```
potent spear
shadow wraith
#
Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/disnake/ext/commands/bot_base.py", line 560, in invoke
    await ctx.command.invoke(ctx)
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/disnake/ext/commands/core.py", line 921, in invoke
    await self.prepare(ctx)
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/disnake/ext/commands/core.py", line 842, in prepare
    if not await self.can_run(ctx):
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/disnake/ext/commands/core.py", line 1168, in can_run
    return await disnake.utils.async_all(predicate(ctx) for predicate in predicates)  # type: ignore
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/disnake/utils.py", line 547, in async_all
    for elem in gen:
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/disnake/ext/commands/core.py", line 1168, in <genexpr>
    return await disnake.utils.async_all(predicate(ctx) for predicate in predicates)  # type: ignore
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/disnake/ext/commands/core.py", line 1901, in predicate
    raise NoPrivateMessage()
disnake.ext.commands.errors.NoPrivateMessage: This command cannot be used in private messages.
shadow wraith
#

i dont see my code in there

neat kestrel
shadow wraith
#

in the traceback

quick gust
neat kestrel
#

scince it wont rate limit

#

(i hope)

quick gust
#

it wont

neat kestrel
#

yea thanks

shadow wraith
wispy spade
shadow wraith
#

i dont understand why the error came

neat kestrel
#
async def suggest_error(ctx, error):
    if isinstance(error, commands.CommandOnCooldown):
        await ctx.send(f"Hey! you need to wait {(int(error.retry_after/60))} mins before using it again!")``` this will work for cogs as well?
#

or i need a new one for cogs?

potent spear
shadow wraith
#

oh

oblique cobalt
shadow wraith
#

wait you are right

potent spear
potent spear
shadow wraith
neat kestrel
#

? i dont think so

neat kestrel
#

can the term ctx be anything?

#

forgot

oblique cobalt
shadow wraith
#

@potent spear

Ignoring exception in command speak:
Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/disnake/ext/commands/bot_base.py", line 560, in invoke
    await ctx.command.invoke(ctx)
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/disnake/ext/commands/core.py", line 921, in invoke
    await self.prepare(ctx)
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/disnake/ext/commands/core.py", line 842, in prepare
    if not await self.can_run(ctx):
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/disnake/ext/commands/core.py", line 1168, in can_run
    return await disnake.utils.async_all(predicate(ctx) for predicate in predicates)  # type: ignore
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/disnake/utils.py", line 547, in async_all
    for elem in gen:
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/disnake/ext/commands/core.py", line 1168, in <genexpr>
    return await disnake.utils.async_all(predicate(ctx) for predicate in predicates)  # type: ignore
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/disnake/ext/commands/core.py", line 1901, in predicate
    raise NoPrivateMessage()
disnake.ext.commands.errors.NoPrivateMessage: This command cannot be used in private messages.

same traceback, i removed that useless variable for converting the channel_id into an int and used the channel_id param instead

neat kestrel
#

so wont it get mixed with what were they called quargs i think

oblique cobalt
potent spear
shadow wraith
#

ohh

potent spear
neat kestrel
#

yea i do

potent spear
#

tell me

neat kestrel
#

arent they what come after ctx

potent spear
#

not necessarily

neat kestrel
#

the content of the

#

message after command

#

using * if i rem right

potent spear
#

kwargs are
keyword arguments

neat kestrel
#

yea

potent spear
#

there's a difference between positional and keyword arguments, you should check that out sometime

oblique cobalt
# neat kestrel using * if i rem right

**kwargs
* is for tuple and shit

i mean, let me just write example

def a(*args):
 print(args)
a(1,2,3) # (1, 2, 3)
def b(**kwargs):
 print(kwargs)
b(a = 1, b = 2) # {"a" : 1, "b" : 2}
neat kestrel
#

yea btw did the dev add the embed option thing below them

oblique cobalt
#

wdym

neat kestrel
oblique cobalt
neat kestrel
#

oh

wispy spade
oblique cobalt
#

TypeError to be specific

neat kestrel
#

gotta test it out now

oblique cobalt
neat kestrel
#

i see thanks

#

so kwargs take variables while args is what ever comes after it

oblique cobalt
#

ye

neat kestrel
#

i see thank : )

neat kestrel
novel cargo
#

error pycordIgnoring exception in on_member_join Traceback (most recent call last): File "C:\Users\hp\AppData\Local\Programs\Python\Python38-32\lib\site-packages\discord\client.py", line 352, in _run_event await coro(*args, **kwargs) File ".\main.py", line 28, in on_member_join asset = member.display_avatar().with_size(128) TypeError: 'Asset' object is not callable

potent spear
#

no () needed

#

it's just member.display_avatar

slate swan
#

Does anyone know how I can do a perms check with the database, I have a command to add a person in the premium category and I would like her to use only those commands. I use mongodb

kindred drum
#
 @commands.Cog.listener()
    async def on_message(self, message):
        if message.author.bot:
            return
        
        if "@everyone" in message.content:
            channel1 = bot.fetch_channel(915552800350535750)
            await message.channel.purge(limit=1)
            at = discord.Embed(title="Moderation LOG", description="Messaged deleted")
            at.add_field(name="Message deleted", value="``"+str(message.content)+"``")
            at.add_field(name="Infracting user", value=str(message.author.mention))
            at.add_field(name="Channel", value=str(message.channel.mention))
            at.set_footer(text=f'Cosmic Overground')
            at.timestamp = datetime.datetime.utcnow()
        
            message.channel1.send(embed=at)``` yo I get this message ``TypeError: coroutine.send() takes no keyword arguments`` anyone got an idea as to why
potent spear
#

also, you can just check if
message.guild.default_role in message.role_mentions:
idk if you like clean looks

kindred drum
#

oh my god

potent spear
#

same goes for fetch_channel, this has to be awaited too

#

you can perfectly use get_channel tho (which doesn't need to be awaited since it's not an API call)

kindred drum
#

okay

#

thanks

potent spear
#

lastly, the str() is redundant, since they're all strings anyways

#

also your footer doesn't need the f as in f string

#

and removing a message is as simple as
await message.delete() you don't need the purge shit

flint widget
slate swan
haughty quartz
#

so im building a anti scam link bot and my take on this was to parse the url to search for typical scam link embeds "og" meta tags, do you guys think its a good way to do it?

plush geyser
#

Depends what types of scam links

#

Nitro? Or just in general

haughty quartz
#

yeah

#

nitro

flint widget
# slate swan and how can I do this? The database saves them this way.

The easiest way to understand is to have an if statement at the start of the commands you want to be premium only, where it says something like

current_user_id = ...
list_of_user_ids = ...
if current_user_id not in list_of_user_ids:
  send("sorry you're not premium")
else:
  the rest of the command here
#

There are loads of nicer ways to do it but that's the simplest way to think about it without using decorators and checks which I'm not sure if you've used before

slate swan
#

But i don't know how can i check now

flint widget
#

How it looks now is it will do some checks and send the error but it adds them anyway

slate swan
grim oar
#

^

haughty quartz
slate swan
#

I have no problem with the code when I add someone or remove someone from the premium. My problem is not so how to check if the user is in the database in order to use the commands

slate swan
#

not misspelled but fake

#

On a Levelup command that works fine but for some it doesnt How can i fix it?

haughty quartz
slate swan
#

Ik its missing permissions

#

but why is it there

haughty quartz
slate swan
haughty quartz
slate swan
#

i use mongodb

flint widget
manic wing
#
from world import Person
okimii = Person(name="Okimii")``` it should be this @slate swan
slate swan
#

its just a nick name in this server only

#

so i wont update it

#

lol

grim oar
#

The class

flint widget
slate swan
haughty quartz
slate swan
#

oh yeah a 429 is rate limitation

haughty quartz
slate swan
#

so it wont raise a http code because of roles

#

it just wont do the action

haughty quartz
#

i got that once

#

it wouldnt ban users with a higher role even tho it had the perms

slate swan
#

thats just how discord works

haughty quartz
#

yes

slate swan
#

you cant ban someone with higher power

haughty quartz
#

ik, but i had a similar error saying it had no permission, thats why i thought it might be because of that

potent spear
#

only way is if you did it via a bot that has a higher role than the user you're trying to ban

slate swan
#

^

sonic flax
meager chasm
leaden jasper
#

how to drop a command if it gets called again?

slate swan
#

Check this out , it's Disnake but all it used in that example was discord.py 2.0 so it doesn't matter

velvet tinsel
leaden jasper
#

Yes

#

so like you do !help and there's buttons for that command, if you do !help again, the old message's buttons wont work/disappear

slate swan
#

is there a channel bucket?

velvet tinsel
#

variable with boolean ig

velvet tinsel
slate swan
#

for cooldowns

velvet tinsel
velvet tinsel
slate swan
velvet tinsel
quaint epoch
#

can discord bots join a vc and unmute?

slate swan
meager chasm
velvet tinsel
quaint epoch
maiden fable
#

Sure

maiden fable
#

wait unmute itself?

quaint epoch
maiden fable
unkempt canyonBOT
velvet tinsel
maiden fable
#

!d discord.VoiceClient.play

unkempt canyonBOT
#

play(source, *, after=None)```
Plays an [`AudioSource`](https://discordpy.readthedocs.io/en/master/api.html#discord.AudioSource "discord.AudioSource").

The finalizer, `after` is called after the source has been exhausted or an error occurred.

If an error happens while the audio player is running, the exception is caught and the audio player is then stopped. If no after callback is passed, any caught exception will be displayed as if it were raised.
quaint epoch
maiden fable
#

See the docs

velvet tinsel
#

I should add a doc searcher thing for my personal assistant

unkempt canyonBOT
#
Command: docs

Look up documentation for Python symbols.

Source Code
velvet tinsel
#

opens a google tab with it

slate swan
slate swan
velvet tinsel
slate swan
#

👁️ 👁️

maiden fable
#

Wait what

#

Ah wait nvm, u r doing it the correct way

#

Thought view.message was a thing, sorry