#discord-bots

1 messages · Page 809 of 1

quick gust
#

yeah and

#

what does it do if it's mentioned

slate swan
quick gust
#

uhuh

slate swan
neat tartan
#

Can you send a screenshot of the code in the ide so i can see how its currently formated

quick gust
#

exactly

quick gust
#

meaning you can do @unkempt canyon help and it will respond

slate swan
quick gust
#

it's 12 pm my guy

slate swan
quick gust
quick gust
#

12 PM not AM

cyan ermine
#

12 pm is afternoon bro

quick gust
#

hes high

slate swan
unkempt canyonBOT
#

A list of Member that were mentioned. If the message is in a private message then the list will be of User instead. For messages that are not of type MessageType.default, this array can be used to aid in system messages. For more information, see system_content.

Warning

The order of the mentions list is not in any particular order so you should not rely on it. This is a Discord limitation, not one with the library.

quick gust
#

Dw

cyan ermine
slate swan
#

and

cyan ermine
#

@slate swan Can you help me?

quick gust
#

Ok yeah he's definitely high

slate swan
cyan ermine
slate swan
cyan ermine
#

I don't get the error

quick gust
#

exactly, get off discord

slate swan
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

quick gust
#

lmao

slate swan
quick gust
#

teacher schold

cyan ermine
#

So what should i do?

quick gust
#

scold

cyan ermine
#

I dont know stuff

slate swan
quick gust
#

good

neat tartan
cyan ermine
#

wdym

slate swan
#

i cant leave tho

#

your help is bad😔

cyan ermine
#

Wdym dude?

#

I'm a beginner and learn from source code

slate swan
#

not you

#

infernum

neat tartan
#

There should be 1 line under each try: not 2. It looks like its double indented

cyan ermine
#

so i didnt learn about indentation till now

slate swan
quick gust
cyan ermine
quick gust
#

i hope you're joking because you make no sense 😭😭

slate swan
quick gust
#

..

neat tartan
#

I hate being on mobile because i cant give examples aaaaa

quick gust
#

Im not gonna argue because it's 2 am for you and I understand how your brain works at 2 am

quick gust
#

satisfied?

neat tartan
# cyan ermine

Try just indenting the bottom exception and see if it accepts it

quick gust
#

A bot will also always be able to get this information from:

slate swan
#

Add, *

mild harbor
#

me?

#

or no

slate swan
#

He deleted

mild harbor
#

u mean that

#

@slate swan this?

slate swan
#

No

mild harbor
#

oof

#

ight sorry

pliant gulch
# quick gust satisfied?

Without message intents, is the gateway event still dispatched but with a partial message object, or is it not dispatched at all like with how member intents and GUILD_MEMBER_ADD works?

slate swan
#
async def msg(ctx, user, discord.User,*,msg)```
slate swan
#

good luck infernum

#

andy is gonna send a whole paragraph on how youre wrong😭

quick gust
#

?

#

I dont mind it

slate swan
#

🏃

slate swan
#

Add *

pliant gulch
#

Ok that article answered my question

slate swan
pliant gulch
#

I remember hearing about it but I forgot

strong vessel
pliant gulch
#

Yea

strong vessel
#
If your bot or app is not approved for message content, the following fields of the message object in Gateway and API payloads will be empty—either an empty string or empty array, depending on the data type—when you receive a message:

content
embeds
attachments
components
slate swan
#

yeah since the intent isnt on why would it

pliant gulch
#

Guess I need to fix my typehints now

slate swan
#

LMAOOO

quick gust
#

If I am wrong, I'll be very glad to be corrected

quick gust
slate swan
#

lucky

grim oar
#

L

quick gust
#

go sleep

pliant gulch
slate swan
grim oar
#

I refuse

slate swan
grim oar
#

ot

slate swan
#

you cant even react😭

quick gust
#

!ot

unkempt canyonBOT
slate swan
#

😅

#

I am sry abt that

#

happens i sometimes forget define on mobile

#

🧑‍🦯

#

😅

#
@bot.command()
async def msg(context, user:discord.User,*,message)
  await user.send(message) ```
slate swan
#

Ik that

#

indents are off

#

and forgot a colon

#

Lmao mob problem

#

so you know each indentation level should be 4 spaces or a tab to follow pep8

#

Hmm

#

tab == 4 spaces

#

Ik or a tab space

#

each colon adds a indentation level btw

#

Hmm

quick gust
slate swan
#

Yah

quick gust
#

or are u just talking about 4 spaces

slate swan
#

Lmao

slate swan
#

Hmm

#

indents != intents

quick gust
quick gust
slate swan
#

cause i dont

#

Yes my bot on

quick gust
slate swan
#

my client doesnt cache members

#

^

quick gust
#

but yes i do

slate swan
#

i disabled it 🧠

quick gust
#

why does this say 100 servers?

#

but article says 75

slate swan
#

its 75

quick gust
#

why 100 then

strong vessel
#

the actual system kicks off at 75 though

slate swan
#

when you get a message from the system it says 75 and if you check the length of the guilds your bot is in its 75

quick gust
#

confusion

strong vessel
#

my guess is maybe discord's idea is that when a bot hits 75 servers it would get the warning, and at 100 servers the messages would become blank

slate swan
#

not only messages

strong vessel
#

since even the application process only becomes available on hitting the threshold (75 ig)

slate swan
#
PRESENCE INTENT
Required for your bot to receive Presence Update events.

NOTE: Once your bot reaches 100 or more servers, this will require verification and approval. Read more here

SERVER MEMBERS INTENT
Required for your bot to receive events listed under GUILD_MEMBERS.

NOTE: Once your bot reaches 100 or more servers, this will require verification and approval. Read more here

MESSAGE CONTENT INTENT
This intent will not be enforced until after April 30, 2022. Read more here.
Will be required for your bot to receive message content in most messages.

NOTE: After April 30, 2022, once your bot reaches 100 or more servers, this will require verification and approval. Read more here

#

lol

strong vessel
#

jfl i just got my bot working too, i feel so silly now

#

but oh well at least i have the chance to do it right from the start

quick gust
#

im not even gonna bother tbh, i dont like slash commands

slate swan
#

bro.

quick gust
#

so if I get denied then boom goes my bot

#

lmfao

slate swan
#

how do you not like slash commands

quick gust
#

idk

slate swan
#

how do you not know

quick gust
#

good question

#

i dont have an answer

strong vessel
#

prefix is easier to understand than mentions, but slash commands seem really complex

slate swan
#

slash commands arent hard?

#

its a whole ui for them how are they hard?

quick gust
#

they're a mess from a user's POV, imagine 15 bots in a server, all have all their commands as / commands

slate swan
#

no?

quick gust
#

what

#

