#discord-bots

1 messages · Page 1119 of 1

slate swan
#

specify the what?

paper sluice
#

constructor is for classes not functions....

slate swan
#

and what is that argument naming

slate swan
#

why am riding consturctor as destruct 😭

#

reading*

sage otter
#

Riding

sage otter
#

sounds kinda Sus. Why are you riding constructor

#

Enough of that.

slate swan
#

😳😳😳😳😳

#

still waiting for the adminslemon_sentimentallemon_thinking

sage otter
#

same. this is where i get banned.

slate swan
sage otter
#

Well anyway.

slate swan
sage otter
#

Okimii, how’s your wrapper going

slate swan
#

which

#

one

sage otter
sage otter
slate swan
paper sluice
#

i stopped learning rust, now im watching random yt vids

slate swan
#

how do i set permission for a certain user on a channel

#

good video

paper sluice
slate swan
sage otter
#

!d discord.TextChannel.set_permissions

unkempt canyonBOT
#

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

Sets the channel specific permission overwrites for a target in the channel.

The `target` parameter should either be a [`Member`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Member "discord.Member") or a [`Role`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Role "discord.Role") that belongs to guild.

The `overwrite` parameter, if given, must either be `None` or [`PermissionOverwrite`](https://discordpy.readthedocs.io/en/latest/api.html#discord.PermissionOverwrite "discord.PermissionOverwrite"). For convenience, you can pass in keyword arguments denoting [`Permissions`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Permissions "discord.Permissions") attributes. If this is done, then you cannot mix the keyword arguments with the `overwrite` parameter.

If the `overwrite` parameter is `None`, then the permission overwrites are deleted.

You must have the [`manage_roles`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Permissions.manage_roles "discord.Permissions.manage_roles") permission to use this...
sage otter
#

@slate swan ^

slate swan
#

now i need to get all channels in a category

sage otter
#

!d discord.CategoryChannel.channels

unkempt canyonBOT
#

property channels```
Returns the channels that are under this category.

These are sorted by the official Discord UI, which places voice channels below the text channels.
sage otter
#

I struggle so hard with these.

wild spoke
#

Hello

#

Can anybody provide example of mute-tempmute command code please?

#

I can't figure out how to add duration

still swan
#

I installed discord.py directly from github without using pip, is it okay? and thx <33

slow epoch
spice adder
#

Is there a way to check how many messages a user has posted that contain images/videos?

vale wing
# wild spoke Can anybody provide example of mute-tempmute command code please?

For timeout

from datetime import datetime, timedelta

await member.timeout(duration=timedelta(hours=3))
# for until
await member.timeout(until=datetime(...)) # you need to construct the datetime object or get it somehow```
This does not work on dpy 1.7 in case you are using it.

If you asked for concrete temporal mute with assigning role that's more complicated
unkempt canyonBOT
#

Hey @mellow mauve!

You either uploaded a .txt file or entered a message that was too long. Please use our paste bin instead.

vale wing
unkempt canyonBOT
slate swan
wild spoke
vale wing
#

Eh alright

#

So you gotta make a database in which you will store the unmute times for users and insert a new row when a user is muted, next make a loop that would fetch the users whose unmute time has already come and unmute them.

Sqlite is suitable for this case. Make a table with users ids column and the timestamp. For making a loop use @tasks.loop

wild spoke
#

same bout ban

vale wing
#

!d discord.ext.tasks.loop

unkempt canyonBOT
#

discord.ext.tasks.loop(*, seconds=..., minutes=..., hours=..., time=..., count=None, reconnect=True)```
A decorator that schedules a task in the background for you with optional reconnect logic. The decorator returns a [`Loop`](https://discordpy.readthedocs.io/en/latest/ext/tasks/index.html#discord.ext.tasks.Loop "discord.ext.tasks.Loop").
wild spoke
#

im actually using github template for it

eager bluff
#

is there a way to execute a command via a webhook or even read a webhook?

wild spoke
#

editing and learning

vale wing
#

If you don't know about databases then make a dict and use json / pickle to serialise it although it is discouraged and you better learn about databases

wild spoke
#

tho idk if it has database

vale wing
#

It doesn't

#

Your command has nothing to do with what I have suggested actually

#

The logic is mostly done outside

wild spoke
vale wing
#

So um you are copypasting the code and editing values or smth

wild spoke
#

im learning

#

basically copypasted the template and editing it up for my desires

vale wing
#

That's not learning

slate swan
#

How would i make python DM The user?

wild spoke
#

and googling what does each command do

vale wing
slate swan
vale wing
wild spoke
#

like basics of basics

#

beginner level of python

vale wing
vale wing
wild spoke
#

I failed exam

slate swan
vale wing
#

Cause you don't understand it or smth

vale wing
wild spoke
#

I don't understand how to work with .h

slate swan
vale wing
#

Cpp header file?

wild spoke
wild spoke
vale wing
#

How is that related to python

wild spoke
#

oh fuck thats c++

sick birch
wild spoke
#

no, I have zero knowledge of OOP in python

vale wing
slate swan
wild spoke
#

so, google is my best option here

vale wing
wild spoke
#

and observing code

sick birch
slate swan
vale wing
#

And yeah function names in python start with small letter

sick birch
#

Also why are you using get_user?

#

You already have the member object

#

It’s like going from member object to ID back to member object

slate swan
#

To be honest with you, i know the simple part of discord.py.

sick birch
#

Though I’m still confused on those incorrect typehints, maybe they didn’t read the documentation?

vale wing
#

No idea how could they think of typehinting ctx as str and making a command "return" something

slate swan
#

Well, forget about that, how do i make it dm the user?

sick birch
#

Yours should already do that ignoring the glaring problems

vale wing
#

@sick birch btw congrats on project lead

slate swan
sick birch
#

Thank you! I’m quite excited to do more haha

vale wing
#

Haven't been in this server for a while cause went to making a game with unity

sick birch
sick birch
slate swan
#

yes i did.

vale wing
#

Nah I am not really back lol

slate swan
vale wing
#

At least someone is glad tho lol

vale wing
#

Are the function and variable in the same file

slate swan
#

Yes it is.

#

I also tried using client.change_presence() when the bot was ready and it returned the same error

vale wing
#

Your code is like

client = commands.Bot(...)

@client.command()
async def cmd(ctx):
    ...```
right?
vale wing
#

I can't really think of anything besides typos

#

Try renaming client to bot, it's considered a good practice and may fix some stuff

slate swan
#

Alright.

vale wing
#

Right click -> refactor -> rename

slate swan
#

Nope, same error but 'bot' is not defined.

vale wing
#

Also do you have python extension and the interpreter installed and configured? Pretty sure variable should light up with light blue color

vale wing
slate swan
vale wing
#

Eh wait what is this indent

dull terrace
vale wing
slate swan
#

It is indented.

vale wing
#

I mean like are there spaces right before async def

slate swan
#

It is in a class.

vale wing
#

Guess that's why you have issues

slate swan
#

The bot is inside the class.

vale wing
#

So it is a class car

#

Bring it outside

slate swan
#

Alright.

vale wing
#

And use cogs, not common classes

#

It's a bad idea just to put many commands into some empty class just for organisation purpose

#

Cogs are recommended

slate swan
#

Okay, now i'm getting discord.ext.commands.errors.CommandInvokeError: Command raised an exception: AttributeError: 'NoneType' object has no attribute 'send'

vale wing
#

Failed to get user by that ID

slate swan
#

user = bot.get_user(ctx.author.id)

vale wing
#

As mentioned above, you can send the message to a user who invoked the command with ctx.author.send

#

The user is ctx.author in this case

#

OOP 😀

slate swan
#

Alright that works, thank you very much for the help.

spice adder
pliant gulch
#

Users send a lot of messages, now imagine multiple users sending messages, then finally imagine a guild with 1k+ members

#

You would get ratelimited very quickly with fetches

wild spoke
#
 end_time = amout[-1:]
TypeError: 'NoneType' object is not subscriptable
#

what is this

heady sluice
#

an error which has nothing to do with dpy and means that amout is None

wild spoke
#
 async def мут(self, ctx, member: discord.Member, amout: str = None, *, reason: str = None):
#

Mute command for perma and temp at the same time

heady sluice
#

I hope you did <prefix>мут @wild spoke 2

wild spoke
#

?

heady sluice
#

or 2s or whatever

#

amout is None

wild spoke
#

if none = perma

heady sluice
#

what

wild spoke
#

it should for like that

heady sluice
#

show whole code

wild spoke
#

if no mute time amount is set, then mute is perma

wild spoke
heady sluice
#

I found the issue

#

you copied the whole thing

wild spoke
#

copypasted to my with renaming variables

#

not the entire

#

lemme show entire mute code

#

oh its text

#

one moment

#

also I noticed that it does not remove mute role

#

any suggestions besides opening "Python for dummies"?

onyx viper
#

check_priv doesn't exist?

flat solstice
#

Anyone know an self-hostable python FAQ bots using dropdowns and buttons?

still swan
#

why bot.run(token) is giving me RuntimeError: Event loop is closed?

#

may someone help me please?

sick birch
sick birch
still swan
#

so...

#

nvm that was turned off xD

#

thx anyways <33

sacred tendon
#

Can someone help me with an adding roles command in a bot, it's not working, also the ban command appears to not be working

fading marlin
#

"not working" doesn't really help. Are you getting any tracebacks? what is the output you're getting vs the output you're expecting?

sick birch
#

If only we could have the bot use “not working” as a trigger word and say that everytime someone says it…

fading marlin
#

ya

slate swan
#
webhook = await message.channel.create_webhook(name=message.author.display_name, avatar=message.author.avatar.url)
        await webhook.send(message.content)
        await webhook.delete()
#

getting error TypeError: startswith first arg must be str or a tuple of str, not bytes

sick birch
#

You sure the error isn’t somewhere else?

sacred tendon
slate swan
#

File "C:\Users\Asus_pc\PycharmProjects\VxBot\main.py", line 51, in on_message
webhook = await message.channel.create_webhook(name=message.author.display_name, avatar=message.author.avatar.url)
File "C:\Users\Asus_pc\PycharmProjects\VxBot\venv\lib\site-packages\discord\channel.py", line 563, in create_webhook
avatar = utils._bytes_to_base64_data(avatar) # type: ignore
File "C:\Users\Asus_pc\PycharmProjects\VxBot\venv\lib\site-packages\discord\utils.py", line 523, in _bytes_to_base64_data
mime = _get_mime_type_for_image(data)
File "C:\Users\Asus_pc\PycharmProjects\VxBot\venv\lib\site-packages\discord\utils.py", line 509, in _get_mime_type_for_image
if data.startswith(b"\x89\x50\x4E\x47\x0D\x0A\x1A\x0A"):
TypeError: startswith first arg must be str or a tuple of str, not bytes

sacred tendon
#

but now it's just saying that await is invalid syntax

sacred tendon
#

One second lemmie take a pic

#

I'm trying to get it to add the role "gumi-red" (ignore the name it's for a bird server)

