#discord-bots

1 messages Β· Page 568 of 1

slate swan
#

ah, are there any quick/easy and free databases?

#

MongoDB

tough wagon
#

SQLite

boreal ravine
#

aiosqlite*

slate swan
#

lol, which one do I choose

tough wagon
boreal ravine
slate swan
#

There's also postgresql

gloomy coral
#

Help

boreal ravine
gloomy coral
#
@commands.command(aliases=['search'])
    async def google(self, ctx:nextcord.ext.commands.Context, *, query: str):
        await ctx.send(f'Google Result for: `{query}`', view=Google(query))```
slate swan
#

alright

tough wagon
slate swan
#

ty

gloomy coral
#
Ignoring exception in on_message
Traceback (most recent call last):
  File "C:\Users\jason\chad\venv\lib\site-packages\nextcord\ext\commands\core.py", line 168, in wrapped
    ret = await coro(*args, **kwargs)
  File "C:\Users\jason\chad\cogs\info.py", line 247, in google
    await ctx.send(f'Google Result for: `{query}`', view=Google(query))
  File "C:\Users\jason\chad\venv\lib\site-packages\discord_slash\dpy_overrides.py", line 323, in send_override
    return await send(channel, *args, **kwargs)
TypeError: send() got an unexpected keyword argument 'view'

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

Traceback (most recent call last):
  File "C:\Users\jason\chad\venv\lib\site-packages\nextcord\client.py", line 351, in _run_event
    await coro(*args, **kwargs)
  File "C:\Users\jason\chad\bot.py", line 66, in on_message
    await bot.process_commands(message=message)
  File "C:\Users\jason\chad\venv\lib\site-packages\nextcord\ext\commands\bot.py", line 1032, in process_commands
    await self.invoke(ctx)
  File "C:\Users\jason\chad\venv\lib\site-packages\nextcord\ext\commands\bot.py", line 999, in invoke
    await ctx.command.dispatch_error(ctx, exc)
  File "C:\Users\jason\chad\venv\lib\site-packages\nextcord\ext\commands\core.py", line 520, in dispatch_error
    await injected(cog, ctx, error)
  File "C:\Users\jason\chad\venv\lib\site-packages\nextcord\ext\commands\core.py", line 154, in wrapped
    ret = await coro(*args, **kwargs)
  File "C:\Users\jason\chad\cogs\info.py", line 556, in google_error
    raise error
  File "C:\Users\jason\chad\venv\lib\site-packages\nextcord\ext\commands\bot.py", line 995, in invoke
    await ctx.command.invoke(ctx)
  File "C:\Users\jason\chad\venv\lib\site-packages\nextcord\ext\commands\core.py", line 895, in invoke
    await injected(*ctx.args, **ctx.kwargs)```
boreal ravine
#

oh

#

stop using shit libs xD

#

i got this error too

#

lemme find it rq

gloomy coral
slate swan
#

Nextcord πŸ˜‚πŸ˜‚

gloomy coral
#

lol

gloomy coral
gloomy coral
slate swan
#

No wonder you got an error

gloomy coral
#

xD its a json file

tough wagon
#

unoficcial 3rd party of dpy...

boreal ravine
gloomy coral
slate swan
#

Can someone give me the code of members intents or the python bot command of intents

gloomy coral
boreal ravine
slate swan
slate swan
boreal ravine
gloomy coral
slate swan
boreal ravine
slate swan
gloomy coral
boreal ravine
gloomy coral
#

use tinydb if u beginner

#

its ez af

boreal ravine
#

its because of the lib he's using

gloomy coral
boreal ravine
#

yes

slate swan
#

discord_components?

boreal ravine
#

File "C:\Users\jason\chad\venv\lib\site-packages\discord_slash\dpy_overrides.py", line 323, in send_override
return await send(channel, *args, **kwargs)
TypeError: send() got an unexpected keyword argument 'view'

#

chad 😳

slate swan
#

btw how do you make slash commands to the bot instead?

gloomy coral
boreal ravine
slate swan
boreal ravine
#

lol

slate swan
#

im using the discord lib?

gloomy coral
slate swan
#

If it's dpy, they don't have it

boreal ravine
#

iirc nextcord's slash commands are still in beta

slate swan
#

You could use a 3rd party lib, but that could mess with dpy's internals, like they always did

#

So you'd be better off by using a fork

boreal ravine
tough wagon
slate swan
#

And by far the best and most promising and mature fork is disnake

slate swan
slate swan
gloomy coral
boreal ravine
gloomy coral
#

i hv an idea

boreal ravine
#

im asking how do we update things in tinydb

slate swan
gloomy coral
#

What if i use discord slash buttons......

gloomy coral
boreal ravine
gloomy coral
#

πŸ˜‚

supple thorn
slate swan
#

What? Wasn't that the ponzzk something idk

tough wagon
slate swan
#

Β―\_(ツ)_/Β―

tough wagon
#

!unpin shit lib

unkempt canyonBOT
#

You are not allowed to use that command here. Please use the #bot-commands channel instead.

pale zenith
slate swan
#

rapzzz something

slate swan
#

idk i cant remember his name

#

That's Danny

pale zenith
#

yeah Rapptz lol

boreal ravine
#

ponzzk

pale zenith
#

aka danny blobsweatsip

boreal ravine
#

πŸ™†

slate swan
#

Rapptz is his github username

#

ahaaaa, danny the daddy

slate swan
slate swan
pale zenith
tough wagon
#

RoboDanny k_yeah

boreal ravine
#

sending this to danny πŸ˜‚ πŸ˜‚ πŸ—Ώ

slate swan
#

no

#

πŸ˜‚πŸ˜‚πŸ˜‚πŸ˜‚

#

don't

kind radish
#

**i am trying to make an afk cog ** with very limited knowledge of python

the screenshot shows what i have in mongodb

what i want to do is:
on_message
if someone mention you
bot check if mention.id in member (on database)
check AFK (on database)
send message: user is afk with {reason}

if member texts
bot check if author.id in member (on database)
set AFK to false (on database)

can anyone help please?
how do i read database, any docs would help too.

slate swan
boreal ravine
#

afk cog

slate swan
#

nono i was just joking

tough wagon
#

Object

pale zenith
slate swan
#

channel.history it is then, i'm outta here thanks guys

pale zenith
#

this is even worse than #help and #help-2 blobsweatsip

slate swan
#

πŸ˜‚πŸ˜‚

#

btw what is the attribute/method called to check if there is a channel named something

#

or no i need to iterate through every channel and see if there is a channel called logs?

unkempt canyonBOT
#