ok sure, that's just preference

strong vessel
#

idk i never used slash commands much myself

slate swan
#

one of the reasons / commands are better is bots to overwrite each other and if you dont know a command or you dont know the prefix of the bot you should go straight to slash commands because its like a default prefix

strong vessel
#

but is it easy to make the same command many times though

slate swan
#

just like any command

strong vessel
#

i guess its good actually

slate swan
#

it just takes interaction and not Context and a new decorator

strong vessel
#

good for users, but complex for me

slate swan
#

and other stuff you have to add

slate swan
strong vessel
#

i like that i don't have to build my own UI to list all the stuff the bot can do

slate swan
#

what are you talking about slash commands?

#

or dropdowns?

strong vessel
#

i mean i was trying to figure out how to make a lot of commands for my bot but in a way that users could navigate easily, and the slash commands does a really good job for that

slate swan
#

yeah

#

dropdowns are good for help commands as well

strong vessel
#

discord bot development is so involved ngl

slate swan
#

ig so

strong vessel
#

i mean its great it has all these things though

opaque tiger
#

Hello Everyone!! Help needed here!!
#1: For how long is a button usable
#2: How can I make it usable after I have restarted the bot

slate swan
opaque tiger
slate swan
unkempt canyonBOT
#

property persistent_views: Sequence[discord.ui.view.View]```
A sequence of persistent views added to the client.

New in version 2.0.
opaque tiger
slate swan
#

yw

opaque tiger
slate swan
unkempt canyonBOT
#

property persistent_views: Sequence[disnake.ui.view.View]```
A sequence of persistent views added to the client.

New in version 2.0.
slate swan
#

yes

opaque tiger
quick gust
slate swan
#

yw

velvet tinsel
#

hi

slate swan
maiden fable
#

No thanks

slate swan
#

bro

velvet tinsel
#

?

velvet tinsel
velvet tinsel
slate swan
#

gn