fading marlin
#

you .add_roles to user (or ctx.me if you want to add roles to the bot), pass_context kwarg is also deprecated

sacred tendon
#

oh it's add_roles not add_role

#

I am an idiot and didn't look hard enough at the guide

slate swan
#

user.add_roles(role)

#

and also you dont nedd the pass_context = True

fading marlin
#

!d discord.Member.add_roles

unkempt canyonBOT
#

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

Gives the member a number of [`Role`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Role "discord.Role")s.

You must have the [`manage_roles`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Permissions.manage_roles "discord.Permissions.manage_roles") permission to use this, and the added [`Role`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Role "discord.Role")s must appear lower in the list of roles than the highest role of the member.
sacred tendon
#

How do I fix the await error tho

fading marlin
#

?

sacred tendon
#

Its not letting me run it

fading marlin
#

traceback?

sacred tendon
#

Its just doing tbus

#

Also the banning doesn't work it just says ban command not found

fading marlin
#

cause you're doing commands.command and you're outside of a cog, it should be client.command

sacred tendon
#

I don't see commands.command

fading marlin
sacred tendon
#

There's no traceback or anything

fading marlin
slate swan
sacred tendon
#

oops lemmie fix that

sacred tendon
fading marlin
#

yikes

sacred tendon
#

Is there vsc for Ubuntu? Lemmie check

fading marlin
#

open your terminal, head over to the directory in which your file is located, and run python3.x your_file.py

sacred tendon
#

Oh crap I should update pythom

#

2.7 seems a bit outdated

fading marlin
#

yikes again

sacred tendon
#

Gonna do that 😅

slate swan
#

i mean python 3.10 is out.....

#

like you should update it

sacred tendon
#

The version of Ubuntu I was on was 20.04 and it comes pre-installed with python so I should do that

fading marlin
#

it should come with both versions though?

sacred tendon
#

wdym

slate swan
#
webhook = await message.channel.create_webhook(name=message.author.display_name, avatar=message.author.avatar.url)
        await webhook.send(message.content)
        await webhook.delete()