get_channel(channel_id, /)```
Returns a channel with the given ID.

Note

This does *not* search for threads.
tough wagon
#

if returns none then there is no channel with this name

pale zenith
slate swan
tough wagon
#

oh

#

then utils.get

slate swan
pale zenith
#

in one guild yex

pale zenith
#

yes*

slate swan
#

alright thank you

pale zenith
#

well

slate swan
pale zenith
#

you can pass bot.get_all_channels()

slate swan
#

You're banned from it afaik

boreal ravine
#

lemme join back

#

xD

tough wagon
pale zenith
slate swan
slate swan
#

I just happened to join πŸ™„

#
    @has_permissions(manage_roles=True, )

what is it called if i want to check if the user has permissions to edit /create channels?

boreal ravine
slate swan
#

alright thanks guys

boreal ravine
#

np cat

#

🐈

slate swan
slate swan
slate swan
#

yet

#

xD

boreal ravine
#

imagine

slate swan
#

u wan't me to start?

pale zenith
#

wan't

boreal ravine
#

wan't

pale zenith
#

ah yes i wan't

slate swan
#

Wan't

boreal ravine
#

Wan't

pale zenith
#

kyle wan't to get unbanned from dpy

tough wagon
#

maybe here someone?
table tags:

| ID | NAME      | CONTENT        |
+----+-----------+----------------+
| 1  | email     | bruh email     |
| 2  | gmail     | bruh gmail     |
| 3  | morth     | bruh morth     |
| 4  | gmail.com | bruh gmail.com |
| 5  | nomail    | bruh nomail    |
SELECT     tags.name
FROM       tags
WHERE      tags.name SMTH 'fmail'
LIMIT 3;```
I want this SMTH to be as LIKE operator but to it return:
```py
[ ['email'], ['gmail'], ['gmail.com'] ]```
Is there any way to do that?
slate swan
#

Wrong channel

pale zenith
boreal ravine
slate swan
tough wagon
#

😦

boreal ravine
slate swan
#

Poor guy πŸ˜‚πŸ˜‚

boreal ravine
#

i was immature at the time πŸ‘€

pale zenith
#

keyword wan't

boreal ravine
#

KeyError*

slate swan
#

πŸ˜‚

tough wagon
pale zenith
#

blobsweatsip idk databases pleadSad

slate swan
#

Idk SQL that good

boreal ravine
#

lol

pale zenith
#

goes back a thelping in #help bye guys pleadSad

slate swan
#

Bye goes back to sleep

#
                if utils.get(ctx.guild.text_channels, name="mod-logs"):

does this return a bool btw?

#

No

pale zenith
#

no but the comparison would work

slate swan
#

It returns the TextChannel object

pale zenith
#

it returns a discord.TextChannel

#

but it also returns None if not found so the If statement still applies

slate swan
#

ah I see, if it doesn't return the channel it returns None right

pale zenith
#

yep

slate swan
#

alright ty

pale zenith
#

:D

slate swan
#

I know how to create a role, does it apply the same thing with creating a text channel?

boreal ravine
#

yes

slate swan
#

ok ty

#

how do I send a message in another specific channel?

slate swan
boreal ravine
#

or discord.utils.get

slate swan
#
 raise MessageNotFound(argument)
discord.ext.commands.errors.MessageNotFound: Message "10s" not found.
#

I don't understand?

#

(check my code before assuming) idk what i'm doing wrong, can someone help me?

steep estuary
#

why i am getting guild ids in my console also there is no print for that ?

slate swan
#

Shows syntax error

soft radish
#

how can i make a eval command that really do what i said

#

for example i evaluate a role code, it'll role me

slate swan
#

how can I get the sent message ID?

slate swan
#

ok ty

#

but no no

#

i want the id of the authors message

#

o

#

so you can do

print(ctx.message.id)```

give it a try
slate swan
slate swan
#

πŸ˜„

#

ty!!

#

:D

slate swan
#

Shouldn't it be always in top

slate swan
#

but thanks for reply

#

I had added 1 less ')' bracket

#

Alr

spring flax
#

this is a support server so you can ask here. Use #databases for help with mongo DB.

slate swan
spring flax
slate swan
wanton cipher
#

I have a question, does anyone know how to find more of the <> discord things? Ik you can do <@id>, <#id>, <t:unix time stamp:R> but are there any more and how can I find them?

cloud folio
#

How can i check for two reactions?

#

The βœ… is working, but the ❌ is not

#

It's not doing any errors, it's just not working

slate swan
#

How to fetch user from id?

cloud folio
#

user = get(bot.get_all_members(), id="1234")
if user:
# found the user
else:
# Not found the user

#

or something like client.get_user(id)

cloud folio
spring flax
slate swan
#

fetch_user

#

or get_member

#

!d discord.ext.commands.Bot.fetch_user

unkempt canyonBOT
#

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

Retrieves a [`User`](https://discordpy.readthedocs.io/en/master/api.html#discord.User "discord.User") based on their ID. You do not have to share any guilds with the user to get this information, however many operations do require that you do.

Note

This method is an API call. If you have [`discord.Intents.members`](https://discordpy.readthedocs.io/en/master/api.html#discord.Intents.members "discord.Intents.members") and member cache enabled, consider [`get_user()`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.Bot.get_user "discord.ext.commands.Bot.get_user") instead.
slate swan
#

oh get_user also works

slate swan
#

and (str(reaction.emoji) == "checkmark_emoji" or str(reaction.emoji) == "X_emoji")

#

then use an if statement

cloud folio
#

cuz i don't know wdym

unkempt canyonBOT
#

Hey @inner pumice! I noticed you posted a seemingly valid Discord API token in your message and have removed your message. This means that your token has been compromised. Please change your token immediately at: https://discordapp.com/developers/applications/me

Feel free to re-post it with the token removed. If you believe this was a mistake, please let us know!

inner pumice
#

shit

#

i forgot lmao

cloud folio
#

you mean i should change this to "x_emoji"?

#

@slate swan

pallid harbor
#

I'm doing my discord bot in class and it seems like all ctx commands don't work. How can I fix this?

slate swan
spring flax
inner pumice
#

Hey so I've made plenty of bots before and i set this one up just as all the other with this code: ```py
import discord
from discord.ext import commands

client = commands.Bot(command_prefix='!', intents=discord.Intents().all(), help_command=None)