maiden fable
slate swan
#
  • Use AsyncIOScheduler (coz your bot is async.. right? And you need to run coros)
  • apscheduler isn't an extension to discord related libraries, so you don't need to pass bot in init, instead do ```py
    from apscheduler.schedulers.asyncio import AsyncIOScheduler
    bot.scheduler = AsyncIOScheduler(event_loop=bot.loop)
- Make your `remind_user` async, and either make `create_reminder` and `cancel_reminder` async or remove await while executing them
- The `id` param..? If you want to cancel reminders later, create a random unique id, store it somewhere, and while cancelling the reminder use that id. Don't do `id="same_unique_id_which_you_used_while_adding_job"` this
placid skiff
slate swan
slate swan
#

btw i want a trigger command to execute only 1/4 of the times

#

so like

#

if there's an event there's a 1/4 chance the bot will trigger

slate swan
#

Yes

#

I want to use a copy pasta

#

Use the random module, generate random numbers, use conditionals

#

hmm

#

How would that work

slate swan
#

Use random.randint, and then use conditionals

#

sure

#

If random_num == 2: return

#

Like this

#

Or just use random.choice and use bools, your wish

#

Yeah wait lemme try

#

Oki

slate swan
# slate swan Oki

hey would you suggest me to learn js to make a music bot or use python as i know it (for making music bot)

slate swan
#

Music bots break youtube's TOS

slate swan
slate swan
quick gust
#

spotify_dl

slate swan
#

Hm, I dont think thats a good idea though ;-;

#

Lemme see

#

!pypi spotify_dl

unkempt canyonBOT
slate swan
#

Okay currently I'm working on slash commands so i thought i should learn more coz many of things are now copy/pasta

nimble plume
nimble plume
green bluff
#

what is wrong with this

nimble plume
#

permissiomn

#

of the user

#

is not true

slate swan
vocal snow
green bluff
#

dw i got it

slate swan
green bluff
slate swan
#

Okay

green bluff
#

ty do

frozen elk
quick gust
flat solstice
slate swan
flat solstice
#

Huh, that's not a bad idea, no wonder I didn't think of it

slate swan
#

it was working before, but then how come after i changed the bot token and bot app, it doesnt work anymore

#

eol while scanning literal

#

pls help thx

snow ibex
#

The indent seems off i don't know tho

slate swan
#

?

snow ibex
#

Are you using on message to make commands

slate swan
#

yeah

snow ibex
#

Hmm can you show the whole on message

slate swan
#

import discord
from discord.ext import commands
from discord.ext import tasks

import time
import random
import asyncio
import json
import os

class MyClient(discord.Client):
async def on_ready(self):
print('Logged on as', self.user)
version = discord.Activity(type=discord.ActivityType.watching, name=f"{len(client.guilds)} servers!")
await client.change_presence(status=discord.Status.online, activity=version)

#chatbot
async def on_message(self, message):
# don't respond to ourselves
if message.author == self.user:
return

#

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

slate swan
snow ibex
#

Ah i see

slate swan
#

cuz my discord accct recently got disabled so i had to create a new bot application

snow ibex
#

You should probably make actual commands instead of using on message

slate swan
#

nah it would take too long

snow ibex
#

Oh wait

#

I'm stupid

#

Hmm

#

Have you tried removing the #bot command comment

#

Don't know if it will fix it

snow ibex
#

But that indent seems off to em

snow ibex
slate swan
#

hmm ok

#

still error

#

help for server unlock

slate swan
#

Maybe where you replaced the bot token??

slate swan
#

stop spamming

slate swan
slate swan
slate swan
velvet tinsel
#

I am a PEP8 regulator

#

And also true would make an error

#

It should be True

slate swan
slate swan
slate swan
slate swan
velvet tinsel
#

what the fuck

slate swan
#

😂

velvet tinsel
#

Liar

#

he uses # as a comment

slate swan
#

🤣

visual island
velvet tinsel
#

And also JavaScript should have a semicolon

slate swan
velvet tinsel
#

@slate swan bruh

slate swan
#

this is where it came from

visual island
slate swan
visual island
#

you dont really need it

visual island
slate swan
slate swan
velvet tinsel
visual island
velvet tinsel
#

I thought you said the profile picture was js

#

I was scared for a second

slate swan
visual island
#

ah

#

ctx.channels doesn't exist

slate swan
#

if i set it to true bro then even one which have muted will got burrrrrrrrrrrrr

slate swan
visual island
#

use the channel var you defined in the loop

slate swan
twilit merlin
#

Hey all

#

I want to learn python

slate swan
#

go watch a tutorial and start no one is going to spoonfeed

#

ye

#

yep

twilit merlin
slate swan
slate swan
unkempt canyonBOT
#
Resources

The Resources page on our website contains a list of hand-selected learning resources that we regularly recommend to both beginners and experts.

slate swan
visual island
slate swan
#

lets check

twilit merlin
#

!resources

visual island
#

but, are you sure you didn't get any error before?

slate swan
#

show code

slate swan
visual island
#

you probably forgot to close a quote or something on the lines above

slate swan
#

not all

#

Find this line in your code and check the syntax

#

changed only for 1 channel

#

bad indentation, you cannot use await outside the function

visual island
#

you forgot one )

slate swan
slate swan
#

if you dont get one, maybe your error handler is blocking it

slate swan
#

hm then you miss the closing bracket for send

#

he wanted to say bracket

visual island
frozen elk
slate swan
#

You added an extra bracket in first line

#

t_okmeow all hardwork

gusty hatch
#

can someone send discord components link

slate swan
#

!pip discord-components

unkempt canyonBOT
maiden fable
slate swan
vale wing
#

Pretty sure it is commands.Bot

gusty hatch
#

oh

slate swan
#

eol while scanning literal error /discord.py/ pls help me thx

gusty hatch
#

i knew that

slate swan
#

my discord accct recently got disabled so i had to create a new bot application, it was working before, but then how come after i changed the bot token and bot app, it doesnt work anymore

vale wing
slate swan
vale wing
#

Migrate then, it is not a good method

slate swan
#

currently

vale wing
#

And I doubt the error is in those strings

slate swan
vale wing
slate swan
#

k

#

thx

vale wing
#

But not in the strings you sent here

slate swan
#

oh ok

#

its thousands of lines of code :/

slate swan
#

whats a redirect url?

#

how do i publish bots?

#

pls help me :/

visual island
visual island
slate swan
#

cuz my discord account got disabled and then recently i created new account.

#

then i dont know how to do it :/

placid skiff
#
Traceback (most recent call last):
  File "C:\Users\giacomo.dimatteo\AppData\Local\Programs\Python\Python310\lib\site-packages\disnake\ext\commands\common_bot_base.py", line 415, in _load_from_module_spec
    spec.loader.exec_module(lib)  # type: ignore
  File "<frozen importlib._bootstrap_external>", line 883, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "C:\Users\giacomo.dimatteo\PycharmProjects\GamingNetwork\lib\cogs\WildRiftTeams.py", line 77, in <module>
    class WildRiftTeams(Cog):
  File "C:\Users\giacomo.dimatteo\PycharmProjects\GamingNetwork\lib\cogs\WildRiftTeams.py", line 82, in WildRiftTeams
    async def wr_team(self):
  File "C:\Users\giacomo.dimatteo\AppData\Local\Programs\Python\Python310\lib\site-packages\disnake\ext\commands\slash_core.py", line 647, in decorator
    return InvokableSlashCommand(
  File "C:\Users\giacomo.dimatteo\AppData\Local\Programs\Python\Python310\lib\site-packages\disnake\ext\commands\slash_core.py", line 340, in __init__
    options = expand_params(self)
  File "C:\Users\giacomo.dimatteo\AppData\Local\Programs\Python\Python310\lib\site-packages\disnake\ext\commands\params.py", line 388, in expand_params
    inter_param = parameters[1] if cog else parameters[0]
IndexError: list index out of range
#

importing cogs i have this error, how to fix it?

visual island
slate swan
#

before i didnt need to...

visual island
slate swan
#

before this i can add the bot directly to servers

visual island
slate swan
#

why now cannot? need own domain?

visual island
slate swan
#

how do i find the invite url?

visual island
#

Your app -> OAuth2 -> URL Generator -> select scopes (usually Bot and Application Commands) & perms you need -> Copy Link (on the button of the page)

slate swan
#

ok let me try it

#

@bot.command()
@commands.has_any_role(692760082085183519, 940008547993927691)
async def kick(ctx, member: discord.Member, *, reason=None):
   await member.kick(reason=reason)
   emb=discord.Embed(title="Кик пользователя", description="**__Информация:__**", color=discord.Color.from_rgb(0, 255, 0), timestamp=ctx.message.created_at)
   emb.set_footer(text="© Все права защищены The Greatest", icon_url=ctx.author.avatar_url)
   emb.add_field(name="**Участник:**", value=f"**{member.name}** ({member.mention})", inline=False)
   emb.add_field(name="**ID:**", value=f"**{member.id}**", inline=False)
   emb.add_field(name="**Кикнул:**", value=f"**{ctx.author.name}**", inline=False)
   emb.add_field(name="**Причина:**", value=f"Скоро", inline=False)
   emb.add_field(name="**Канал:**", value=f"**<#{message.channel.id}>**", inline=False)

   await ctx.reply(embed=emb)

Not working embed, why?

#

Guys guys, how do I get all the commands inside one cog after a command is invoked in another cog ;-;

visual island
#

bot.get_cog() then cog.get_commands()

slate swan
visual island
slate swan
#

🤔

visual island
#

any error?

visual island
#

👍

slate swan
#

No, the participant kicks, but the embed does not work, there is nothing in the console

crisp haven
#

Guys, I was able to run my bot for three months and then now somehow its not working

crisp haven
#

is this possible to happen
The owner of this website (discord.com) has banned you temporarily from accessing this website.</p>

slate swan
#

Yes

#

how to let my bot display "add to server" button?

#

pls help thx, how to let my bot display "add to server" button?

visual island
# slate swan pls help thx, how to let my bot display "add to server" button?

How to get the Add to server button to your bot's profile:

Article: https://discord.com/blog/discord-bots-and-app-discovery-announcement

Discord Developer Portal

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

Gather 'round, bot fans and soon-to-be fans: we've got some long-anticipated news: app discovery is coming to Discord!

visual island
slate swan
#

Okay

random sleet
#

Do someone know how i add a question? when i do it skips the question. Nothing in cmd

    'Hvad hedder du IRL?',
    'Hvor gammel er du IRL?',
    'Hvor mange timer har du i FiveM?'
]

a_list = []


@bot.command(aliases=['staff-application'])
async def staff_application(ctx):
    a_list = []
    submit_channel = bot.get_channel(940207300885487636)
    channel = await ctx.author.create_dm()

    def check(m):
        return m.content is not None and m.channel == channel

    for question in q_list:
        sleep(.5)
        await channel.send(question)
        msg = await bot.wait_for('message', check=check)
        a_list.append(msg.content)

    submit_wait = True
    while submit_wait:
        await channel.send('Din ansøgning er færdig - "send" for at indsende din ansøgning.')
        msg = await bot.wait_for('message', check=check)
        if "send" in msg.content.lower():
            submit_wait = False
            answers = "\n".join(f'{a}. {b}' for a, b in enumerate(a_list, 1))
            submit_msg = f'Ansøgning fra: {msg.author} \nAnsøgning:\n{answers}'
            await submit_channel.send(submit_msg)
            await ctx.send("Din ansøgning er nu send afsted.")```