Im trying to create a webhook with avatar of the message author

#

and i get this error TypeError: startswith first arg must be str or a tuple of str, not bytes

fading marlin
#

python2 and python3 should come pre-installed iirc, you just gotta choose which one to use (which is why you should be running your programs from a terminal)

sacred tendon
#

ah ok

#

the terminal tells me exactly the mistake I made

#

ok now it's telling me that module discord not found

slate swan
#

yikes again😂

sacred tendon
#

What on earth did I do wrong this time

slate swan
#

nothing im just joking

fading marlin
fading marlin
dusky pine
#

hikari moment
start_poll.description = start_poll.__doc__

sacred tendon
fading marlin
#

python3.x -m pip install ...

sacred tendon
#

Wait the IDLE shell is on 3.8.10

#

After fixing a dumb error now it's saying name 'get' is not defined

fading marlin
#

traceback?

rare saddle
#

How to make a bot a speaker in the stage channel?

#

So that he automatically logs in as a speaker, and not do it manually

sacred tendon
shrewd apex
#

get() is not required

fading marlin
# sacred tendon

well, you don't have a function called get, however I'm pretty sure you just want discord.utils.get

shrewd apex
#

just discord.utils.get()

sacred tendon
#

Message object has no attribute server now

fading marlin
#

guild, not server

shrewd apex
#

^

sick birch
#

Servers have different meaning outside the context of discord and in that of software development

#

You mash them together (discord API) and you have a naming problem

sacred tendon
#

Bot object has no attribute add_roles

shrewd apex
#

member.add_role

sacred tendon
#

Why are some add role and some add roles

sick birch
slate swan
#

there's no add role

sick birch
unkempt canyonBOT
#
Not likely.

No documentation found for the requested symbol.

fading marlin
#

Bot doesn't have an add_role method

sick birch
#

Thought so

fading marlin
#

you need a Member object

slate swan
#

its add_roles which can take more than 1 role arguments to add role

#

http.add_role handles the requests part

sick birch
#

You can very well use add roles with only one role

slate swan
#

ofcourse you can kannapogg , just saying in case you wanna add more than one!

#

cause I've seen people using for loops for adding multiple roles, which is kinda bad

sick birch
#

Yup, it’s just some people may look for both a add_role and add_roles without knowing they’re both in one

slate swan
#

thats why one should use an ide/editor with autocomplete/linter 😩

sick birch
#

And typehint everything you can properly

sacred tendon
#

the role giver dosent work with a space in the role

#

pain

slate swan
#

code?

#

you can use .command "role with space"

sacred tendon
#

or do i have to add every role to the bot

slate swan
#

nono thats not needed until your bot's top role is above those roles and bot has manage_roles permissions

sacred tendon
#

yes i have that

#

it works with a role with no spaces but not with the spaces

slate swan
#

im still waiting for the conclusion of the adminslemon_sentimental

slate swan
#

me on my way to ping mina: lemonpeek

sacred tendon
#

and the bot spits out an error saying role not found

slate swan
#

show your code and how you run the command on Discord

jagged adder
#

is there a way to tell my bot/code to loop x amount of times? im trying to test a counter and i dont want to stack a ton of += 1 to the test code :p

sacred tendon
#

(role i used to test was Gumi_Red)

slate swan
#

why are you using role = utils.get?

#

you already have the role object from the command argument

sacred tendon
#

lemmie try running it w/o

unkempt canyonBOT
#