token = 'blabla'
client.run(token)```

but the deploy keeps on failing with this error and I don't know why ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output. ERROR: failed to build: exit status 1 ERROR: failed to build: executing lifecycle: failed with status code: 51

Any ideas?

slate swan
#

you should use the emoji

#

your check should pass, doesn't matter if it's a βœ… or an ❌

#

then you can check

if str(reaction.emoji) == "βœ…":
    #yes
else:
    #no
cloud folio
#

oh

#

so i should delete the try and check part

#

and just type this in?

slate swan
#

yes, change your check then check if it's a checkmark

#

return user == ctx.author and (str(reaction.emoji) == "βœ…" or str(reaction.emoji) == ":❌:")

cloud folio
#

but i want to do different things after different emojis

slate swan
#

use an if statement

wanton cipher
#

How do you make both of these tags?

cloud folio
#

so something like this?

slate swan
#

I spoonfeeded u

#

return user == ctx.author and (str(reaction.emoji) == "βœ…" or str(reaction.emoji) == "❌")

cloud folio
#

i need to use the if statement

slate swan
#

yes

cloud folio
#

so it will look like this?

slate swan
#

but not in the check

cloud folio
#

so where

slate swan
#

after the wait_for()

#

in the wait_for, you get every data

#

you can use the data right after

cloud folio
slate swan
#

exactly

cloud folio
#

ok

#

nice

#

thanks

slate swan
#

but in the second if, you replace idk with the X emoji

slate swan
#

and convert reaction.emoji to str

#

then it should work πŸ‘

wintry kernel
#

how do i get all the roles a person has in a server?

manic wing
wintry kernel
#

okay thank you

wintry kernel
unkempt canyonBOT
wintry kernel
#

ok

boreal ravine
#

you're gonna have to access the role's attrs to get what you want

wintry kernel
#

and how do i do that

#

@boreal ravine

boreal ravine
#

πŸ˜‚

manic wing
#

[k.name for k in member.roles]

boreal ravine
#

Imagine

wintry kernel
#
roles = member.roles```

this is how i defined roles btw
boreal ravine
#

ok coochie man

wintry kernel
#

im different

slate swan
#

how do I mention the channel name?

boreal ravine
#

<#ID>

#

or

#

!d discord.TextChannel.mention

unkempt canyonBOT
wintry kernel
manic wing
#

then you only have one role

wintry kernel
#

no

#

i have 4

boreal ravine
#

does it have role intents

wintry kernel
boreal ravine
#

fk

#

i think thats auto enabled

wintry kernel
#

so what do i do

#

@manic wing

boreal ravine
#

hm

#

u sure u have 4 roles

#

wait

#

@wintry kernel did u even loop

#

over your roles

wintry kernel
#

no i did not lmao

manic wing
#

did you print hmm inside the loop

#

or outside the loop

wintry kernel
#

outside

#

i want it in a sentence

#

lmfao i printed it outiside

#

is there a way i can print it outside and still get all roles

manic wing
#

#basicpython

wintry kernel
manic wing
#

jeeeeezus

wintry kernel
manic wing
#

thats what the list is...the starting member.roles is the list of all the roles - you've gone and made it more difficult

wintry kernel
#

but i wanted only the names

#

but it gave me the ids as well

manic wing
#

then print([k.name for k in member.roles])

#

it will print every role's name

wintry kernel
#

ight

manic wing
#

yes

#

it worked. I am right.

#

as always ;)

wintry kernel
#

a last question.. how do i remove the [] and ,

#

and how do i ping all the roles like it did for @everyone

manic wing
#

print('@'.join([k.name for k in member.roles]))

floral jacinth
#

how could i let the bot wait answer of a member on pm and store it into a var? (on pm)

undone wyvern
manic wing
floral jacinth
manic wing
#

that means that its a dm

#

!d discord.DMChannel

unkempt canyonBOT
#

class discord.DMChannel```
Represents a Discord direct message channel.

x == y Checks if two channels are equal.

x != y Checks if two channels are not equal.

hash(x) Returns the channel’s hash.

str(x) Returns a string representation of the channel
manic wing
#

and the check means that the on_message only reacts if it follows the checks; the on_message only triggers if the channel is an instance of discord.DMChannel, and if the message.author.id is equal to the member's id. Meaning that not everyone can just respond.

solemn ocean
#

i dont know if u can read it clearly but could anyone help?

manic wing
#

bruh

manic wing
#

embed = discord.Embed(color=discord.color.blue

manic wing
solemn ocean
#

somethings still wrong

#

oh wait i think i know what

manic wing
solemn ocean
#

yeah i checked the imports everything is there

#

i dont know what the bug id

manic wing
#

just a feeling i've got

#

like somethings about to happen....

floral jacinth
pallid harbor
#

why ctx commands doesn't works in class?

boreal ravine
manic wing
# floral jacinth sooooo i would ask i do not understand that `m.channel`

!d discord.Message.channel awesome - in the lambda (which is just like a one line function), it takes one argument - and that is m. You can call m whatever you want, but all m is, is the message. m is just discord.Message. You know how a def on_message(message) accepts message? So does the lambda. Maybe I shouldve renamed m to message. Also, instead of doing lambda you can do check=check and def check(message): return message.author.id == … # blah blah blah

unkempt canyonBOT
boreal ravine
#

pycharm moment

pallid harbor
#

python moment

boreal ravine
#

not python moment

#

its pycharm moment

#

since pycharm is a lot harder to use

pallid harbor
#

what ide should I use?

floral jacinth
# manic wing do you have any questions? I prefer explaining than spoonfeeding

second question, why m.author.id == member.id instead of m.author.id == ctx.author.id? i do not know where to get that member

from discord.ext import commands
import discord
from var import *

class admin(commands.Cog):
    def __init__(self, bot):
        self.bot = bot


    @commands.command()
    async def test(self, ctx):
        await ctx.author.send('Hello!') #where member is an instance of typing.Union[discord.User, discord.Member]
        message = await bot.wait_for('message', check=lambda m: isinstance(m.channel, discord.DMChannel) and m.author.id == member.id)

so i should use commands instead of bot, but i do not know how to catch that member

boreal ravine
#

personally VSC or sublime

boreal ravine
#

m is short of message

#

m.author.id == member.id checks if the author is equal to a member

pallid harbor
floral jacinth
slate swan
#

If we follow a channel in a server if the message in that channel deleted does it deleted automatically in our channel

floral jacinth
#

i need to do for of guild.members and get the id in a var?

manic wing
undone wyvern
boreal ravine
undone wyvern
#

Like async def test(self, ctx: commands.Context, *args, **kwargs):

pallid harbor
#

the bot starts, but all commands and activity status do not work

solemn ocean
#

async

#

is it for command

solemn ocean
boreal ravine
#

takes a lot of time

#

to update imports

manic wing
#

just use visual studio code like a normal person logo_vscode

boreal ravine
#

imagine being normal

pallid harbor
#

I downloaded vsc, but the bot doesn't work now

solemn ocean
#

i really only use vsc for js json and html

boreal ravine
#

i use vsc for my dopamine

#

πŸ™‚

slate swan
#

How to check if mentioned user's top role is lower or higher than author's top role??

unkempt canyonBOT
#

property top_role: Role```
Returns the member’s highest role.

This is useful for figuring where a member stands in the role hierarchy chain.
boreal ravine
#