visual island
visual island
slate swan
#

Yes

#

There is nothing in the console

visual island
#

did the member got kicked?

slate swan
#

Yes

visual island
#

do you have an error handler?

slate swan
#

No

light violet
#

client.add_cog(Antinuke(client))
TypeError: init() missing 1 required positional argument: 'headers'

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

Traceback (most recent call last):
File "/home/runner/losoclientsdsdsds/events/bot.py", line 36, in init
self.load_extension(cog)
File "/home/runner/losoclientsdsdsds/venv/lib/python3.8/site-packages/discord/ext/commands/bot.py", line 678, in load_extension
self._load_from_module_spec(spec, name)
File "/home/runner/losoclientsdsdsds/venv/lib/python3.8/site-packages/discord/ext/commands/bot.py", line 623, in _load_from_module_spec
raise errors.ExtensionFailed(key, e) from e
discord.ext.commands.errors.ExtensionFailed: Extension 'events.AntiNuke' raised an error: TypeError: init() missing 1 required positional argument: 'headers'

wht to do

#

class Antinuke(commands.Cog):
def init(self, client, headers):
self.client = client
self.color = 0x2f3136
self.headers = headers

visual island
# slate swan No

now try putting debug prints before .kick() and after it, and see where it stops

light violet
#

pls help

visual island
slate swan
#

Okay

slim ibex
#

hello everyone I am back

visual island
light violet
#

ok

light violet
#

this?

slim ibex
#

move self.headers above self.color

light violet
#

lemme try

slim ibex
#

and the error seems like it’s from your setup function

visual island
slim ibex
#

which means you need to pass headers into the setup function

#

cog_name(bot, headers)

light violet
#

actully i wanted to make this work

@commands.Cog.listener()
    async def on_member_ban(self, guild, user):
        start = datetime.datetime.now().timestamp()
        reason = "R Anti-Nuke | Banning Members"
        async with aiohttp.ClientSession(headers=self.headers) as session:
                    
                async with session.put("https://discord.com/api/v9/guilds/%s/bans/%s" % (guild.id, user), json={"reason": reason}) as r:
                            took = round((datetime.datetime.now().timestamp() - start), 3)
                            
                            if r.status in (200, 201, 204):
                                logging.info("Successfully banned %s" % (user))
                                c = self.bot.get_channel(940206336824737804)
                                await c.send(f"Banned %s, took: {took}" % (user))
                            else:
                                logging.error(f"Could not ban %s" % (user))   ```
#

@slim ibex@visual island

slim ibex
#

you probably should only use this self.headers in the function it is needed so the constructor isn’t fucked

dry junco
visual island
crisp haven
light violet
serene mantle
light violet
serene mantle
#

Trust me.

light violet
#

i got this faster

serene mantle
#

Learn

visual island
serene mantle
#

The api wrapper is so much simpler

velvet tinsel
light violet
serene mantle
crisp haven
serene mantle
#

There’s this YouTube series it’s super helpful

visual island
unkempt canyonBOT
#

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

Bans this member. Equivalent to [`Guild.ban()`](https://discordpy.readthedocs.io/en/master/api.html#discord.Guild.ban "discord.Guild.ban").
crisp haven
light violet
visual island
slate swan
#

how much field can i add to the embed

serene mantle
serene mantle
crisp haven
#

nothing much, I accidentally deleted the code but then was able to restore everything back to normal and then clicked run

serene mantle
crisp haven
#

it was ok from yesterday until few hours ago

light violet
light violet
crisp haven
#

it was running fine for three months straight tho

slate swan
serene mantle
visual island
slate swan
#

i need answer fast

serene mantle
visual island
slate swan
sage otter
light violet
#

till

flat solstice
# slate swan Make the ID a combination of `str(user_id) + datetime.now().isoformat()`. It'll ...

okay so this is where I'm at so far```py
from apscheduler.schedulers.asyncio import AsyncIOScheduler

bot.scheduler = AsyncIOScheduler(event_loop=bot.loop) py
import asyncio
import logging
import typing
import discord

from discord.ext import commands
from discord.utils import get
from utils import checks
from datetime import datetime, timedelta
from typing import Optional, Union
from classes.converters import DateTime
#from apscheduler.schedulers.background import BackgroundScheduler
from apscheduler.schedulers.asyncio import AsyncIOScheduler

log = logging.getLogger(name)

class Reminder(commands.Cog):
def init(self, bot):
self.bot = bot

async def remind_user(self, member):
    #send_message_to_user_about_reminder_time_completion()
    user = await self.bot.get_member_guild(member.id, member.guild.id)
    reminders = await self.bot.get_reminders(member.id, member.guild.id)
    embed = discord.Embed(title = "Here's your reminder!", description = "{reminders[5]}", timestamp = reminders[6])
    if user[9] == True:
        await member.send(embed = embed)
    else:
        ctx_channel = await self.bot.fetch_channel(reminders[7])
        await ctx_channel.send(embed = embed)

async def create_reminder(self, time, channel, user_time):
    self.bot.scheduler.add_job(self.remind_user, 'interval', seconds=time, id=user_time)
    await channel.send("Your reminder has been scheduled.")

async def cancel_reminder(self, reminder, channel):
    self.bot.scheduler_remove_job(reminder)
    await channel.send("Your reminder has been removed sucessfully.")

@commands.command(description = "Create a reminder.", usage = "send <server ID> <message>")
async def remind(self, ctx, time: DateTime, *, message: str):
    user_time = str(ctx.author.id + datetime.now().isoformat)
    await ctx.reply(f"Okay {ctx.author}, I'll remind you about your reminder `{user_time}` '{message}' in {time}")
    await self.create_reminder(time, ctx.channel, user_time)
    async with self.bot.pool.acquire() as conn:
        await conn.execute("UPDATE reminder SET message=$1, time=$2, ctx_channel=$3 WHERE author=$4", message, time, ctx.channel.id, user_time)
@commands.command(description = "Create a reminder.", usage = "send <server ID> <message>")
async def delremind(self, ctx, reminder: str):
    await self.cancel_reminder(reminder, ctx.channel)

def setup(bot):
bot.add_cog(Reminder(bot))```any of this looking immediately incorrect?

final iron
slim ibex
visual island
light violet
#

keybord rip

#

+_+

slim ibex
visual island
#

anyways ```py
headers = { 'Authorization': f'Bot {self.bot.http.token}', 'Content-Type': 'application/json' }

flat solstice
visual island
slim ibex
#

you should remove unused imports. It populates the namespace with unneeded stuff

visual island
#

nothing to do with your code

light violet
crisp haven
#

And also what does this mean?

slim ibex
#