discord.ext.tasks.loop(*, seconds=..., minutes=..., hours=..., time=..., count=None, reconnect=True)```
A decorator that schedules a task in the background for you with optional reconnect logic. The decorator returns a [`Loop`](https://discordpy.readthedocs.io/en/latest/ext/tasks/index.html#discord.ext.tasks.Loop "discord.ext.tasks.Loop").
slate swan
#

count = x

jagged adder
#

alr ty

sacred tendon
#

oop it runs without the role = line

#

it still dosent give the role with a space in it tho

slate swan
#

how did you run the command on Discord

sacred tendon
#

{prefix}role {member @} {role}

#

like i did .role @sacred tendon Chirps Yellow (this is for a bird server and im trying to test the color roles)

#

@slate swan

fading marlin
#

since you don't have a 'consume rest' argument and you're not setting the role's name in between quotes, the converter will only search for the role Chirps

slate swan
#

you need the " "

sacred tendon
#

oh

#

how do i get it to remove a role if it already has it

slate swan
#

remove_roles instead of add_roles

#

and you can check if the member has it using if Role in Member.roles

sacred tendon
#

do i put that before or after the current code

slate swan
#

you wanna check before adding the role right

sacred tendon
#

yea

#

after adding the remove thing; argument of type 'property' is not iterable

#

how do i get an answer without pinging

stone palm
#

how do i get the last message sent by te bot in a server?

fading marlin
#

!d discord.Member.history

unkempt canyonBOT
#

async for ... in history(*, limit=100, before=None, after=None, around=None, oldest_first=None)```
Returns an [asynchronous iterator](https://docs.python.org/3/glossary.html#term-asynchronous-iterator "(in Python v3.10)") that enables receiving the destination’s message history.

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

Examples

Usage...
fading marlin
#

basically that, but with your bot

sacred tendon
#

was the property thing being weird because i used if and else wrong (idk if i did)

fading marlin
#

code?

maiden fable
unkempt canyonBOT
#

async for ... in history(*, limit=100, before=None, after=None, around=None, oldest_first=None)```
Returns an [asynchronous iterator](https://docs.python.org/3/glossary.html#term-asynchronous-iterator "(in Python v3.10)") that enables receiving the destination’s message history.

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

Examples

Usage...
maiden fable
#

Member.history will return the DM history

fading marlin
#

hmmm

sacred tendon
#

async def role (ctx, user: discord.Member, role: discord.Role): if role in discord.Member.roles: await discord.Member.remove_roles(ctx.message.author, role) await ctx.send(f"{ctx.author.name} has been removed from a role") else: await discord.Member.add_roles(ctx.message.author, role) await ctx.send(f"{ctx.author.name} has been given a role")

fading marlin
#

you need an instance of discord.Member, not the class' property

sacred tendon
#

how do i fix idk how

slate swan
stone palm
sacred tendon
#

it just spat out user not defined

slate swan
#

Code pls

sacred tendon
#

i just changed everything that said discord.Member to user

slate swan
#

Code!

sacred tendon
#

ffs

#

its annoying because the code is on a dif pc

slate swan
#

I can't help without code

sacred tendon
slate swan
#

u didn't replaced

sacred tendon
#

oh right i undid it

#

one second

stone palm
sacred tendon
slate swan
#

What the

fading marlin
sacred tendon
#

whats typehint

slate swan
#

Yes

slate swan
#

Also

#

user.roles

fading marlin
slate swan
#

And await user.remove_roles(rold)

slate swan
#

!d discord.Member.remove_roles

unkempt canyonBOT
#

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

Removes [`Role`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Role "discord.Role")s from this member.

You must have the [`manage_roles`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Permissions.manage_roles "discord.Permissions.manage_roles") permission to use this, and the removed [`Role`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Role "discord.Role")s must appear lower in the list of roles than the highest role of the member.
sacred tendon
slate swan
#

Yes

#

Listen

#

Change inside code of the () to role

#

Cuz u have already did user.add_role

#

I gtg sry

sacred tendon
#

now its just "unknown role"

robust fulcrum
#

Guys is there any good dictionary api that i can use for making a word meaning command?

sacred tendon
#

uh oh the cpu is running at 88 degrees i should fix that

stone palm
#

@fading marlin something like this?```py
async for message in channel.history(after=datetime.datetime(year=2022, month=4, day=1))

fading marlin
#

yes

stone palm
#

is the datetime part correct too?

fading marlin
#

yep

stone palm
#

aight thanks

#

@fading marlin it doesnt seem to work :/

#
@client.command()
@commands.is_owner()
async def leave(ctx):
    for channel in ctx.guild.channels:
        async for message in channel.history(after=datetime.datetime(year=2022, month=4, day=1)):
            if message.author == client.user:
                await ctx.send("True")
                break
            else:
```its like the channel history part doesnt work at all
theres no response
rain olive
slate swan
#

Oxford dictionary has a free api too which you might use

dull terrace
#

i've been stuck on something really simple that i should have figured out ages ago and it's driving me insane

rain olive
stone palm
slate swan
#

i mean yeah, you don't really need a complete library just to make requests to a site for getting meaning for some word

#

@stone palm what you trying to do

rain olive
shrewd apex
#

!pypi PyDictionary

unkempt canyonBOT
rain olive
stone palm
stone palm
#

in the server

stone palm
fading marlin
#

yeah

stone palm
# fading marlin yeah

when i use print statements it doesnt print anything after the channel history line

fading marlin
#

does your bot have the proper permissions?

stone palm
fading marlin
#

you could have an error handler 🤷

stone palm
#

but i dont

stone palm
slate swan
stone palm
#

i checked

#

@fading marlin thiss

#

😭

slate swan
#

Hello my names sam

dusky pine
#

hello sam

stone palm
#

bruh

robust fulcrum
slate swan
#

Can I be a mod

robust fulcrum
slate swan
#

you can use the site hay recommended if you don't want the token stuff and do it easily

robust fulcrum
#

@slate swan do i need to copy credentials?

stone palm
#

imagine coding on phone and not learning python

robust fulcrum
#

@rain olive

async def word_info(word):
    word = await dictionary.get_word(word) # get a Word object
    print(f"Word: {word.word}")
    print(f"Phonetic text: {word.phonetics[0].text}")
    print(f"Part of Speech:word  {word.meanings[0].part_of_speech}")
    print(f"Definition: {word.meanings[0].definitions[0].definition}")
    print(f"Synonyms: {', '.join(word.meanings[0].definitions[0].synonyms)}")
    print(f"Example: {word.meanings[0].definitions[0].example}")

How can I assign synonyms definition examples and other things in a varibable?

sacred tendon
rain olive
robust fulcrum
#

I mean i want to assign definition in a varibable called defi

rain olive
#

just do it?

robust fulcrum
#

How?

rain olive
#

defi = word.meanings[0].definitions[0].definition

#

basic python???!!!

robust fulcrum
#

I confused

#

I learning currently

#

I forgot some of it

rain olive
#

uh you shouldnt be learning python by using d.py this is legit one of the most basic thing...

#

assigning a variable should literally be the first thing you learn hahahaa

robust fulcrum
#

No me learning from YouTube

robust fulcrum
rain olive
#

yikes! look at the official python tutorial instead

robust fulcrum
rain olive
#

oh because he uses hindi or whatever right

robust fulcrum
#

Yes

robust fulcrum
rain olive
#

fair enuf, but consider the actual tutorial lol

stone palm
#
@client.command()
@commands.is_owner()
async def leave(ctx):
    for channel in ctx.guild.channels:
        async for message in channel.history(after=datetime.datetime(year=2022, month=4, day=1)):
            if message.author == client.user:
                await ctx.send("True")
                break
            else:
```why doesnt this work? theres no response and print statements dont work after the channel history line
sacred tendon
#

Ok so how do I get the bot to default to the command author instead of having to ping (for an addrole/removerole command)

cerulean folio
#

bruh why do I have to install discord.py every day with repl.it? The bot doesn't stay awake for some reason, gets interrupted for updates and then dpy just... goes

slate swan
#

replit doesn't keep your python environment, so the libraries installed with pip gets purged

#

use poetry instead

#

poetry add git+that GitHub link

cerulean folio
#

poetry add git+https://github.com/Rapptz/discord.py that?

cerulean folio
# slate swan yeah

thank you, do I have to do additionnal things like import poetry or whatever?

slate swan
dusky pine
cerulean folio
#

okie thank you :)

#

are you sure it's correct? or it's just loading?

slate swan
#

write it in shell, not Console

sacred tendon
cerulean folio
#

oh ok, it worked anyway so it's cool

slate swan
unkempt canyonBOT
#

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

001 | default argument value
002 | user provided value
sacred tendon
#

ok maybe I should stick to the standard discord bots

slate swan
#

if you intend to make a discord bot using python, without learning basic python
ill suggest the same.

sacred tendon
sacred tendon
#

I just wanna get rid of the fact I have to ping or else it'll try to find the role as a member

slate swan
#

pythons idle😍

shrewd apex
#

btw u can also just add the member name and fetch member with name

sacred tendon
#

I'm trying to just get it so it gets the authors name

#

So whoever is using the command gets it without having to ping themselfs

slate swan
sacred tendon
#

Where do I put that

paper sluice
dusky pine
#

yess

#

i rewrote my bot in hikari

#

also why are you using IDLE

paper sluice
slate swan
sacred tendon
dusky pine
sacred tendon
#

Is VSCode available?

#

It is but it's literally just titled.... Code

paper sluice
#

just use vim

slate swan
robust fulcrum
#
    emdsf = discord.Embed(title="dictionary",color=discord.Color.green())

Guys me getting invalid syntax error
Can anyone tell what's wrong in it?

slate swan
#