^

#

use ctx.author for the author

slate swan
#

I triedpy if user.top_role >= ctx.author.top_role: print("Nope")

placid skiff
#

That should work

inner pumice
#

when adding a field to an embed is there a way to not have a name value

slate swan
# placid skiff That should work

discord.ext.commands.errors.CommandInvokeError: Command raised an exception: AttributeError: 'NoneType' object has no attribute 'top_role'

inner pumice
#

if you dont want a title for that field

boreal ravine
#

python has no >= only > and <

placid skiff
placid skiff
placid skiff
#

!e

if 10 >=10:
    print(True)
unkempt canyonBOT
#

@placid skiff :white_check_mark: Your eval job has completed with return code 0.

True
slate swan
#

i have

boreal ravine
#

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

placid skiff
# slate swan i have

Your user in your code is not a user object for some reason, paste the code here, let's check

boreal ravine
#

@slate swan

slate swan
#
@client.command()
async def welcome(ctx, user:discord.Member=None):
    if ctx.author.guild_permissions.manage_messages:
        if user is None:
            await ctx.reply("Woah, how can you think of welcoming no one?")
        if user==ctx.author:
            await ctx.reply("You cannot welcome yourself...")
        elif user==ctx.author or user.top_role >= ctx.author:
            await ctx.reply("Bruh, you cannot welcome someone who is already in such a high rank!")
        else:
            await ctx.message.delete()
            for role in user.role:
                    if role.id==698500675306258452:
                        await user.remove_roles(role)
                        initiate_role=ctx.guild.get_role(698500328169013258)
                        await user.add_roles(initiate_role)
                        await user.send_message(f'You have been promoted in {ctx.guild.name}!')
                        await ctx.channel.send(str(welcome.replace("(userhere)", f"{user.mention}")))
                    else:
                        if ((datetime.now() - user.joined_at.strftime("%m/%d/%Y, %H:%M:%S")).total_seconds)<=60:
                            initiate_role=ctx.guild.get_role(698500328169013258)
                            await user.add_roles(initiate_role)
                            await user.send_message(f'You have been promoted in {ctx.guild.name}!')
                            await ctx.channel.send(str(welcome.replace("(userhere)", f"{user.mention}")))
                        else:
                            ctx.reply("That user was already in the server!")```
boreal ravine
#

what did u define user as

#

oh

boreal ravine
slate swan
#

I have

boreal ravine
#

does the user

#

have roles..?

slate swan
#

Yup

placid skiff
#

If the ide tells you that is a None object is because or you haven't pass an argument in your command or the typehinting can't convert the string you pass into an user object

slate swan
#

Its just an if.......else statement

#

maybe..

#

I just found it on replit log

boreal ravine
#

lol

#

@slate swan

#

u sure u have intents

slate swan
#

I have intents

placid skiff
slate swan
#
intents = discord.Intents.default()
intents.members=True```
placid skiff
#

Essentially is equals to None

boreal ravine
#

did u mention

#

a member

slate swan
#

yup

#

ok lets skip that error

placid skiff
slate swan
#

it doesnt affect my program at all

#

new error came

placid skiff
#

And follow up the user variable

slate swan
#
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: TypeError: '>=' not supported between instances of 'Role' and 'Member'```
slate swan
placid skiff
#

You are comparing a role to a member

slate swan
#

Hmm I did a quick fix

#

let me try again

pallid harbor
#

thanks

slate swan
#

When I pinged the bot itself, it gave this error: raise CommandInvokeError(exc) from exc discord.ext.commands.errors.CommandInvokeError: Command raised an exception: AttributeError: 'Member' object has no attribute 'role'

slate swan
# slate swan Code
@client.command()
async def welcome(ctx, user:discord.Member=None):
    if ctx.author.guild_permissions.manage_messages:
        if user is None:
            await ctx.reply("Woah, how can you think of welcoming no one?")
        elif user==ctx.author:
            await ctx.reply("You cannot welcome yourself")
        elif user.top_role >= ctx.author.top_role:
            await ctx.reply("Bruh, you cannot welcome someone who is already in such a high rank")
        else:
            await ctx.message.delete()
            for role in user.role:
                    if role.id==698500675306258452:
                        await user.remove_roles(role)
                        initiate_role=ctx.guild.get_role(698500328169013258)
                        await user.add_roles(initiate_role)
                        await user.send_message(f'You have been promoted in {ctx.guild.name}')
                        await ctx.channel.send(str(welcome.replace("(userhere)", f"{user.mention}")))
                    else:
                        if ((datetime.now() - user.joined_at.strftime("%m/%d/%Y, %H:%M:%S")).total_seconds)<=60:
                            await ctx.message.delete()
                            initiate_role=ctx.guild.get_role(698500328169013258)
                            await user.add_roles(initiate_role)
                            await user.send_message(f'You have been promoted in {ctx.guild.name}')
                            await ctx.channel.send(str(welcome.replace("(userhere)", f"{user.mention}")))
                        else:
                            ctx.reply("That user was already in the server")```
#

member.roles if you trying to get someone roles (list)

boreal ravine
pallid harbor
#

Already fixed

boreal ravine
#

ah ok πŸ‘

pallid harbor
#

Self parameter is for Cogs

#

just removed it everywhere

slate swan
slate swan
placid skiff
boreal ravine
#

cogs are subclassed classes

slate swan
pallid harbor
#

The most important thing is that everything works blobgrimacing

slate swan
#

πŸ‘

boreal ravine
#

!e

class a:
  def __init__(self, bot):
    self.bot=bot
  def im_cool(self):
    return "im cool"