Don’t push a localhost server to production

#

it’s just for development

slim ibex
#

It’s running on your local machine

visual island
#

wait

crisp haven
visual island
#

not there

light violet
slim ibex
crisp haven
#

ouh but then I didnt push it to production at all

visual island
light violet
#

ok

slim ibex
#

deploying it entails uploading all the code to a hosting service, getting SSL certificates, getting a domain, etc

slim ibex
light violet
crisp haven
#

ahh ok, but then somehow its not running and its saying I got temporarily banned somehow by doing nothing

visual island
#

depends on your var

light violet
#

ok

crisp haven
gusty hatch
#

why do i keep getting interaction failed on my dropdown/select menu

gusty hatch
#

theres literally nothing wrong with my code

slim ibex
#

!code

unkempt canyonBOT
#

Here's how to format Python code on Discord:

```py
print('Hello world!')
```

These are backticks, not quotes. Check this out if you can't find the backtick key.

gusty hatch
#

one monute it works the other it doesnt

slim ibex
#

maybe it timed out

light violet
#

@slim ibex@visual islandthanks 4 ur helps it worked thanks a lot

slim ibex
#

np

gusty hatch
#

theres no timeout

slim ibex
#

maybe the api is being stupid

#

idk

light violet
#

i think so

final iron
light violet
#

to make fast response

final iron
#

The difference is most likely a matter of 10s of milliseconds

#

It does not matter

light violet
#

yes i need that diff only

#

i want to make the fastest

slim ibex
final iron
slim ibex
#

Speed isn’t everything

slim ibex
final iron
#

Its extremely slow compared to other languages

light violet
#

it matters like in threaded antinuke even the fastest nuker can bypass it with 5 bans btw normal antinuke it bypasses with 50 bans

light violet
slim ibex
#

yeah when ur making a fucking OS

light violet
#

bruh no

#

i cant make u understand

#

actually

random sleet
slate swan
lost vine
#

Someone help me with this error please. I'm using discord.py v2.0

slate swan
#

Removed in 2.0

#

This link is of 1.7

lost vine
slate swan
#

emoji.url?

lost vine
#

It needs the Asset type

slate swan
#

iirc 2.0 has some (a lot?) changes related to Asset and stuff

sage otter
unkempt canyonBOT
#

with_static_format(format, /)```
Returns a new asset with the specified static format.

This only changes the format if the underlying asset is not animated. Otherwise, the asset is not changed.
sage otter
#

there’s also Asset.with_format

slate swan
#

Is Emoji also an asset?

lost vine
slate swan
sage otter
#

Excuse me my bad.

lost vine
#

then how can I convert it into an asset

flat solstice
sage otter
#

What’s the implementation again. If you mind me asking.

lost vine
#

Ughh what

sage otter
#

Like what’s your goal?

lost vine
#

And I want to convert the emoji into an asset url

sage otter
#

you're using Guild.create_custom_emoji()

#

That takes bytes.

#

So you could use Emoji.read()

slate swan
#

emoji.url will also return you the url of emoji.. I guess it should work for your application? Can you just share more code please?

sage otter
#

if you have an emoji object already.

lost vine
lost vine
slate swan
#

url is not a callable

#

Just do emoji.read() and remove asset

lost vine
#

let me have a try

#

@slate swan thank you so much bro

slate swan
#

Np 👍

boreal ravine
#

why are you guys spoonfeeding them

#

you gave no description on what emoji.read() does

#

.

pale turtle
#

Not sure if this is the place to ask, but does someone have any API's for currency? Like bitcoin, dogecoin and all of that?

sage otter
#

Coinbase

sage otter
pale turtle
#

Does it require an API key or something?

slate swan
#

Kick command, embed doesn't work, why?

#

@bot.command()
@commands.has_any_role(692760082085183519, 940008547993927691)
async def kick(ctx, member: discord.Member, *, reason=None):
    await member.kick(reason=reason)
    emb=discord.Embed(title="Кик пользователя", description="**__Информация:__**", color=discord.Color.from_rgb(0, 255, 0), timestamp=ctx.message.created_at)
    emb.set_footer(text="© Все права защищены The Greatest", icon_url=ctx.author.avatar_url)
    emb.add_field(name="**Участник:**", value=f"**{member.name}** ({member.mention})", inline=False)
    emb.add_field(name="**ID:**", value=f"**{member.id}**", inline=False)
    emb.add_field(name="**Кикнул:**", value=f"**{ctx.author.name}**", inline=False)
    emb.add_field(name="**Причина:**", value=f"Скоро", inline=False)
    emb.add_field(name="**Канал:**", value=f"**<#{message.channel.id}>**", inline=False)

    await ctx.reply(embed=emb)
minor bobcat
#

how do u get emoij's in code

#

cause sometimes it works and sometimes it doesnt

slate swan
#

Where?

#

@rocky forum

rocky forum
final iron
slate swan
#

🤔

final iron
#

What

slate swan
#

Russia

rocky forum
final iron
#

<@&831776746206265384>

slate swan
#

🤔

honest vessel
#

its ascam

#

<@&831776746206265384>

deep sorrel
#

mm

#

yes

#

hold on

honest vessel
#

remove link n ban

deep sorrel
#

!ban 306892975936372738 Steam scam

unkempt canyonBOT
#

failmail :ok_hand: applied ban to @wide pawn permanently.

final iron
#

He clicked on the link someone posted before

rocky forum
final iron
honest vessel
#

@final iron its ok clicking but if u trade it gonna steal all ur items but gonna look like u get items

final iron
#

I pinged moderators for a reason...

slate swan
#

I would like to convert this bot command into a function that i can call from another python file. When I call the function that the function sends the embeded message to a specific channel

    # Embded message command shows the embded info
    @commands.command(name="hello")
    @commands.has_role("Admin")
    async def hello(self, ctx: commands.Context):
        
        embed = discord.Embed(title="productname", url="https://test.com", colour=0x87CEEB, timestamp=datetime.utcnow())
        embed.set_author(name="retailer", icon_url="https://avatars.githubusercontent.com/u/16879430")
        embed.add_field(name="test", value="test", inline=False)
        embed.add_field(name="test", value="An inline field!", inline=True)
        embed.add_field(name="Field 3", value="Look I'm inline with field 2!", inline=True)
        embed.set_footer(text="Some footer!", icon_url="https://cdn.discordapp.com/emojis/754736642761424986.png")
        await ctx.send(embed=embed)
final iron
#

Or make ctx a parameter in the function

honest vessel
#

or send as webhook

slate swan
slate swan
neon ruin
#

yes

honest vessel
#

u can send embeds as webhooks to

slate swan
honest vessel
#

@slate swan do u mean u wanna send embed wen u run a python script, or u want same embed in another cog?

placid skiff
#

get a user with only his mention without using converters?

slate swan
honest vessel
#

if i understand u correct, then i would check webhooks u need like 2lines of code

slate swan
honest vessel
#

aight hold on one sec

#

@slate swanhttps://pypi.org/project/discord-webhook/#basic-webhook

#
from discord_webhook import DiscordWebhook, DiscordEmbed

webhook = DiscordWebhook(url='your webhook url')

# create embed object for webhook
# you can set the color as a decimal (color=242424) or hex (color='03b2f8') number
embed = DiscordEmbed(title='Your Title', description='Lorem ipsum dolor sit', color='03b2f8')

# add embed object to webhook
webhook.add_embed(embed)

response = webhook.execute()
``` an example of embed
slate swan
#