Can you show more code? That line looks fine to me without any context.

robust fulcrum
#
async def word_info(word):
    word = await dictionary.get_word(word) # get a Word object
    wor = word.word
    pho = word.phonetics[0].text
    spe = word.meanings[0].part_of_speech
    defi = word.meanings[0].definitions[0].definition
    syno = ', '.join(word.meanings[0].definitions[0].synonyms
    emdsf = discord.Embed(title="dictionary",color=discord.Color.green())
    emdsf.add_field(name="word", value=wor, inline=False)
    emdsf.add_field(name="phonetics text", value=pho, inline=False)
    emdsf.add_field(name="part of speech", value=spe, inline=False)
    emdsf.add_field(name="definition", value=defi, inline=False)
    emdsf.add_field(name="synonyms", value=syno, inline=False)
    return emdsf
slate swan
#
syno = ', '.join(word.meanings[0].definitions[0].synonyms

Missing a ) at the end there

dusky pine
slate swan
dusky pine
#

tests?

#

unit tests, it's where you test parts of your code like functions and classes

slate swan
dusky pine
#

i'm testing the poll & help embed creation function

slate swan
#

imagine using @lightbulb.set_help(docstring=True)

dusky pine
#

hey i'm just used to writing help in docstrings

#

i came from dpy lol

slate swan
#

i do the same, kannapogg but use the inspect Library to get the docstring lmao

#

don't want to add extra decos 😩

dusky pine
#

then... no difference

slate swan
dusky pine
unkempt canyonBOT
#

plugins/help.py line 54

description=desc + t.cast(str, inspect.getdoc(command.callback)),```
dusky pine
#

how about command.callback.__doc__

slate swan
#

ow wait i didn't use the command lmao

#

!e ```py
import inspect

def foo():
"""a cool function
multiple lines
"""
...
print(foo.doc)
print(inspect.getdoc(foo))

#

eh

#

sarth you failed 2 times😭

unkempt canyonBOT
#

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

001 | a cool function
002 |    multiple lines
003 |    
004 | a cool function
005 | multiple lines
slate swan
#

you see the reason

dull terrace
slate swan
#

bro

dusky pine
#

hey wait does anyone know how to make bot.run async

slate swan
slate swan
shrewd apex
dusky pine
#

less goo

slate swan
dusky pine
#

can finally start fastapi and hikari

slate swan
dusky pine
#

tyty all

slate swan
#
class Bot(GatewayBot):
    async def run(): 
        # do your async stuf
        super().run()
#

forgot self but ykwim

#

why would you want to make it a coroutine? to use the coroutine object or

#

😭

dusky pine
#

but .run is blocking

slate swan
#

idk most of the time you can just use hikari.StartingEvent/StartedEvent they get triggered once in a lifetime

#

How do you intend on calling that coroutine?

slate swan
slate swan
vocal snow
slate swan
#

That's a bad answer

slate swan
slate swan
dusky pine
#

i'm trying to run uvicorn.run and bot.start() concurrently

shrewd phoenix
#

can i ask for help with my bot in here or is that not allowed?

dusky pine
#

problem is uvicorn's run function is blocking

vocal snow
slate swan
#

You shouldn't

#

At least not in the same thread

shrewd phoenix
#

i have made a music bot but i get this info thing and it doenst work anymore 2022-06-25 07:23:26 INFO discord.player Preparing to terminate ffmpeg process 34588. 2022-06-25 07:23:26 INFO discord.player ffmpeg process 34588 has not terminated. Waiting to terminate... 2022-06-25 07:23:26 INFO discord.player ffmpeg process 34588 should have terminated with a return code of 1. this is my code https://pastebin.com/WRwzB8xq

vocal snow
#

that doesn't matter, it's still correct code in response to the question

slate swan
#

You will get very confusing errors very fast

vocal snow
#

ok bb

slate swan
#

how can i make the run method async? thats basically it

#

tho start is the actual deal

#

Uh don't use run, use .start()

slate swan
#

!pip uvicorn

unkempt canyonBOT
dusky pine
#

uvicorn, to run FastAPI

kindred epoch
dusky pine
#

but problem is fixed, uvicorn.Server(uvicorn.Config(app=web_app, port=3000)).serve() is solution

slate swan
dusky pine
kindred epoch
kindred epoch
slate swan
slate swan
#

they fixed it ig

#

You can start the server from an async context

shrewd phoenix
#

i have made a music bot but i get this info thing and it doenst work anymore error [youtube] QxYdBvB8sOY: Downloading webpage 985104597242773505 [2022-06-25 07:45:51] [INFO ] discord.player: Preparing to terminate ffmpeg process 37580. [2022-06-25 07:45:51] [INFO ] discord.player: ffmpeg process 37580 has not terminated. Waiting to terminate... [2022-06-25 07:45:51] [INFO ] discord.player: ffmpeg process 37580 should have terminated with a return code of 1. this is my code https://pastebin.com/WRwzB8xq

slate swan
#

!ytdl

unkempt canyonBOT
#

Per Python Discord's Rule 5, we are unable to assist with questions related to youtube-dl, pytube, or other YouTube video downloaders, as their usage violates YouTube's Terms of Service.

For reference, this usage is covered by the following clauses in YouTube's TOS, as of 2021-03-17:

The following restrictions apply to your use of the Service. You are not allowed to:

1. access, reproduce, download, distribute, transmit, broadcast, display, sell, license, alter, modify or otherwise use any part of the Service or any Content except: (a) as specifically permitted by the Service;  (b) with prior written permission from YouTube and, if applicable, the respective rights holders; or (c) as permitted by applicable law;

3. access the Service using any automated means (such as robots, botnets or scrapers) except: (a) in the case of public search engines, in accordance with YouTube’s robots.txt file; (b) with YouTube’s prior written permission; or (c) as permitted by applicable law;

9. use the Service to view or listen to Content other than for personal, non-commercial use (for example, you may not publicly screen videos or stream music from the Service)
slate swan
slate swan
slate swan
dull terrace
slate swan
#

uh?

dull terrace
#

wheeze i think i've been awake too long

slate swan
shrewd apex
#

u fix the class

dull terrace
#

look at how close it keeps the line lengths

slate swan
dull terrace
#

can use any characters or strings

shrewd apex
#

u are missing some parameter

dusky pine
slate swan
shrewd apex
#

oh typeerror in call didnt see my bad

dull terrace
lilac peak
#

How to make to bot show the avatar in event?

gaunt ferry
#

who can setup a discord bot for me?

#

I have all the stuff for the bot though

vale wing
vale wing
unkempt canyonBOT
#

9. Do not offer or ask for paid work of any kind.

gaunt ferry
#

k

#

I edited the message

vale wing
lilac peak
vale wing
#

Just send an avatar or embed it into an image and send?

#

!d discord.Member.avatar is what you need anyway

unkempt canyonBOT
#

property avatar```
Equivalent to [`User.avatar`](https://discordpy.readthedocs.io/en/latest/api.html#discord.User.avatar "discord.User.avatar")
vale wing
#

!d discord.Member.display_avatar is better tho

unkempt canyonBOT
#

property display_avatar```
Returns the member’s display avatar.

For regular members this is just their avatar, but if they have a guild specific avatar then that is returned instead.

New in version 2.0.
lilac peak
#

Thanka

#

Thanks*

shrewd apex
#

display_avatar gives default in case there is no avatar if u use avatar.url it will return none

slate swan
#

Hi

#

👋

#

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

slate swan
#

mb

slate swan
#

mhm k

#

you're right Sparky

#

Oh 👍

shrewd apex
slate swan
#

everybody here slaps each other too much 😔 rude

lilac peak
#
    elif value == "Ban" or "B":
        embed = discord.Embed(title="🔨 Ban", description="Służy do banowania użytkowników.", color=0xffffff)
        embed.add_field(name="📕 Użycie:", value='`.ban <@użytkownik> <powód>`')
        embed.add_field(name="📖 Przykład użycia:", value='`.ban @człowiek spam`')
        embed.add_field(name="🗂 Kategoria:", value="Moderacja")
        embed.add_field(name="🚨 Potrzebna permisje:", value ="Banowanie członków")
        embed.add_field(name="💾 Dodatkowe informacje:", value = "Brak.")
        embed.add_field(name="🔠 Inne sposoby wpisania komendy:", value = "`.b`")
        await ctx.send(embed=embed)

    elif value == "Ogłoś" or "Oglos" or "O":
        embed = discord.Embed(title="📢 Ogłoś", description="Służy do wysyłania wiadomości na #📢-ogłoszenia.", color=0xffffff)
        embed.add_field(name="📕 Użycie:", value='`.ogłoś <ogłoszenie>`')
        embed.add_field(name="📖 Przykład użycia:", value='`.ogłoś coś tam ważnego`')
        embed.add_field(name="🗂 Kategoria:", value="Ogłoszenia")
        embed.add_field(name="🚨 Potrzebna permisje:", value ="Zarządzanie kanałami")
        embed.add_field(name="💾 Dodatkowe informacje:", value = "Możesz pisać jakiej chcesz długości wiadomości póki nie będziesz miał/a limitu od discorda.")
        embed.add_field(name="🔠 Inne sposoby wpisania komendy:", value = "`.oglos`, `.o`")
        await ctx.send(embed=embed)

when i write .pomoc ogłoś bot send to me what it should be .pomoc ban
i don't have error

slate swan
shrewd apex
#

*3

slate swan
#

^3

slate swan
shrewd apex
#

ap broke

slate swan
#

ap?

shrewd apex
#

arithmetic progression

#

1,3,5,7 cd=2

slate swan
#

I uhhh

shrewd apex
#

nvm i did too much math💀

slate swan
#

I got holidays, so I'm not even tryna process it

shrewd apex
#

lmao

slate swan
#

is danny a pharmacist or what?

shrewd apex
#

biologically active

shrewd apex
slate swan
shrewd apex
#

fr?

slate swan
#

I am actually not a Discord employee. In fact, I'm not even a professional programmer. In reality, I'm a medical professional who works at my local hospital

slate swan
paper sluice
#

yall didnt know that?

shrewd apex
#

i didn't know that👀

shrewd apex
#

respects to danny🙏

robust fulcrum
#

Guys any command idea for me?

dusky pine
robust fulcrum
#

And thanks for giving challenge

dusky pine
#

send "4" to the user 😎

robust fulcrum
#

Dm?

dusky pine
#

yes

robust fulcrum
#

Easy

dusky pine
#

it's so hard not even NASA engineers can solve it

robust fulcrum
#

Let me amke command

#

I'll send here

#
@bot.event()
async def on_message(message):
    if message.content.start_with("dm"):
        await bot.send_message("4")

@dusky pine

slate swan
robust fulcrum
slate swan
#

💀

shrewd apex
#

nope

shrewd apex
#

it's message.author.send()

#

!d discord.Member.send

unkempt canyonBOT
#
await send(content=None, *, tts=False, embed=None, embeds=None, file=None, files=None, stickers=None, delete_after=None, nonce=None, allowed_mentions=None, reference=None, ...)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).