print(a("kayle").im_cool())
``` 😎
unkempt canyonBOT
#

@boreal ravine :white_check_mark: Your eval job has completed with return code 0.

im cool
pallid harbor
#

slash commands doesn't works now

reef shell
#

not in dpy

boreal ravine
pallid harbor
#

Can I pm you with code?

inner pumice
#

so im making an on ready event with a new bot and I want it to tell me the number of the session, e.g "Session 1" then next tme "Session 2" etc.

#

how could I go about that

#

could I make something that adds to the last number mentioned

#

or what

boreal ravine
inner pumice
#

basically each time the console is run, it adds 1 to the last number

#

there must be a module or smth

#

to check when the console runs

slate swan
#

on every on_ready event

inner pumice
#

ok ill have a look

#

not used much db or json before lol

#

ill have to do some learning

#

but thanks for the idea

slate swan
#

json easy pz , or even a txt file will for your purpose

inner pumice
#

tru

undone wyvern
boreal ravine
cloud folio
#

Hi, if have this in my code, the commands won't work. Why and how can i solve it?

slate swan
#

@quaint axle.listen()

inner pumice
#

then the commands will work

cloud folio
#

like this?

slate swan
#

()

#

and you don't need process commands

cloud folio
slate swan
#

if you use listen()

inner pumice
inner pumice
#

because otherwise as he said commands wont work

slate swan
#

if he uses listen, then no

inner pumice
#

well instead of changing everything to listen() then he can just use what i said

slate swan
#

he doesn't have to change everything

#

just on_message

cloud folio
#

nice

#

working

slate swan
#

.

cloud folio
slate swan
#

just at on_message

cloud folio
#

i want to use cmds

#

thanks a lot

slate swan
#

you're welcome

slate swan
#

actually here it's better

#

how do I mention the channel name?

tawdry perch
slate swan
#

<#id>

final shard
#

How do we make .env's?

#

I made one but i get error

cloud dawn
final shard
#

i just made a file called .env directly though

cloud dawn
#

Then you should be good

#

Error?

final shard
#

should i import something

#

i imported os and dotenv

#

and to hide the token i:

cloud dawn
#

No that's all you need but i still don't have an error.

final shard
#
bot.token(os.getenv('TOKEN'))
boreal ravine
#

why dont ppl just create a file then import it from file import variable then bot.run(variable)

final shard
#

idk

cloud dawn
boreal ravine
final shard
#

never heard of it

boreal ravine
final shard
#

import variable

cloud dawn
final shard
#

the error says 'strip' is not found

#

idk what that means

cloud dawn
#

.env is a default gitignore.

boreal ravine
#

hm

cloud dawn
final shard
cloud dawn
#

!traceback

unkempt canyonBOT
#

Please provide the full traceback for your exception in order to help us identify your issue.

A full traceback could look like:

Traceback (most recent call last):
    File "tiny", line 3, in
        do_something()
    File "tiny", line 2, in do_something
        a = 6 / b
ZeroDivisionError: division by zero

The best way to read your traceback is bottom to top.

β€’ Identify the exception raised (in this case ZeroDivisionError)
β€’ Make note of the line number (in this case 2), and navigate there in your program.
β€’ Try to understand why the error occurred (in this case because b is 0).

To read more about exceptions and errors, please refer to the PyDis Wiki or the official Python tutorial.

final shard
#

ill try rn

#

slow laptop

cloud dawn
#

Oh

boreal ravine
#

the file wasnt loaded Ig

final shard
#

i'll send a ss

boreal ravine
#

hm

tough wagon
#
    def get_tag(self, guild_id: int, name):
        def disambiguate(rows):
            if rows is None or len(rows) == 0:
                return 'Did not found anything.'

            return '\n'.join(ro[0] for ro in rows)

        t = self.bot.database.fetchall('SELECT user_id, name, descr FROM tags WHERE guild_id = %s AND name = %s',
                                       (guild_id, name))
        if len(t) == 0:
            query = """SELECT     tags.name
                       FROM       tags
                       WHERE      tags.guild_id=%s AND tags.name LIKE %s;
                    """
            r = self.bot.database.fetchall(query, (guild_id, name))
            return disambiguate(r)

        return t[0]```
always returning `Did not found anything.` if tag with `name` not exists, any way to fix?
boreal ravine
slate swan
#

What am i supposed to put here bc i got an errorti na valw edw gia na mhn bgazei to error

@bot.event
async def on_message(message , *, ctx):
#

on_message takes only 1 arg and that is message

#

remove * and ctx

slate swan
boreal ravine
#

make commands

#

xD

slate swan
#

so ? message has a guild attribute as well

boreal ravine
#

^

slate swan
#
 e=discord.Embed(title=f' :ticket: | Server : {message.guild.name}')
 e.set_thumbnail(url=f'{message.guild.icon_url}')

like this?

#

sure , but are trying to make a command?

#

no

#

logs

#

ohok , so yeah message.guild is the thing

#

how do you DM a user who reacts to a role without using ctx?

#

eh

slate swan
slate swan
#

wdym

#

oh

#

a listener

#

mhm , on_reaction_add takes a user arg

#