Niceee

slate swan
honest vessel
#

whats cool with webhooks is you can change avatar and names like it would look like diffrent bots etc

slate swan
#

going to play with it

compact ruin
#

Guys how do i format the cooldown for commands in minutes and not seconds

#

i cant find it in API or im just blind

honest vessel
#
msg = "Hello WOrld"
nick = "This is a bot!"
thumb = "https://url_to_an_avatar_here"

webhook = DiscordWebhook(url="https://discord.com/api/webhooks/....",
content=msg,
username=nick,
avatar_url=thumb,
rate_limit_retry=True
)
``` @slate swan
#

if you want diffrent names n avatars

honest vessel
#

@compact ruinhttps://stackoverflow.com/questions/775049/how-do-i-convert-seconds-to-hours-minutes-and-seconds here are few examplpes

#

i think most common is like those

def sec_to_hours(seconds):
    a=str(seconds//3600)
    b=str((seconds%3600)//60)
    c=str((seconds%3600)%60)
    d=["{} hours {} mins {} seconds".format(a, b, c)]
    return d


print(sec_to_hours(10000))
# ['2 hours 46 mins 40 seconds']

print(sec_to_hours(60*60*24+105))
# ['24 hours 1 mins 45 seconds']

#
  def time_format(seconds: int):
    if seconds is not None:
        seconds = int(seconds)
        d = seconds // (3600 * 24)
        h = seconds // 3600 % 24
        m = seconds % 3600 // 60
        s = seconds % 3600 % 60
        if d > 0:
            return '{:02d}D {:02d}H {:02d}m {:02d}s'.format(d, h, m, s)
        elif h > 0:
            return '{:02d}H {:02d}m {:02d}s'.format(h, m, s)
        elif m > 0:
            return '{:02d}m {:02d}s'.format(m, s)
        elif s > 0:
            return '{:02d}s'.format(s)
    return '-'

sory kinda offtopic...

dry junco
#

im confused how i make a bot that has currency
a ik someone told it to me yesterday but im still confused

slate swan
compact ruin
#

Managed to make my own

dry junco
#

a does someone have 24/7 music bot that i could use on my server ?

serene mantle
#

Is there any way of banning users based on if they’ve been marked as spammers?

hardy wing
#

anyone know some free websites I can use for API?

sinful fern
#

For what

velvet haven
#

how to change bot status

#

like from playing to listening

slate swan
sinful fern
flat solstice
#

isn't there a way to code idents like /n? I keep doing >>> text in my code but I'm pretty sure there's a easer way right?

maiden fable
#

!d discord.ext.commands.Bot.change_presence @velvet haven

unkempt canyonBOT
#

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

Changes the client’s presence.

Example

```py
game = discord.Game("with the API")
await client.change_presence(status=discord.Status.idle, activity=game)
```   Changed in version 2.0: Removed the `afk` keyword-only parameter.
serene mantle
#

Anyone know a way to check if a user is marked as a spammer?

maiden fable
#

Not possible

flat solstice
# maiden fable Mind giving an example?

>>> text would be

text
and i thought i saw someone mention here the other day that there's a way to code that with something like /n newline but I can't remember what it was, if they even gave a example

serene mantle
#

Damn

slate swan
serene mantle
#

I guess I’m gonna import a whole another api wrapper

#

Just for one feature

slate swan
#

just change all discord s to Disnake?

#

everything's same

serene mantle
#

Eh

#

I heard there are issues with disnake

maiden fable
#

Nope?

#

BTW there's hikari and rin too

serene mantle
#

Disnake works fine right now?

maiden fable
#

!pypi rin is also a great choice

unkempt canyonBOT
slate swan
#

you heard wrong

serene mantle
#

Yes I’ve heard about hikari

slate swan
serene mantle
#

What do you guys think I should migrate to?

#

Hikari or disnake

maiden fable
#

I would like u to check out rin too

slate swan
#

hikari if you're able to rewrite your complete bot
Disnake if you don't want to

serene mantle
serene mantle
#

Are we talking like

#

Change some variables or re do everything

slate swan
maiden fable
# serene mantle Why Rin?

It got some good non mainstream API implementations which I like tbh. No harm in checking it out at least haha

slate swan
#

Hikari is not a fork, it's a complete different library

serene mantle
#

Ohh

#

I see

slate swan
#

and so is rin

serene mantle
#

So I’d have to re do everything if I go with either

#

If I do decide to migrate

#

Which would you guys recommend?

#

Hikari or rin

maiden fable
#

I would prefer u to checkout both of them. Rin is still a WIP, but can be used for some bots, hikari is a complete framework

slate swan
#

my name's biased

serene mantle
#

Lol

serene mantle
#

I think Il just move to disnake

#

For what I’m doing it doesn’t seem like there’s enough reason to rewrite

slate swan
#

Sure, Disnake is a good choice as well

bitter field
#

Is it possible to add a hook to all commands in discord.py? Essentially i just want to log how often each command gets called.

serene mantle
#

Then another command that will return all those variables for each command

slate swan
#

when coding a bot, how do i reference a user?

#

or mention one

ebon island
#

ctx.author will get the user that sent the message for example

#

and you can do ctx.author.mention and it will mention them

#

How expensive is calling get_server or get_channel to get the respective Guild or Channel objects from an ID? I have IDs stored in my Redis DB but I can't serialize the objects nor do I really "need" to serialize them either, I'm trying to think of alternative methods of storage, perhaps even something like a nested in memory dictionary as I imagine that will be my most lightweight and performant option. Any ideas?

vale wing
vale wing
ebon island
#

Okay 🙂 So it isn't making an API call to do that? Excellent!

#

I have another question as well

#

regarding the use of a get_prefix function, take for example the following:

async def get_prefix(client, message):
    if not message.guild:
        return commands.when_mentioned_or(client.default_prefix)(client, message)
    curr_server = await helpers.get_local_server_object(message)
    prefix = curr_server.prefix
    return commands.when_mentioned_or(prefix)(client, message)

Is this get prefix called every time a command is sent? My reason for asking is if I were accessing a Database to get prefix it might be expensive to call, is that the case or is it in memory?

quick gust
#

every time a message is sent

#

see the message param?

ebon island
#

Hmm, okay, that could potentially get expensive

quick gust
#

yep

ebon island
#

I'm going to have to think about how to do it in that case 🙂 Thank you!

#

However, I can take advantage of that as well, I could have some logic that gets just the prefix from say redis db but if the server isn't already in the redis DB it can do that work so that I can guarantee elsewhere that any server sending commands has a server reference in Redis DB, and can also use that to do initial setup for in memory storage stuff

#

so it might be a blessing in disguise 🙂

#

That way I don't have to check for that anywhere else since it is guaranteed to be handled before any command is even registered

#

Thank you 🙂

prime ibex
pliant gulch
#

Another good choice is having a redis caching layer which many large companies do

ebon island
#

I was considering that, but it could get outdated as well

#

I am using Redis as my primary DB so I imagine it will be relatively expensive since it can make atomic requests and just get the intended value

pliant gulch
#

How would it get outdated?

ebon island
#

I will use caching anyway to track tasks either way

pliant gulch
#

Just make sure to update the cache when a user uses a command to set the prefix

ebon island
#

I will eventually have other applications that are able to change the prefix though

#

but maybe I could set up something like a redis stream and have a listener for changes to the prefix so that it updates

#

so I could work around that as well

pliant gulch
#

If your other applications are able to access the in-memory cache that would be ideal, but you could probably also do that

ebon island
#

They will all access my API which will access the Redis DB datastore but I can make it so that when the API writes to the Redis DB it also creates an item in the redis stream and the other apps can react to that or not if not needed

hollow plank
#

not working autorole?

ebon island
#

What is it doing when you attempt this?

slate swan
#

can someone help me get this 🇾 into a reaction?

#

I keep getting an error of "emoji argument must be str, Emoji, or Reaction not NoneType."

hollow plank
ebon island
#

Looks like add_roles wants a list

slate swan
#
emoji = client.get_emoji(940273239920377896)
emoji = discord.utils.get(client.emojis, name=':regional_indicator_y: ')
#

ive tried those two

ebon island
#

so try [role]

hollow plank
#

okayy

ebon island
#

Actually, I might be mistaken, I think the *roles just makes it into a list

hollow plank
#

still not working

ebon island
#

per a little searching, this appears to be a potential solution

#

instead of passing in role pass in the following:

discord.utils.get(user.guild.roles, name=role)
#
async def addrole(ctx):
    user = ctx.message.author 
    role = 'role' #change the role here
    try:
        await user.add_roles(discord.utils.get(user.guild.roles, name=role)) 
    except Exception as e:
        await ctx.send('Cannot assign role. Error: ' + str(e))
#

ctx.message.author is probably not necessary, ctx.author I think suffices in current dpy

#

but give that a try and see if that works for you 🙂

hollow plank
#

👍

#

wait

#

still not working

quick gust
hollow plank
#

Ignoring exception in on_member_join Traceback (most recent call last): File "C:\Users\Atk\AppData\Local\Programs\Python\Python38\lib\site-packages\discord\client.py", line 343, in _run_event await coro(*args, **kwargs) TypeError: on_member_join() missing 1 required positional argument: 'user'

#

but

quick gust
#

you're inside a cog

#

pass in self before member

tender estuary
#

not user.mention but self.user.mention?

quick gust
#

no..?

tender estuary
#

was a question

quick gust
#

also @hollow plank you have 2 on_member_join events, just combine them

quick gust
hollow plank
#

im trying but

#

i tried something but still not working

#

this is my first time with cogs

#

can somebody help me bros

kindred epoch
hollow plank
#

autorole

#

but no errors

kindred epoch
#

try using get_role

hollow plank
#

ha?

kindred epoch
#

!d discord.Guild.get_role

unkempt canyonBOT
honest vessel
#

@hollow plankkinda fun you have long await with send() in same lines, but defines member_role = "member" instead of name="member"

hollow plank
#

man i tried hundred times, hundred different variations

maiden fable
#

👀

hollow plank
#

cogs

slate swan
cold sonnet
#

a discord.User doesn't have a guild

hollow plank
#

still not working

maiden fable
#

u know...

cold sonnet
#

does it launch

hollow plank
#

yes

cold sonnet
#

how you know

hollow plank
#

maybe its not problem in code

maiden fable
#

you cannot convert an arg to something in an event

#

It only happens in commands

cold sonnet
#

how do you know it launches

maiden fable
#

What happened tho

hollow plank
#

no errors just nothing bro

cold sonnet
#

then it don't launch

hollow plank
#

:c

cold sonnet
#

add a print statement to the start of the listener

maiden fable
#

intents?

#

👀

hollow plank
#

print working :c

cold sonnet
#

or make sure you have all of these:
init with every requirement
setup function outside of cog
load the cog

hollow plank
cold sonnet
#

then surely an error happened mid-code and your error handler ate it up

maiden fable
#

not possible

cold sonnet
#

how

maiden fable
#

As long as u don't override on_error, errors are not eatable in events

#

What's the issue tho

hollow plank
#

._.

cold sonnet
#

got an error handler?

hollow plank
#

no error

cold sonnet
hollow plank
#

ahh

cold sonnet
hollow plank
#

no

cold sonnet
#

damnit

hollow plank
#

idk what to do

slate swan
#

Kick command, embed doesn't work, why?

#

@bot.command()
@commands.has_any_role(692760082085183519, 940008547993927691)
async def kick(ctx, member: discord.Member, *, reason=None):
    await member.kick(reason=reason)
    emb=discord.Embed(title="Кик пользователя", description="**__Информация:__**", color=discord.Color.from_rgb(0, 255, 0), timestamp=ctx.message.created_at)
    emb.set_footer(text="© Все права защищены The Greatest", icon_url=ctx.author.avatar_url)
    emb.add_field(name="**Участник:**", value=f"**{member.name}** ({member.mention})", inline=False)
    emb.add_field(name="**ID:**", value=f"**{member.id}**", inline=False)
    emb.add_field(name="**Кикнул:**", value=f"**{ctx.author.name}**", inline=False)
    emb.add_field(name="**Причина:**", value=f"Скоро", inline=False)
    emb.add_field(name="**Канал:**", value=f"**<#{message.channel.id}>**", inline=False)

    await ctx.reply(embed=emb)
quick gust
#

firstly, any error?

slate swan
#

There is no error, the person kicks, but there is no embed

quick gust
#

do u have an on_command_error event?

slate swan
#

No

honest vessel
#

i mean is that even possible overall

slate swan
#

why not

honest vessel
#

i dont know just asking

#

maybe reply is blocking embeds

slate swan
#

🤔

honest vessel
#

@slate swantry your reply with just a simple string

slate swan
honest vessel
#

ah ok

#

thanks for clearify tho

quick gust
slate swan
#

I did and with await ctx.send the embed was not displayed either

quick gust
#

how do I hide the jishaku cog from displaying in my help command?

slate swan
honest vessel
#

name="**Участник:**" dosnt this get bold anyway?

#

without *

slate swan
quick gust
quick gust
#

okay

honest vessel
#

@slate swanone error that happens with embes can usally be urls, but would't know why it cant show avatar url

#

are you sue it prints a correct url?

slate swan
#

Remove url?

honest vessel
#

you can basicly just do

@bot.command()
@commands.has_any_role(692760082085183519, 940008547993927691)
async def kick(ctx, member: discord.Member, *, reason=None):
    print(ctx.author.avatar_url)
    return
#

to see if it gives a valid url

slate swan
#

Ok

honest vessel
#

i dont know correct but i know some always confuse avatar_url, and avatar.url

#

i think the later is correct tho

slate swan
honest vessel
#

what lol

slate swan
#

🤔

honest vessel
#

nvr copypasta from discord!

#

just write it as i show not copy it

#

but i start think its cause avatar_url is wrong its avatar.url

slate swan
#

Console:
https://cdn.discordapp.com/avatars/578931699686178817/ab47c4fbc78d6b9241bbe8a913f73e01.webp?size=1024

#

@honest vessel

honest vessel
#

ah ok then u got the url, i cant see any errors else

#

weird

slate swan
#

Error in another?

honest vessel
#

@slate swanmy eyes cant spot any errors, hard without errors helping what to look for

slate swan
#

Ok

#

🤔

neat tartan
slate swan
#

image came out ok

neat tartan
#

Then the url should be ok

slate swan
#

Then the url should be ok

#

🤔

neat tartan
#

Sorry im kinda jumping in the middle, whats the overall issue? Or a message link to the start to play catchup

slate swan
neat tartan
slate swan
#

🤔

neat tartan
#

When something works and doesnt throw an error but also isnt working as a person intends its very difficult to just be able to provide why it isnt working. The best thing to do is just manually troubleshoot /test the code to see where and then why its not doing what it should

vast gale
tardy veldt
#

hey

#
Python 3.8.2 (default, Feb 26 2020, 02:56:10)
 

Replit: Updating package configuration

--> python3 -m poetry add aiosqlite discord aiofiles aiohttp
Using version ^0.17.0 for aiosqlite
Using version ^1.7.3 for discord
Using version ^0.8.0 for aiofiles
Using version ^3.8.1 for aiohttp

Updating dependencies
Resolving dependencies...

  SolverProblemError

  Because no versions of discord match >1.7.3,<2.0.0
   and discord (1.7.3) depends on discord.py (>=1.7.3), discord (>=1.7.3,<2.0.0) requires discord.py (>=1.7.3).
  Because discord.py (1.7.3) depends on aiohttp (>=3.6.0,<3.8.0)
   and no versions of discord.py match >1.7.3, discord.py (>=1.7.3) requires aiohttp (>=3.6.0,<3.8.0).
  Thus, discord (>=1.7.3,<2.0.0) requires aiohttp (>=3.6.0,<3.8.0).
  So, because repl-python3-apollon depends on both discord (^1.7.3) and aiohttp (^3.8.1), version solving failed.

  at /opt/virtualenvs/python3/lib/python3.8/site-packages/poetry/puzzle/solver.py:241 in _solve
      237│             packages = result.packages
      238except OverrideNeeded as e:
      239return self.solve_in_compatibility_mode(e.overrides, use_latest=use_latest)
      240except SolveFailure as e:
    → 241raise SolverProblemError(e)
      242243│         results = dict(
      244│             depth_first_search(
      245│                 PackageNode(self._package, packages), aggregate_package_nodes
exit status 1

Package operation failed.

what is that
pls ping me

neat tartan
tardy veldt
#

how do i change that

neat tartan
#

Redownload it with the specific version

sacred reef
#

hi im trying to get all members in a role using role.members and im certain the name is correct. however when printed it will just return a empty list

[]

this is my code
tried using a for loop on it but that didnt work either, is there anything wrong

@bot.command()
async def test(ctx):
  role1 = discord.utils.get(ctx.guild.roles,name="telescience")
  print(role1.members)
neat tartan
#

roles,name

#

It should be .

sacred reef
#

no no that parts correct, i just removed the space because it looks better for me but ill try it

#

expression cannot contain assignment

#

thats what it says when i do that

#

so im pretty sure thats ok but it wont return anyone from the telescience role and im in that role

neat tartan
#

Gimme a moment to check the docs

neat tartan
sacred reef
#

ok

#

printed telescience

neat tartan
#

Looking at the docs guild.roles returns a list of all the server roles. Try getting rid of the ,name="telescience"
And see if it still prints it

sacred reef
#

it printed @~everyone

#

hold on

#

i think i know what the problem is

neat tartan
sacred reef
#

yea i got it working now

#

turned out i forgot to turn on member intents since this is a seperate test bot i used for experimenting new stuff with my friend

#

thanks for the help anyway

neat tartan
#

Ah, sorry i wasnt much help. Im still learning some of these things 😅

brave moth
#

ok, i need someone to review this code for me. this is a calculator code for my bot and i am using eval. however, someone is scaring me that people can exploit it, even if i put float or int. pls let me know how it is. i am using nextcord

        await interaction.response.defer() #goes to thinking stage
        result=float(eval(calculate))
        try:
            calculation = Embed(title="Result", color=0x00FFFF)
            calculation.add_field(name=calculate, value=result)
            await interaction.followup.send(embed=calculation) #answer
        except:
            invalid=Embed(description="That is not a valid calculation")
            await interaction.followup.send(embed=invalid) #no numbers or some fuckery```
kindred drum
#

Yo! anyone know how I would add overwrites to a channel? e.g. there are already specific ones but I want a new member to be able to view the channel
How would I add them to the channel while remembering the old overwrites

slate swan
#

is there slash commands in the 2.0 d.py?

green bluff
#

client not defined?

slate swan
#

self.client

green bluff
#

ohh okay

green bluff
#

and also i have a variable

#

self.client = client

slate swan
#

I have no idea sorry

cold sonnet
#

self.client

#

have you like

#

oop

#

and pass self to your function

#

@green bluff

green bluff
#

so

#

what

#

i dont understand

cold sonnet
#

pass self to your function

slate swan
#

it wont work for me like the tutorial in the docs

green bluff
cold sonnet
#

every function of a class