Sends a message to the destination with the content given.

The content must be a type that can convert to a string through `str(content)`. If the content is set to `None` (the default), then the `embed` parameter must be provided.

To upload a single file, the `file` parameter should be used with a single [`File`](https://discordpy.readthedocs.io/en/latest/api.html#discord.File "discord.File") object. To upload multiple files, the `files` parameter should be used with a [`list`](https://docs.python.org/3/library/stdtypes.html#list "(in Python v3.10)") of [`File`](https://discordpy.readthedocs.io/en/latest/api.html#discord.File "discord.File") objects. **Specifying both parameters will lead to an exception**.

To upload a single embed, the `embed` parameter should be used with a single [`Embed`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Embed "discord.Embed") object. To upload multiple embeds, the `embeds` parameter should be used with a [`list`](https://docs.python.org/3/library/stdtypes.html#list "(in Python v3.10)") of [`Embed`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Embed "discord.Embed") objects. **Specifying both parameters will lead to an exception**.
dusky pine
#

^

shrewd apex
#

message.author returns a member👀

robust fulcrum
dusky pine
slate swan
#

Hi

dusky pine
#

hi among us

slate swan
shrewd apex
slate swan
#

If I'm among us then ur black monkey

shrewd apex
dusky pine
#

that's not cool

slate swan
#

Yes

#

That's not cool making fun of pfp

shrewd apex
dusky pine
#

that's racist though

slate swan
#

😅

shrewd apex
dusky pine
#

yeah sure

#

yeah im a girl now yo

slate swan
#

Hi

#

😭

#

oof

paper sluice
#

pithink what is going on?

slate swan
dusky pine
slate swan
#

I installed Discord, but if I write import Discord it doesn't work

paper sluice
paper sluice
slate swan
slate swan
paper sluice
paper sluice
slate swan
#

ahh okay

#

pycharm

paper sluice
dusky pine
#

also, my pfp is not a monkey

#

it's a person

paper sluice
# slate swan pycharm

ok, pycharm installs a venv by default, so u might have to install discord there, or tell pycharm to use the global environment

slate swan
#

okay

#

i will try

slate swan
paper sluice
#

what did you try?

slate swan
#

I used the global environment

paper sluice
#

run ur code and send a screenshot

slate swan
#

wait

cerulean folio
#
Traceback (most recent call last):
  File "/home/ayoub/anaconda3/envs/discord/lib/python3.10/site-packages/discord/ext/commands/bot.py", line 1330, in invoke
    await ctx.command.invoke(ctx)
  File "/home/ayoub/anaconda3/envs/discord/lib/python3.10/site-packages/discord/ext/commands/core.py", line 995, in invoke
    await injected(*ctx.args, **ctx.kwargs)  # type: ignore
  File "/home/ayoub/anaconda3/envs/discord/lib/python3.10/site-packages/discord/ext/commands/core.py", line 209, in wrapped
    raise CommandInvokeError(exc) from exc
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: DiscordServerError: 503 Service Unavailable (error code: 0): no healthy upstream

someone knows what all this mean?

#

i don't know error handling at all :(

slate swan
#

Everybody hates my pfp 😔

cerulean folio
#

whyyy

cerulean folio
#

it's a whitu smonng us char in the space

paper sluice
slate swan
cerulean folio
slate swan
ember citrus
slate swan
slate swan
#

😑

paper sluice
slate swan
slate swan
#

..

#

hello 👋 ded chat

#

sparky

dusky pine
#

spawky 🥺 👉👈

slate swan
#

......

#

uwufied text 😔

dusky pine
#

.uwuify sparky

slate swan
dusky pine
#

i'm not dave shut up

slate swan
#

imagine hiding your name 😔

cerulean folio
paper sluice
slate swan
cerulean folio
slate swan
paper sluice
# slate swan oh

or just click on terminal and install discord there, dont do the global intepreter thing

cerulean folio
#

Oh wait i think i know where it comes from

slate swan
slate swan
dusky pine
paper sluice
slate swan
#

i know i know

slate swan
dusky pine
#

i saw eivl use it

slate swan
slate swan
paper sluice
slate swan
# slate swan uwu
@commands.Cog.listener
async def on_message(self,m):
    if m.content == "uwu":
         exit()
dusky pine
#

ew one letter variable names

slate swan
#

FINE

#

ryuga go and play 😔

slate swan
dusky pine
slate swan
#

ik

paper sluice
dusky pine
#

learn how to write clean code or I WILL COME TO YOUR HOUSE AT 3AM 🤯 😱

dusky pine
#

your code is practically unreadable

slate swan
slate swan
dusky pine
slate swan
granite raft
dusky pine
slate swan
slate swan
#

OK so

#

Clean code

dusky pine
#

so uhhh

#

can someone send PR to fix the only issue in my discord bot

#

yeah, it's best tool to keep your code clean

slate swan
#

help command?

#

hikari-lightbulb ohmi god

dusky pine
#

yes, make sure to write tests for the help embed

#

or i will come to your house

#

okay that part is optional i'll write it

slate swan
#

eh im too lazy, I'm not doing it

dusky pine
#

same

slate swan
#

Wdym by write test

slate swan
#

oof

paper sluice
#

x^69 + y^420 = help command

slate swan
#

💀

dusky pine
#

assert 2 + 2 == "help command"

slate swan
#

how to check every members status

#

the text they put in their status

rain olive
#

member.activity

slate swan
rain olive
#

no, do you know python...

#

you shouldn't be asking such a question if you're making a discord bot 😩

slate swan
rain olive
#

for what purpose

slate swan
#

custom invite

#

if they have invite in their status then the bot will give them role

rain olive
#

when should this occur

#

via a command invocation or

slate swan
#

automaticzally

rain olive
#

there has to be an input

#

it can't happen just like that

slate swan
#

on command then

rain olive
#

ok,

for member in ctx.guild.members:
    ...
slate swan
#

oohhh

rain olive
#

then you check member.activity.name

#

it will output a string

#

so you could have if member.activity.name == "custom invite here": ...

slate swan
#

thank u

rain olive
#

np

slate swan
#
await ctx.author.add_roles(role)
#

do i have to put role id in ()

#

or in ("")

#

@rain olive

slate swan
rain olive
slate swan
#

oooh

rain olive
#

fyi go and read the docs whenever u have issues with parameters and their types

#

usually the docs have the most accurate info

split solstice
#
RuntimeWarning: Enable tracemalloc to get the object allocation traceback``` how do i fix that?
dusky pine
robust fulcrum
#

Guys what's use of this package
import re
I saw in one bot on GitHub

slate swan
#

its not wirking

#
elif message.author == message.author:
      mwm = message.author
      inv = ['dis']
      role = discord.utils.get(message.guild.roles, name="Image perms")
      for activity in mwm.activities:
         if isinstance(activity, discord.CustomActivity): #checking activity is a custom activity
            print(activity)
            if activityName == any(word in activityName for word in inv):
                if role in message.author.roles:
                  continue
                else:
                   await message.author.add_roles(923323634334973982)
            elif activityName != any(word in activityName for word in inv):
                if role in message.author.roles:
                  await message.author.remove_roles(923323634334973982)
                else:
                  continue
            else:
                continue
#

help

#

please

slate swan
slate swan
#

more commands/ plugins....?

#

cause all i see is 1 comamnd in the init.py

dusky pine
#

yeah planing to add more, don't know much about hikari/lighbulb yet

slate swan
#

will you be using plugins? they are like cogs in dpy ( functionality)

dusky pine
#

yeah

#

love cogs

#

okay now that I think about it i think it's weird to have tests and a web server for just a poll bot

slate swan
#

mhm, why even write tests for bots

dusky pine
#

error-free world

#

just like tests

#

be like Preocts, master of tests

slate swan
#

just use eval and stuff to test your code 💀

#

cause you can actually trigger events and commands in an eval

dusky pine
#

eval 💀

cerulean folio
#
async def fetch_ids(ctx, channel, message):
  if message.embeds:
    text  = re.findall('[0-9]+', message.embeds[0].description)
    for i in text:
      if not req.search_id(i) and not req.search(i):
        req.add_id(i)
  text  = re.findall('[0-9]+', message.content)
  if text:
    for i in text:
      if not req.search_id(i) and not req.search(i):
        req.add_id(i)

I can't get why this doesn't work ! It's driving me crazy !

#

When I replace req.add_id(i) by print('Added to database') this works fine, doesn't come from the conditions.
Then it says Unique constraint error for adding... I don't get it

split solstice
#
ctx.send(embed=embed)
RuntimeWarning: Enable tracemalloc to get the object allocation traceback```
 how do i fix that?
dusky pine
#

await ctx.send(...)

swift pumice
#

is it allowed to write nsfw messages?

#

i want to ask something but it has something to do with nsfw

robust fulcrum
#
    @commands.command()
    async def marryrate(self,ctx,user: discord.Member):
        a = ctx.author
        b = user
        resp = requests.get(f"https://loverapi.herokuapp.com/api/v1/calculate?personA={a}&personB={b}")
        resos = json.loads(resp.text)
        rate = resos["result"]
        message = resos["message"]
        hg = discord.Embed(title="Marry rate", description=f"Marry rate-{rate} | Message-{message}",color=discord.Color.red())
        await ctx.send(embed=hg)

Guys how to fix this error?

dusky pine
robust fulcrum
#

Oh

#

I forgot i need text 😂

cedar willow
#

Can anybody tell am I doing this right? I want to connect my database

async def main():
    async with aiohttp.ClientSession() as session:
        asyncpg.create_pool(dsn='TOKEN')
        async with self:
            self.session = session
            await super().start(config.TOKEN, reconnect=True)
robust fulcrum
slate swan
#

Can u pls send the error instead of screenshot

robust fulcrum
slate swan
#

Ye but not readable

#

Nobody likes screenshot

robust fulcrum
#

Error is key error : 'result'

slate swan
#

FINE

#

Code

slate swan
#

There is no key named result

robust fulcrum
#

It's there

slate swan
#

Can u show

paper sluice
robust fulcrum
swift pumice
dusky pine
#

here's a wrapper

swift pumice
#

thank youu

robust fulcrum
robust fulcrum
#

Guys is there any good translate api that i can use in my discord bot command?

slate swan
#

Use google translate

shrewd apex
#

!pypi deep_translator

unkempt canyonBOT
#

A flexible free and unlimited python tool to translate between different languages in a simple way using multiple translators

robust fulcrum
robust fulcrum
shrewd apex
#

use deepl ig then

#

what's the formatting for having thats ascii box in an embed which works on phone as well like 3*` followed by __

robust fulcrum
shrewd apex
#

yes

slate swan
shrewd apex
#

if u don't wanna get rate limited btw use translate_batch()

slate swan
#

why did I read that as "bitch" 😭

dusky pine
#

translate this you bitch

slate swan
#
@tasks.loop()
async def status_role(seconds=15):
    guild = client.get_guild(921366728016011324)
    role = get(guild.roles, name='Image perms') 
    for member in guild.members:
        if member.activities and 'j' in member.activities[0].name.lower():
            await member.add_roles(921720262217568268)
            print("gave role to " + member)
        elif member.activities and 'fi' not in member.activities[0].name.lower():
            await member.remove_roles(921720262217568268)
            print("removed role")
#

its not'

#

givinf orle

shrewd apex
#

.add_roles(role)

robust fulcrum
slate swan
shrewd apex
#

u put role id

robust fulcrum
#
    @commands.command()
    async def translate(self,ctx,lang:str,text):
        translated = GoogleTranslator(source='auto', target=lang).translate(text)
        trans = discord.Embed(title=f"Translator | Translated to {lang}", description=translated,color=discord.Color.green())
        await ctx.send(embed=trans)

My translate command :)
Thanks Asher

dusky pine
#

my eyeball is hard rn

slate swan
shrewd apex
shrewd apex
#

just replace I'd with role

slate swan
#

oooooooooooooooooooooooooooooooohhhhhhhhhhhhhhhhhhhh

shrewd apex
proud apex
#

How to make it written when a person joined the server? such as month and year.

maiden fable
unkempt canyonBOT
#

An aware datetime object that specifies the date and time in UTC that the member joined the guild. If the member left and rejoined the guild, this will be the latest date. In certain cases, this can be None.

slate swan
#

client.get_channel(. . .)
Requires await?

#

!d discord.Client.get_channel

unkempt canyonBOT
#

get_channel(id, /)```
Returns a channel or thread with the given ID.

Changed in version 2.0: `id` parameter is now positional-only.
flat solstice
#

So I've just setup a new venv and installed all the packages needed but I'm getting an error that the asyncpg package has a undefined symbol _PyGen_send and I'm not sure why since I have a global environment that has all the same requirements and that's working. The error I'm getting is 2022-06-25T12:01:50: ImportError: /home/testing/env/lib/python3.10/site-packages/asyncpg/protocol/protocol.cpython-310-x86_64-linux-gnu.so: undefined symbol: _PyGen_Send okay so I updated my requiremnts.txt and tried again and now I'm getting a new error2022-06-25T12:15:10: TypeError: shield() got an unexpected keyword argument 'loop' full traceback: https://paste.pythondiscord.com/adedalegih, my reqs.txt: https://paste.pythondiscord.com/umavokutos

slate swan
#
@tasks.loop(seconds=15)
async def status_roles():
    guild = client.get_guild(921366728016011324)
    role = get(guild.roles, name='Image perms') 
    for member in guild.members:
        if member.activities and 'discofloofi' in member.activities[0].name.lower():
            await member.add_roles(role)
            print("gave role to " + member)
        elif member.activities and 'disfloofi' not in member.activities[0].name.lower():
            await member.remove_roles(role)
            print("removed role")
robust fulcrum
slate swan
#

No ig

robust fulcrum
slate swan
slate swan
slate swan
cloud flame
#

#bot-commands

slate swan
robust fulcrum
#

Guys can anyone suggest me a api that i can use in my bot?

robust fulcrum
#

Tell me any other?

#

¯_ʘ‿ʘ_/¯

slate swan
robust fulcrum
#

Guys is there any weather api with json?

#

I'll use it in my discord bot command

paper sluice
real grail
#

How to list all server member id's?

dusky pine
slate swan
#
@tasks.loop(seconds=15)
async def status_roles(ctx):
    guild = client.get_guild(921366728016011324)
    for member in guild.members:
        if member.activities and 'discoloofi' in member.activities[0].name.lower():
            await member.add_role(discord.Object(id=921720262217568268)
        elif member.activities and 'discordfloofi' not in member.activities[0].name.lower():
            await member.remove_role(discord.Object(id=921720262217568268)
modern rune
#

Ok sorry for the generic and repetitive question, but where would one start to make a discord bot in python? What library should i use? Is there any guide or something?

slate swan
dusky pine
#

its get started section and docs are pretty awesome

slate swan
modern rune
loud junco
paper sluice
real grail
slate swan
dusky pine
dusky pine
#

maybe ctx.guild.members