you can use user.send(

#

!d discord.on_reaction_add

unkempt canyonBOT
#

discord.on_reaction_add(reaction, user)```
Called when a message has a reaction added to it. Similar to [`on_message_edit()`](https://discordpy.readthedocs.io/en/master/api.html#discord.on_message_edit "discord.on_message_edit"), if the message is not found in the internal message cache, then this event will not be called. Consider using [`on_raw_reaction_add()`](https://discordpy.readthedocs.io/en/master/api.html#discord.on_raw_reaction_add "discord.on_raw_reaction_add") instead.

Note

To get the [`Message`](https://discordpy.readthedocs.io/en/master/api.html#discord.Message "discord.Message") being reacted, access it via [`Reaction.message`](https://discordpy.readthedocs.io/en/master/api.html#discord.Reaction.message "discord.Reaction.message").

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

Note

This doesn’t require [`Intents.members`](https://discordpy.readthedocs.io/en/master/api.html#discord.Intents.members "discord.Intents.members") within a guild context, but due to Discord not providing updated user information in a direct message it’s required for direct messages to receive this event. Consider using [`on_raw_reaction_add()`](https://discordpy.readthedocs.io/en/master/api.html#discord.on_raw_reaction_add "discord.on_raw_reaction_add") if you need this and do not otherwise want to enable the members intent.
slate swan
#

would i use payload.author or payload.member

#

are you using the raw event?

#

( raw_reaction_add)

cloud dawn
#

The way reactions are meant to be made.

slate swan
#

it would be payload.member

cloud dawn
#

no payload.user member does not exist

#
user (Union[Member, User]) – The user who added the reaction.
slate swan
#

yeah raw

cloud dawn
#

It's a union.

final shard
slate swan
#

so payload.user?

cloud dawn
slate swan
slate swan
cloud dawn
final shard
final shard
cloud dawn
slate swan
cloud dawn
slate swan
#

oh alright

vagrant brook
slate swan
#

they already told twice

cloud dawn
final shard
#

Wait I think I should not add a ' around the word

unkempt canyonBOT
slate swan
#

where am i going wrong, no errors just nothing happens

spring flax
#

why are you making your bot instance in the cog also?

slate swan
#

you could have just used and in the conditions

#

also raw_reaction_add takes only payload as an argument

final shard
#

I don't know how to load a .env file now..

slate swan
final shard
final shard
slate swan
final shard
#

i made the env file again

#

yet the error happens again

slate swan
final shard
slate swan
#

yes

final shard
#

I just started in VSCode after using replit thats why the file is small.

#

lmao what

tough wagon
slate swan
#

How can I get all the messages in a channel?

dusk pumice
#

How can I create category with bot???
Does anyone knows it?

tough wagon
tawdry perch
slate swan
#

it has nothing to do with dpy

tawdry perch
#

Len has no use afaik

boreal ravine
#

not related to discord bots

tough wagon
boreal ravine
#

idrk

tough wagon
tawdry perch
#

And you alrd check it without len

tough wagon
#

bruh... anyway that didnt help

tawdry perch
#

Is there anything to return?

tough wagon
#

yes

maiden fable
unkempt canyonBOT
#

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

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

Note

The `category` parameter is not supported in this function since categories cannot have categories.
tough wagon
#

name was fmail there are entries: mail, email, gmail @tawdry perch

#

in db

green jacinth
#
  if isinstance(error, [what to put here] ):
    await ctx.send("You are not connected to any voice channel")```
can anyone tell how to send error when user is not connected to voicechannel
with discord.py
tough wagon
#

!d discord.Member.voice

unkempt canyonBOT
#

property voice: Optional[discord.member.VoiceState]```
Returns the member’s current voice state.
tough wagon
#

if none: send

slate swan
#

How can I find a specific message sent in a text channel?

tawdry perch
green jacinth
#

ok

maiden fable
unkempt canyonBOT
#

async for ... in history(*, limit=100, before=None, after=None, around=None, oldest_first=None)```
Returns an [`AsyncIterator`](https://discordpy.readthedocs.io/en/master/api.html#discord.AsyncIterator "discord.AsyncIterator") that enables receiving the destination’s message history.

You must have [`read_message_history`](https://discordpy.readthedocs.io/en/master/api.html#discord.Permissions.read_message_history "discord.Permissions.read_message_history") permissions to use this.

Examples

Usage...
tawdry perch
#

@tough wagon try printin the rows tho

slate swan
cloud dawn
slate swan
tough wagon
maiden fable
dusk pumice
tawdry perch
slate swan
tough wagon
#

if i print all rows of db of course it will return rows

tawdry perch
#

I give up

green jacinth
tawdry perch
#

I don't have time for this

maiden fable
green jacinth
#

please

#

tell like can your put it and show

dusk pumice
slate swan
#

Why when i am using this none of the commands are working?

@bot.event
async def on_message(message):
  if '>help' in message.content:
    comm_lg = bot.get_channel(903980815212503091)
    command_logs = bot.get_channel(903980815212503091)
    await comm_lg.send(f"{message.author.mention}")
    e=discord.Embed(title=f':members: | User : {message.author.name}#{message.author.discriminator}', description=f' **:ticket: | Id : {message.author.id}**', timestamp=message.created_at)
    e.set_author(name=f'  | {message.guild.name}', icon_url=f'{message.guild.icon_url}')
    await command_logs.send(embed=e)
tough wagon
#
@command(name="bruh")
async def _bruh(ctx, *, member: discord.Member):
    if member.voice is None:
        await ctx.reply('this member not connected to voice channel bruh')``` @green jacinth
green jacinth
#

cant it be in if isinstance

cloud dawn
tough wagon
#

ok if isinstance(member.voice, None): @green jacinth

green jacinth
#
@play.error
async def mojkardi_error(self, ctx, error):
  if isinstance(error, commands.CommandOnCooldown):
    await ctx.send("You are on cooldown!")
if isinstance(member.voice, None):
  await ctx.send("You Must JOin vc") ```
#

this is the one i want to add it for voice tracing

tough wagon
#

first - @play.error

tough wagon
#

put my code IN COMMAND

#

not in error handler

green jacinth
tough wagon
green jacinth
green jacinth
tough wagon
#

idk, if you have ctx.author then do if ctx.author.voice is None:

#

i sent an example

green jacinth
#
@bot.command()
@commands.cooldown(1, 10, commands.BucketType.user)
if ctx.author.voice is None:
  await ctx.reply('You are not connected to any voice channel!')
  return
async def wetfart(ctx):
  voice_player = await ctx.message.author.voice.channel.connect()
  print("Releasing Wet Fart")
  rahalog = bot.get_channel(903976956842868736)
  await rahalog.send("`Releasing Wet Fart`")
  await ctx.send("> Releasing Wet Fart")
  voice_player.play(discord.FFmpegPCMAudio("wet-fart.mp3"))
  await asyncio.sleep(3)
  await ctx.voice_client.disconnect()

@wetfart.error
async def mojkardi_error(self, ctx, error):
  if isinstance(error, commands.CommandOnCooldown):
    await ctx.send("You are on cooldown!")```
#

the real code

#

xd

green jacinth
tough wagon
#

ctx.message.author

#

you are clever

green jacinth
cloud dawn
#

ctx.author is enough.

tough wagon
tough wagon
slate swan
#
        if utils.get(ctx.guild.text_channels, name="mod-logs"):
            channel_history = utils.get(ctx.guild.text_channels, name="mod-logs")
            async for messages in channel_history.history():
                print(messages)
        else:
            pass
#

this is what I have now

#

messages doesn't return anything about that content

maiden fable
#

messages is a discord.Message object

#

!d discord.Message

unkempt canyonBOT
#

class discord.Message```
Represents a message from Discord.

x == y Checks if two messages are equal.

x != y Checks if two messages are not equal.

hash(x) Returns the message’s hash.
slate swan
#

So?

manic wing
cloud dawn
tough wagon
#

messages.content @slate swan

maiden fable
cloud dawn
#

Lol

slate swan
manic wing
#

@pliant gulch why would there be a case where you use event not listen? Whats the difference between bot.event and bot.listen()

maiden fable
#

Breh

slate swan
green jacinth
# tough wagon put ```py if ctx.author.voice is None: await ctx.reply('You are not connected ...
@bot.command()
@commands.cooldown(1, 10, commands.BucketType.user)
async def wetfart(ctx):
if ctx.author.voice is None:
  await ctx.reply('You are not connected to any voice channel!')
  return
  voice_player = await ctx.message.author.voice.channel.connect()
  print("Releasing Wet Fart")
  rahalog = bot.get_channel(903976956842868736)
  await rahalog.send("`Releasing Wet Fart`")
  await ctx.send("> Releasing Wet Fart")
  voice_player.play(discord.FFmpegPCMAudio("wet-fart.mp3"))
  await asyncio.sleep(3)
  await ctx.voice_client.disconnect()


@wetfart.error
async def mojkardi_error(self, ctx, error):
  if isinstance(error, commands.CommandOnCooldown):
    await ctx.send("You are on cooldown!")```

like this
slate swan
#

What is the command called when u wanna check the history of a members punishments(mute, kicks, warns) etc?

slate swan
#

like what do I name my command?

cloud dawn
green jacinth
tough wagon
#

!tag learn python

green jacinth
#

-_-

green jacinth
slate swan
cloud dawn
tough wagon
slate swan
#

or what is it called?

tough wagon
green jacinth
tough wagon
#

4..

green jacinth
cloud dawn
tough wagon
#

@cloud dawn if what I do is spoonfeeding then there's the only way right (send lpypls)?

tough wagon
slate swan
cloud dawn
green jacinth
green jacinth
#

leemi test

cloud dawn
tough wagon
#

lemaoIndentationError

slate swan
green jacinth
#

xd

cloud dawn
tough wagon
#

learn py

slate swan
green jacinth
#

i may learn from it only

#

it will help

#

-_-

tough wagon
#

tabs required

green jacinth
#

?

#

fixed

#

-_- my self

tough wagon
#

you are in a function (async def wetfart(ctx):), everything in this function should be as usual code but with tab before it in every line
Like see:
not in function

do_something('yes', 'no')```
in function
```py
  do_something('yes', 'no')```
#

this is the basic of python syntax

#

bruh

green jacinth
#

sir

cloud dawn
# green jacinth -_- my self

It's not that we don't want to help, it's that at this point we would basically code it for you. And most people here are not going to do that for you.

unkempt canyonBOT
#

Hey @green jacinth!

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

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

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

https://paste.pythondiscord.com

slate swan
green jacinth
green jacinth
slate swan
#

Ye

green jacinth
#

;-;

green jacinth
cloud dawn
#

!indention

unkempt canyonBOT
#

Indentation

Indentation is leading whitespace (spaces and tabs) at the beginning of a line of code. In the case of Python, they are used to determine the grouping of statements.

Spaces should be preferred over tabs. To be clear, this is in reference to the character itself, not the keys on a keyboard. Your editor/IDE should be configured to insert spaces when the TAB key is pressed. The amount of spaces should be a multiple of 4, except optionally in the case of continuation lines.

Example

def foo():
    bar = 'baz'  # indented one level
    if bar == 'baz':
        print('ham')  # indented two levels
    return bar  # indented one level

The first line is not indented. The next two lines are indented to be inside of the function definition. They will only run when the function is called. The fourth line is indented to be inside the if statement, and will only run if the if statement evaluates to True. The fifth and last line is like the 2nd and 3rd and will always run when the function is called. It effectively closes the if statement above as no more lines can be inside the if statement below that line.

Indentation is used after:
1. Compound statements (eg. if, while, for, try, with, def, class, and their counterparts)
2. Continuation lines

More Info
1. Indentation style guide
2. Tabs or Spaces?
3. Official docs on indentation

green jacinth
#

huh

visual island
#

you dont need self outside classes

cloud dawn
green jacinth
cloud dawn
green jacinth
#
@bot.command()
@commands.cooldown(1, 10, commands.BucketType.user)
async def wetfart(ctx):
  if ctx.author.voice is None:
    await ctx.reply('You are not connected to any voice channel!')
  return
  voice_player = await ctx.message.author.voice.channel.connect()
  print("Releasing Wet Fart")
  rahalog = bot.get_channel(903976956842868736)
  await rahalog.send("`Releasing Wet Fart`")
  await ctx.send("> Releasing Wet Fart")
  voice_player.play(discord.FFmpegPCMAudio("wet-fart.mp3"))
  await asyncio.sleep(3)
  await ctx.voice_client.disconnect()```
vast jolt
#

i want a bot event like this can anyone make me one

green jacinth
#
if ctx.author.voice is None:
    await ctx.reply('You are not connected to any voice channel!')
  return```
#

here is prb

visual island
#

the return is kinda.. odd

visual island
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.
green jacinth
slate swan
vast jolt
#

i mean wehn the bot joins a server yk

visual island
green jacinth
#
@bot.command()
@commands.cooldown(1, 10, commands.BucketType.user)
async def wetfart(ctx):
  voice_player = await ctx.message.author.voice.channel.connect()
  print("Releasing Wet Fart")
  rahalog = bot.get_channel(903976956842868736)
  await rahalog.send("`Releasing Wet Fart`")
  await ctx.send("> Releasing Wet Fart")
  voice_player.play(discord.FFmpegPCMAudio("wet-fart.mp3"))
  await asyncio.sleep(3)
  await ctx.voice_client.disconnect()


@wetfart.error
async def wetfart_error( ctx, error):
  if isinstance(error, commands.CommandOnCooldown):
    await ctx.send("You are on cooldown!")```
and i want to inplement it in this
slate swan
cloud dawn
green jacinth
#

idk how to put actually

vast jolt
cloud dawn
green jacinth
#

i wanted to go with

if isinstance(error, [ liek here ]):

green jacinth
cloud dawn
vast jolt
#

ok

green jacinth
#

@visual island could you tell ?

cloud dawn
green jacinth
#

and it is not sending that u must be conneceted to a voice channel

cloud dawn
slate swan
#

Hol on do i need database for shards?

cloud dawn
tough wagon
#

||I just want to spoonfeed eIeIEe||

green jacinth
#
@bot.command()
@commands.cooldown(1, 10, commands.BucketType.user)
async def wetfart(ctx):
  if ctx.author.voice is None:
    await ctx.reply('You are not connected to any voice channel!')
  return
  voice_player = await ctx.message.author.voice.channel.connect()
  print("Releasing Wet Fart")
  rahalog = bot.get_channel(903976956842868736)
  await rahalog.send("`Releasing Wet Fart`")
  await ctx.send("> Releasing Wet Fart")
  voice_player.play(discord.FFmpegPCMAudio("wet-fart.mp3"))
  await asyncio.sleep(3)
  await ctx.voice_client.disconnect()```
cloud dawn
slate swan
#

Is there something like async class?

green jacinth
slate swan
cloud dawn
visual island
slate swan
#

geez

#

I have this code:

class Interactor:
  global connection, mode
  # lambda m: m.content == "" and m.channel == connection

  def connect(modearg):
    connection_guild = bot.get_guild(interact_url)
    connection = discord.utils.get(connection_guild.channels, name='api')
    mode = modearg
    if mode == 1:
      await connection.send('--connect')
      return True
    else:
      return False

As you know, await connection.send won't work because it's not in an async function, however I still wanna use it somehow. Any way I can get around this?

#

async def

green jacinth
slate swan
#
channel = utils.get(ctx.guild.text_channels, name="mod-logs")
async for message in channel.history():


async for message in channel:
TypeError: 'async for' requires an object with aiter method, got TextChannel

Help?

cloud dawn
# slate swan 90

Okay first of all, you need autoshardedbot instead of bot as the instance and you'd need atleast have around 2000 guilds in order to shard.

slate swan
slate swan
#

async def functionName

#

which ic connect for you

green jacinth
#

now no error nor any reply

slate swan
unkempt canyonBOT
#

asyncio.create_task(coro, *, name=None)```
Wrap the *coro* [coroutine](https://docs.python.org/3/library/asyncio-task.html#coroutine) into a [`Task`](https://docs.python.org/3/library/asyncio-task.html#asyncio.Task "asyncio.Task") and schedule its execution. Return the Task object.

If *name* is not `None`, it is set as the name of the task using [`Task.set_name()`](https://docs.python.org/3/library/asyncio-task.html#asyncio.Task.set_name "asyncio.Task.set_name").

The task is executed in the loop returned by [`get_running_loop()`](https://docs.python.org/3/library/asyncio-eventloop.html#asyncio.get_running_loop "asyncio.get_running_loop"), [`RuntimeError`](https://docs.python.org/3/library/exceptions.html#RuntimeError "RuntimeError") is raised if there is no running loop in current thread.

This function has been **added in Python 3.7**. Prior to Python 3.7, the low-level [`asyncio.ensure_future()`](https://docs.python.org/3/library/asyncio-future.html#asyncio.ensure_future "asyncio.ensure_future") function can be used instead...
green jacinth
#

fixed it myslef -_-

green jacinth
#

after running it 2-3 times

slate swan
green jacinth
#

i learned a new thing ;-;

#

now i will remember it

slate swan
tough wagon
green jacinth
#

@cloud dawn -_-

slate swan
#

but why isn't it working

slate swan
green jacinth
tough wagon
green jacinth
#

that what i need to put then i used my brain

#

and implemented it

cloud dawn
visual island
slate swan
green jacinth
visual island
slate swan
slate swan
slate swan
#

damn

#

Still doesn't work

#
            if utils.get(ctx.guild.text_channels, name="mod-logs"):
                channel = utils.get(ctx.guild.text_channels, name="mod-logs")
                async for message in channel.history(limit=None):
                    print(message.content)

This returns literally 🌟 nothing 🌟

cloud dawn
tough wagon
#

then there is no channel names mod-logs @slate swan

#

try print(utils.get(ctx.guild.text_channels, name="mod-logs")) before that if

slate swan
slate swan
#

it doesn't get the messages tho

cloud dawn
green jacinth
slate swan
tough wagon
tough wagon
slate swan
cloud dawn
tough wagon
#

Cogs, HelpCommand, database, Groups, basics of python, Views (2.0)

cloud dawn
#

Autosharding, IPC routes, OOP, Subclassing, async programming

slate swan
tough wagon
#

it's python

visual island
cloud dawn
slate swan
#

OOP itself isn't about d.py however

cloud dawn
#

Cogs?

tough wagon
slate swan
slate swan
cloud dawn
visual island
#

try changing it to 100 and see if it makes a difference

slate swan
tough wagon
cloud dawn
# slate swan I guess you're right

The thing is this library is also well documented so i wouldn't be surprised for someone to make an advanced bot in even 2 months if they spend ca 6 hours a day on it.

slate swan
#
@bot.command(ctx, member:discord.Member=None):
async def info(ctx):
 embed=discord.Embed(title="Cursex", description="Identifitcation Card", color = 0x5865f2)
 embed.add_field(name="User's name:", value=f"{member.name}")
 embed.add_field(name="User's tag:", value=f"{user.discriminator}")
 await ctx.send(embed=embed)
``` what did i do wrong
tough wagon
#

args

#

the function takes them

#

not @bot.command()

cloud dawn
#

bot.command only takes keyword arguments.

slate swan
#

i still need help

tough wagon
#

with what

slate swan
slate swan
tough wagon
unkempt canyonBOT
slate swan
#

thats why i did a async for message in channel.history()

tough wagon
slate swan
#

you can with the way I did

magic stump
#

Ignoring exception in on_message Traceback (most recent call last): File "C:\Users\Uzytkownik\AppData\Local\Programs\Python\Python38\lib\site-packages\discord\client.py", line 343, in _run_event await coro(*args, **kwargs) File "c:/Users/Uzytkownik/Desktop/Dawid Orginalny/Python/avexy veryfi/main.py", line 39, in on_message await message.author.send(embed=embed1) File "C:\Users\Uzytkownik\AppData\Local\Programs\Python\Python38\lib\site-packages\discord\abc.py", line 1013, in send channel = await self._get_channel() File "C:\Users\Uzytkownik\AppData\Local\Programs\Python\Python38\lib\site-packages\discord\member.py", line 299, in _get_channel ch = await self.create_dm() File "C:\Users\Uzytkownik\AppData\Local\Programs\Python\Python38\lib\site-packages\discord\member.py", line 142, in general return await getattr(self._user, x)(*args, **kwargs) AttributeError: 'ClientUser' object has no attribute 'create_dm' ```py
@client.event
async def on_member_join(member):

global hasloo


haslo = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'

haslo2 = 5

hasloo = "".join(random.sample(haslo,haslo2))

id_channel = int(828011225292079124)


await client.get_channel(id_channel).send(f"**{member.name}, uΕΌyj komendy** `!verify (kod)`\n**TwΓ³j kod weryfikacyjny to** \n`{hasloo}`")

@client.command()
async def verifyy(ctx, kod):
global hasloo
if hasloo == kod:
print("Śmiga")
else:
print("ŚSSSSSa")``` why bot create dm?

tough wagon
#

if you want to get content of each message then:

for message in messages:
    print(message.content)```
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.

slate swan
#

exactly^ ty

magic stump
slate swan
cloud dawn
slate swan
#

how could i make a discord bot that locks certain emojis to certain roles?

#
        if member:
            print(member.id)
            if utils.get(ctx.guild.text_channels, name="mod-logs"):
                print("before")
                channel = utils.get(ctx.guild.text_channels, name="mod-logs")
                print(channel)
                messages = await channel.history(limit=None).flatten()
                for message in messages:
                    print(message.content)
            else:
                print("not working")
        else:
            await ctx.send(":x: You need to provide a member!")
#

???

magic stump
tough wagon
#

try to learn walking docs. it is:

await ctx.author.voice.channel.connect()```
cloud dawn
#

Were not allowed to hep you regarding this matter.

#

!rule 5

unkempt canyonBOT
#

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

brave flint
tough wagon
slate swan
#
471284463893086209
before
mod-logs

this and nothing else

tough wagon
slate swan
slate swan
# visual island basically runs a coroutine without awaiting it

doesn't work

def connect(modearg):
    connection_guild = bot.get_guild(interact_url)
    connection = discord.utils.get(connection_guild.channels, name='api')
    mode = modearg
    if mode == 1:
      bot.loop.create_task(connection.send('--connect'))
      return True
    else:
      return False
slate swan
tough wagon
#

!d discord.message.Message

unkempt canyonBOT
#

class discord.Message```
Represents a message from Discord.

x == y Checks if two messages are equal.

x != y Checks if two messages are not equal.

hash(x) Returns the message’s hash.
slate swan
#

?