#discord-bots

1 messages · Page 1132 of 1

dusky pine
#

wtf is that

#

show the code

#

Put the applications_checks thing above the bot.command

frozen patio
#

👀

#

Oop

#

Well try it and see if what he suggested works'

#

Ok

#

@commands.has_role()

#

Try that?

#

Ok?

#

It's the same thing

slate swan
#

nope

frozen patio
#

Last time I checked

#

O yea the update

#

When did they change it?

#

Not what I said

#

What did nextcord change it to

#

Oh

slate swan
#

nothing, nextcord has its own application commands

frozen patio
#

I thought @commands.has_role() worked

slate swan
#

hi enzo

#

move the check about @bot.command

#

*above

frozen patio
#

Same error?

#

Then what was the error when you moved it up?

dusky pine
#

🤦 should've told us there was another error

frozen patio
#

Ikr

dusky pine
#

your interaction variable is not an interaction

#

that is not a slash command

#

no, try replacing @bot.command with @bot.slash_command

#

why did you name it interaction

frozen patio
#

then use ctx

dusky pine
#

AUGHHHHHHHH

#

ok whatever just rename it to ctx

frozen patio
#

You still don't pass in interaction to that

dusky pine
#

and ctx.user doesn't exist, it's ctx.author

slate swan
#

just change @bot.command to @bot.slash_command if you have that there

#

a context is passed for a command, and an interaction is passed for a slash command

dusky pine
#

they're not using slash commands 😭

#

codebase is confuse

slate swan
#

why are they using application checks then

dusky pine
#

idfk

slate swan
#

should be using commands.has_any_role as Jonathan said

dusky pine
#

app checks are for slash cmds

#

Nope

#

if you want these features just switch to slash commands

robust fulcrum
#

@shrewd apex can you exactly my tell me what type of genshin impact comamnd you are telling me

shell wing
#

ok sry for ping...but uk u told me to use railway and im having trouble...and the support server aint responding

#

💀

#
================
Using Buildpacks
================
20: Pulling from heroku/buildpacks
 
Digest: sha256:7edcb894ad034887d876fb911768789105483edcabd7c609246412733abb8ad3
Status: Image is up to date for heroku/buildpacks:20
 
20-cnb: Pulling from heroku/heroku
 
Digest: sha256:5cfc72ccdb10b0c0e877f1baa5d336042a134a1f50ff2aec11a8644c464e5113
Status: Image is up to date for heroku/heroku:20-cnb
 
Previous image with name "us-west1-docker.pkg.dev/railway-infra/railway-docker-users/project/08170e30-18c0-4da6-8746-ffc441708b82/service/799179a4-7ca1-4591-8c50-79591d23578e:d4ea14cf-b338-4d68-8254-b643f9c8bf1b" not found
===> DETECTING
 
ERROR: No buildpack groups passed detection.
ERROR: Please check that you are running against the correct path.
ERROR: failed to detect: no buildpacks participating
 
ERROR: failed to build: executing lifecycle: failed with status code: 20
cinder horizon
#

what exactly does on_disconnect do.......like obv it cant send a msg aftr iz been disconnected so....waz da use?

slate swan
#

there are more purposes

unkempt canyonBOT
#

Hey @shell wing!

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

shell wing
shell wing
slate swan
#

cool, do you have a requirements.txt in your github?

shell wing
cinder horizon
#

high time u did

slate swan
# shell wing i didnt made one...

thats the issue, how would the deployment know what libraries you need, create a requirements.txt, add the libraries you pip installed there

shell wing
#

just to see the hosting site and all

slate swan
#
discord.py
``` in your requirements.txt
shell wing
#

oh cool ima try

#

the intents are fine...but it still shows this error

drifting crescent
#

basicly

#

import requests

def get_inofs():
headers = {
"user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/94.0.4606.81 Safari/537.36 OPR/80.0.4170.63"}
info = requests.get("https://fake-it.ws/de/", headers=headers).text
infonames = ["Name", "Address", "City", "Postcode", "Phone", "BIC", "IBAN"]
infos = []
for i in infonames:
rawinfo = info.split(f'row">{i}')[1].split('To Copy">')[1].split('<')[0]
infos.append(rawinfo)

return {
    "Name": infos[0],
    "Address": infos[1],
    "City": infos[2],
    "Postcode": infos[3],
    "Phone": infos[4],
    "BIC": infos[5],
    "IBAN": infos[6]
}
#

is this a virus

#

or nah

slate swan
#

whats the problem?

#

its interaction.response.send_message

#

if team2 in user.roles
is thing condition even true?

#

... your code wont execute if this is False

#

add some print statements inside that to check it

shell wing
slate swan
#

great.

#

!d discord.ui.View the timeout kwarg

unkempt canyonBOT
#

class discord.ui.View(*, timeout=180.0)```
Represents a UI view.

This object must be inherited to create a UI within Discord.

New in version 2.0.
torn sail
#

Yep

slate swan
#

everything for nextcord is the same as discord.py except slash commands

faint dagger
#
ImportError: cannot import name 'SelectOption' from 'discord.ext'
ImportError: cannot import name 'Select' from 'discord.ext'```
What to do?
robust fulcrum
#

I am 😴 bored

#

Any possible command challenge for me?

spring flax
#

!d discord.SelectOption

unkempt canyonBOT
#

class discord.SelectOption(*, label, value=..., description=None, emoji=None, default=False)```
Represents a select menu’s option.

These can be created by users.

New in version 2.0.
slate swan
#

What is team2 ?

dusky pine
robust fulcrum
slate swan
#

The error told you that team2 is None.

dusky pine
#

I would consider using another library cheating

robust fulcrum
#

Hmmm not possible without any library

dusky pine
slate swan
#

But NoneType has no attribute called name ?

robust fulcrum
slate swan
#

well i guess you meant to use discord.Member maybe ?

dusky pine
#

!e

s = "2+2"

first_num = int(s[0])
op = s[1]
second_num = int(s[2])

if op == "+":
    print(first_num + second_num)
unkempt canyonBOT
#

@dusky pine :white_check_mark: Your eval job has completed with return code 0.

4
dusky pine
slate swan
#

@robust fulcrum i created a calculator before in GUI using only tkinter.

robust fulcrum
dusky pine
#

u can try big equations if you want but simple is fine

robust fulcrum
#

Simple is as simple as pie

#

I'll make a big equation one

slate swan
#

in that case i guess that team2 = roles2[i] never assigned so it is None as you put before.

#

try using try-except statement so you can avoid error when the roles[i] is not exists.

#
try:
  emoji2 = team2.name.replace(" ", "_")
except:
  print ("Error")
dusky pine
paper sluice
slate swan
dusky pine
#

!e

print(sum([int(i) for i in "2+2".split("+")]))
#

rip

slate swan
unkempt canyonBOT
#

@dusky pine :white_check_mark: Your eval job has completed with return code 0.

4
paper sluice
slate swan
#

!e

print(eval("(1+1)/2"))
unkempt canyonBOT
#

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

1.0
shrewd apex
#

!d ast.literal_eval

unkempt canyonBOT
#

ast.literal_eval(node_or_string)```
Safely evaluate an expression node or a string containing a Python literal or container display. The string or node provided may only consist of the following Python literal structures: strings, bytes, numbers, tuples, lists, dicts, sets, booleans, `None` and `Ellipsis`.

This can be used for safely evaluating strings containing Python values from untrusted sources without the need to parse the values oneself. It is not capable of evaluating arbitrarily complex expressions, for example involving operators or indexing.
paper sluice
# slate swan it is `1+1` relax man.

they are taking input from the user, so i can just type a command to delete their local files and it will execute that and now their files are gone

slate swan
#

⭐vulnerabilities⭐

#

do:

if '+' not in string and '-' not in string and '*' not in string and '/' not in string:
  print ("Hey put some operators!")
#

or like: 🗿

dusky pine
slate swan
#

users can be py devs lol

#

being a programmer isnt something inclusive

paper sluice
slate swan
# slate swan users can be py devs lol

so do:

chars = ['a', 'b', ....]
if '+' not in string and '-' not in string and '*' not in string and '/' not in string:
  for i in chars:
    if i in string:
      return
  print ("Hey put some operators!")
paper sluice
#

^

spring flax
#

If I want one select menu to show another select menu when a option is picked but the options from the second one are based on the first pick. How would I? I have more information in #help-chocolate

slate swan
#

you would need to use or for that lol

slate swan
slate swan
spring flax
slate swan
#

that wasnt directed at you 😅

slate swan
slate swan
paper sluice
#

abstract syntax tree, every python expression gets converted to a tree which shows the order of operation before getting converted to byte code

#

!e

import ast

print(ast.dump(ast.parse('1+1*(2*69)'), indent=4))
unkempt canyonBOT
#

@paper sluice :white_check_mark: Your eval job has completed with return code 0.

001 | Module(
002 |     body=[
003 |         Expr(
004 |             value=BinOp(
005 |                 left=Constant(value=1),
006 |                 op=Add(),
007 |                 right=BinOp(
008 |                     left=Constant(value=1),
009 |                     op=Mult(),
010 |                     right=BinOp(
011 |                         left=Constant(value=2),
... (truncated - too many lines)

Full output: https://paste.pythondiscord.com/edisiqifan.txt?noredirect

slate swan
paper sluice
#

compiled is usually used when code gets converted to machine code

paper sluice
slate swan
#

misunderstand i see

spring flax
paper sluice
slate swan
#

you just enlightened my question

paper sluice
#

no it never really compiles, it just byte code ( which is not machine code ), then it that byte code is compiled to machine code line by line and executed

#

we say line by line, but its more like going thought each node one by one

slate swan
#

well it really depends on the usage of compiled as people also refer to converting to byte code as compiled but its all word usage

#

¯_(ツ)_/¯

paper sluice
#

hmm yea, ig you can refer to that. I thought u said compiled to syntax tree b4 that so was a little confused

slate swan
#

many websites also use compiled as sorta of an alias of convert lol

#

well it literally is an alias lmao

spring flax
#

Sorry I keep asking, but @slate swan can I bother asking you to check #help-chocolate

robust fulcrum
paper sluice
#

without any apis

robust fulcrum
paper sluice
#

huh?

robust fulcrum
#

Can I use Wikipedia library?

paper sluice
#

no

robust fulcrum
#

Then

paper sluice
#

aiohttp + bs4

robust fulcrum
#

Ok

robust fulcrum
slate swan
#

well if you do use requests that would block your bot per each HTTP request it makes, no?

neat field
#

make an embed with 4 images

paper sluice
#
response = requests.get(url)

Is just

async with aiohttp.ClientSession() as session:
    async with session.get(url) as response:
        ...
slate swan
#
async with aiohttp.request("GET", "<endpointurl>", headers={}) as payload:
    ...
paper sluice
dull terrace
#

Has anyone done testing to figure out the best length of play/use time for a bot before you make them take a break and/or vote to continue?

robust fulcrum
#

@paper sluice can i try to get weather from google weather page?

#

Using bs4 and aiohttp

paper sluice
#

ya, i just gave a suggestion

robust fulcrum
#

Ok

shell wing
#
Traceback (most recent call last):
  File "main.py", line 13, in <module>
    current_time = datetime.datetime.now()
AttributeError: type object 'datetime.datetime' has no attribute 'datetime'

code:

current_time = datetime.datetime.now()
@tasks.loop()
async def hello(hours=1):
    
    channel = bot.get_channel(992456076136034344)
    await channel.send("@shell wing The Current Time is =", current_time)
    await asyncio.sleep(2)
    print("loop started")

imports :

import discord
from discord.ext import commands ,tasks
import asyncio
import traceback
from datetime import datetime
rough ledge
thorny ferry
#

Hey, i wanna check in a on_message if a user has a specific role

So if he type Suggestion and has the role Member is send a message in channel……
but if he has role user it send the message to an other channel……

i hope you might can help me

slate swan
#

!d discord.Member.roles

unkempt canyonBOT
#

property roles```
A [`list`](https://docs.python.org/3/library/stdtypes.html#list "(in Python v3.10)") of [`Role`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Role "discord.Role") that the member belongs to. Note that the first element of this list is always the default [‘@everyone](mailto:'%40everyone)’ role.

These roles are sorted by their position in the role hierarchy.
slate swan
slate swan
#

!e print([].name)

unkempt canyonBOT
#

@slate swan :x: Your eval job has completed with return code 1.

001 | Traceback (most recent call last):
002 |   File "<string>", line 1, in <module>
003 | AttributeError: 'list' object has no attribute 'name'
slate swan
#

wanna get that role name

slate swan
#

depends if you want a map/gen obj or a list etc

#

cool

thorny ferry
#

So this is wrong, but how can i get a user role ?
role_de = get(guild.roles, id=role_id_de)

slate swan
#

a user is a user account in discord, member is a user account in a guild which a guild has roles so you ment member

#

!d discord.Member.get_role

unkempt canyonBOT
#

get_role(role_id, /)```
Returns a role with the given ID from roles which the member has.

New in version 2.0.
slate swan
#

👍

shell wing
# rough ledge Just `current_time = datetime.now()`
Traceback (most recent call last):
  File "/home/runner/stuff/venv/lib/python3.8/site-packages/discord/ext/tasks/__init__.py", line 239, in _loop
    await self.coro(*args, **kwargs)
  File "main.py", line 17, in hello
    await channel.send("@shell wing The Current Time is =", current_time)
TypeError: send() takes from 1 to 2 positional arguments but 3 were given
slate swan
#

use f strings

paper sluice
#

do

f"@shell wing The Current Time is = {current_time}"
shell wing
#

alr ty its working

slate swan
#

baby yodalemon_blush

robust fulcrum
#

It's simple to make ig

#

I can easily make it use PIL

shell wing
#
@tasks.loop()
async def hello(hours=1):
    
    channel = bot.get_channel(992456076136034344)
    await channel.send(f"@shell wing")
    
    print("loop started")
``` why does it send 5 msgs in a go and wait for second and then send msgs again
neat field
robust fulcrum
#

Ok

slate swan
#

thank you

sick panther
#

Hi, I'm currently migrating everything from dpy 2.0 to disnake, as I just want to work with disnake. But for some reason my interaction_check isn't working anymore:

  async def interaction_check(self, interaction: disnake.MessageInteraction):
      if interaction.user.id in self.dropdownusers.author.id:
          return True
      await interaction.response.send_message(f'You cannot use this interaction.', ephemeral=True)
      return False
``` According the docs I did everything right.
paper sluice
#

its interaction.author in disnake

slate swan
#

!d disnake.Interaction.user

unkempt canyonBOT
#

property user```
The user or member that sent the interaction. There is an alias for this named [`author`](https://docs.disnake.dev/en/latest/api.html#disnake.Interaction.author "disnake.Interaction.author").
paper sluice
#

ah sad

slate swan
#

Interaction.author is just an alias lol

sick panther
paper sluice
#

oki is always right

slate swan
unkempt canyonBOT
#

disnake.on_interaction(interaction)```
Called when an interaction happened.

This currently happens due to application command invocations or components being used.

Warning

This is a low level function that is not generally meant to be used.

New in version 2.0.
slate swan
#

its just a namespace that gets called internally like on_ready

sick panther
#

Ah, understood. Thank you

swift pumice
#

how can i make the bot use a slash command in discord?

slate swan
#

youre welcome

swift pumice
#

nextcord

#

i want that it writes every 120 minutes /bump(because of disboard)

paper sluice
slate swan
paper sluice
swift pumice
slate swan
paper sluice
#

😳

slate swan
#

😩

slate swan
swift pumice
#

fr?

#
async def bump():
    channel = bot.get_channel(992511703155740712)
    await channel.send("/bump")

@bot.event
async def on_ready():
    bump.start()```my current code
#

but it kinda doesnt work..

paper sluice
#

thats not how you invoke commands

swift pumice
#

what

paper sluice
#

app commands can't be invoked

#

if u want to invoke normal commands you do Context.invoke

#

!d nextcord.ext.commands.Context.invoke

unkempt canyonBOT
#

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

Calls a command with the arguments given.

This is useful if you want to just call the callback that a [`Command`](https://nextcord.readthedocs.io/en/latest/ext/commands/api.html#nextcord.ext.commands.Command "nextcord.ext.commands.Command") holds internally.

Note

This does not handle converters, checks, cooldowns, pre-invoke, or after-invoke hooks in any matter. It calls the internal callback directly as-if it was a regular function.

You must take care in passing the proper arguments when using this function.
swift pumice
#

so instead of send you mean invoke?

slate swan
#

you cant lol

#

invoke is used to invoke commands that use Context so commands that are made with the lib abstract of commands of nextcord and commands that are from your bot so no you cant use it and were talking about app commands so nope

#

and even if you send a message with a / i doubt it would register as your bot invoking a app command, ill probably just send the raw content or no /(slash)

swift pumice
#

uh

#

why wont disboard just keep the old prefix :(

slate swan
slate swan
#

sorry i didnt ment that

tough lance
#

Anyway don't shitpost

shrewd apex
#

i think partly why they enforced slash was to stop people from grinding a bot using another

tough lance
#

The problem was self bots

#

Which is still a problem cuz self bots still can use slash commands

shrewd apex
#

rip

shrewd apex
#

especially on the user input part

tough lance
#

Yea they've actually improved ever since they first came

swift pumice
tough lance
#

Bro bots can't use slash commands

#

And self bots are against discord TOS

swift pumice
#

wait what do you mean with self bots are agains discord tos

#

i dont understand, does that mean iam not allowed to create a bot?

slate swan
#

anything you do with self bots is against tos

slate swan
swift pumice
#

Ohhh

#

I understand now

slate swan
#

like if i used my token instead of a bot token for running a bot

swift pumice
#

ty, i thought creating a bot was against tos. like if a no name creates a bot.

mild lava
#

whats up with discord user links? if i access a link like https://discord.com/users/xxxx where xxxx is a user id, it works for ids of friends and people in servers that im in, but doesnt work for a user that i dont have any mutual servers with. is this intended behavior? if so, was it always like this, and is there a different way to create a public link to a discord account?
(this seemed like the best channel to put this)

sick panther
#

Okay, so I'm following the docs

https://docs.disnake.dev/en/stable/api.html#disnake.InteractionMessage.author
But the problem is, there's not really anything to check who clicked an option in the dropdown menu? disnake.MessageInteraction.author and disnake.MessageInteraction.user are the same aren't they?


  async def on_interaction(self, interaction: disnake.MessageInteraction):
      if interaction.user.id is interaction.author.id:
          await interaction.response.send_message(f'worked', ephemeral=True)
          return True
      await interaction.response.send_message(f'You cannot use this interaction.', ephemeral=True)
      return False
  ``` now help me
paper sluice
paper sluice
sick panther
paper sluice
#

343944376055103488

mild lava
paper sluice
paper sluice
mild lava
slate swan
#

Question, how can I only allow access to a prefix for one singular user?

mild lava
slate swan
sick panther
# paper sluice in the command before you call the view, just do interaction.user and store it s...

Sorry, but once again I'm not sure how to do it lol, so yeah I think(?) I did everything right so far, but for some reason it's just not checking for the author.

class Dropdown(disnake.ui.Select):
  def __init__(self, dropdownuser):
    options = [
      disnake.SelectOption(
        label="🛑 - Blacklisted Words", description="Get infos about the blacklisted words."
      ),
      disnake.SelectOption(
        label="👀 - Staff", description="Get infos about staff."
      ), 
      disnake.SelectOption(
        label="⚠️ - Modmail", description="Get infos about the modmail."
      )
    ]
    super().__init__(
      placeholder="Select something",
      options=options,
    )
    self.dropdownuser = dropdownuser

  async def on_interaction(self, interaction: disnake.ApplicationCommandInteraction):
      if interaction.user.id in self.dropdownuser.author.id:
          await interaction.response.send_message(f'worked', ephemeral=True)
          return True
      await interaction.response.send_message(f'You cannot use this interaction.', ephemeral=True)
      return False
#

Should've sent a link, sorry for the flood

mild lava
slate swan
mild lava
#

any sort of code that you want to run when an authorized user sends a message with your chosen prefix

slate swan
unkempt canyonBOT
#

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

Retrieves the prefix the bot is listening to with the message as a context.

Changed in version 2.0: `message` parameter is now positional-only.
visual island
mild lava
mild lava
#

in that case you can make a function that checks the user id, and if its an authorized user it will add your "special" prefix to the list of returned prefixes

visual island
slate swan
mild lava
slate swan
#

Oh okay

mild lava
#
async def custom_prefixes(bot: Bot, message: Message):
    if message.author.id == some_user_id:
        return ['default prefix', 'special prefix']
    return ['default prefix']
visual island
#

That ^^

slate swan
#

it has to be async?

#

can't I just make it a regular function and call it when I define the command_prefix ?

visual island
#

it doesn't iirc, the docs only says "a callable"

mild lava
mild lava
slate swan
mild lava
#

yeah, without the brackets

slate swan
mild lava
#

or in a separate file and import it

slate swan
mild lava
#

bot and message are parameters

faint dagger
#

What to do?

mild lava
#

Bot and Message are the classes you get by from discord import Message and from discord.ext.commands import Bot

robust fulcrum
#
headers = {

    'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.3'}

def weathers(city):
    city = city.replace(" ", "+")
    res = requests.get(

        f'https://www.google.com/search?q={city}&oq={city}&aqs=chrome.0.35i39l2j0l4j46j69i60.6128j1j7&sourceid=chrome&ie=UTF-8', headers=headers)

    print("Searching...\n")
    soup = BeautifulSoup(res.text, 'html.parser')
    location = soup.select('#wob_loc')[0].getText().strip()
    time = soup.select('#wob_dts')[0].getText().strip()
    info = soup.select('#wob_dc')[0].getText().strip()
    weather = soup.select('#wob_tm')[0].getText().strip()
    weather = (weather+"°C")

    dict = [location,time,info,weather]
    return dict

Here is function

    @commands.command()
    async def weather(self,ctx,city):
        response = weathers(city)
        location = response[0]
        time = response[1]
        info = response[2]
        weather = response[3]
        embed = discord.Embed(title="Weather", description=f"City: {city}",color=discord.Color.blue())
        embed.add_field(name="location",value=location,inline=False)
        embed.add_field(name="Time",value=time,inline=False)
        embed.add_field(name="Info",value=info,inline=False)
        embed.add_field(name="Weather",value=weather,inline=False)
        await ctx.send(embed=embed)

I am getting error how to fix?

faint dagger
mild lava
mild lava
#

👍

mild lava
visual island
robust fulcrum
mild lava
#

which probably means soup.select('#wob_loc') is returning an empty list

visual island
#

and you can always use a weather API, no need to webscrape

robust fulcrum
#

Hmmm

mild lava
#

which implies that the webpage content you received isnt exactly what you expect

robust fulcrum
mild lava
#

the solution to this problem is specific to the website youre scraping and what content youre parsing out

mild lava
#

as xCirno said, its a much better idea to simply use a weather api thats meant to be used in code, rather than scraping a webpage meant for humans that can change its format at any time

mild lava
robust fulcrum
#

Pls help me if possible

slate swan
#

i did fall in your rick roll link @mild lava

mild lava
mild lava
robust fulcrum
#

I did a wrong thing

#

i forgot to put
city = city+"weather"

dusky pine
robust fulcrum
#

No prob both have same meaning

slate swan
#

bitwise addition is faster iirc

mild lava
#

bitwise? i dont think that applies here lol

dusky pine
mild lava
#

x += y is in-place modification while x = x + y is reassignment

dusky pine
#

same result anyway

slate swan
mild lava
#

no

#

& is

#

also |

mild lava
# dusky pine same result anyway

but yes, += exists for a reason, and it is mostly used as a shorthand for x = x + y, plus it makes code a bit easier to understand. theres rarely a reason not to use it

robust fulcrum
#

@paper sluice challenge done

slate swan
#

Hi all I wonder if anyone can help, I am just trying to build a basic reaction role atm (I am still learning), its of course not working... https://paste.pythondiscord.com/tagewuvaka

I am trying to send a specific message to a certain channel with the bot reacting first, and then when someone reacts to the message with the emoji they get the role assigned, the emoji, the channel id and role name is correct.

So I can only assume I am going wrong in my code, but as I am new to python I am not sure what I am now missing, I was wondering if someone could assist me a little or point me in the right direction? 🙂

gusty shard
#

how do i make the command available every 30 seconds?

slate swan
robust fulcrum
vocal plover
#

yes you just said that

robust fulcrum
#

I not used wearher api

#

Cause it have 1000 requests per day

#

But mine command unlimited

slate swan
#

you can cache the results of requests if its some daily weather data, so if someone uses the command with same argument again the cache is utilised instead of making the request in that case

dusky pine
#

next challenge: Implement a cache

slate swan
dusky pine
#

A cache using Redis 🙂

slate swan
#

heck no looli

gusty shard
#

yes

dusky pine
vocal plover
#

redis is easy, just set and get

dusky pine
#

there's uhh... hashes?!

vocal plover
#

easy enough to just dump json data to a string & load it after

dusky pine
#

kekw

vocal plover
gusty shard
vocal plover
#

big scary hashy bois mmLol

dusky pine
#

just HGET and HSET

supple thorn
#

Hi vcokltfre

slate swan
# gusty shard how can i make it?

!d discord.ext.commands.cooldown use the decorator on your commands, ```py
@commands.command( rate, per, commands.BucketType.user)

unkempt canyonBOT
#

@discord.ext.commands.cooldown(rate, per, type=discord.ext.commands.BucketType.default)```
A decorator that adds a cooldown to a [`Command`](https://discordpy.readthedocs.io/en/latest/ext/commands/api.html#discord.ext.commands.Command "discord.ext.commands.Command")

A cooldown allows a command to only be used a specific amount of times in a specific time frame. These cooldowns can be based either on a per-guild, per-channel, per-user, per-role or global basis. Denoted by the third argument of `type` which must be of enum type [`BucketType`](https://discordpy.readthedocs.io/en/latest/ext/commands/api.html#discord.ext.commands.BucketType "discord.ext.commands.BucketType").

If a cooldown is triggered, then [`CommandOnCooldown`](https://discordpy.readthedocs.io/en/latest/ext/commands/api.html#discord.ext.commands.CommandOnCooldown "discord.ext.commands.CommandOnCooldown") is triggered in [`on_command_error()`](https://discordpy.readthedocs.io/en/latest/ext/commands/api.html#discord.discord.ext.commands.on_command_error "discord.discord.ext.commands.on_command_error") and the local error handler.

A command can only have a single cooldown.
vocal plover
slate swan
#

and i doubt if people really use bots to check weather

vocal plover
#

because all hail our lord and saviour redis

slate swan
#

le discord.py storing 50k members cache in a dictionary 🥂

vocal plover
#

Nextcord V3 will allow you to switch out the default cache for any protocol compliant one, including a custom redis cache mmLol

supple thorn
slate swan
#

i would love to see that

#

hikari-sake ftw

gusty shard
#

that seems wrong

slate swan
gusty shard
#

@commands.cooldown(1, 30)

dusky pine
#

bruh you have to buy a bucket if you want to have command cooldown?

gusty shard
#

is that enough?

dusky pine
vocal plover
#

I prefer disnake kek

robust fulcrum
#

@dusky pine can you give a good challenge not any very complicated one

gusty shard
robust fulcrum
#

Whats foo

slate swan
gusty shard
#

alright

#

thank you

slate swan
#

foo, bar, baz

#

The terms foobar (), foo, bar, baz, and others are used as metasyntactic variables and placeholder names in computer programming or computer-related documentation. They have been used to name entities such as variables, functions, and commands whose exact identity is unimportant and serve only to demonstrate a concept.

dusky pine
#

so basically add two numbers

robust fulcrum
#

Simple

slate swan
#

make an eval >solve 1+2/3*4**9 😏

#

!pip simpleeval probably use this for that

unkempt canyonBOT
dusky pine
#

Sarth you literally completed his challenge for him

robust fulcrum
#
def add(a,b):
    return a+b

@bot.command()
async def add(ctx,num1,num2):
    ans = add(num1,num2)
    await ctx.send(ans)
#

👍

slate swan
#

Most likely won't work

dusky pine
#

You're overriding add with your command add

#

And would cause recursion

slate swan
#

And you're using + on strings

dusky pine
#

That too

slate swan
#

So not that simple kek

robust fulcrum
#
def add(a,b):
    a = int(a)
    b = int(b)
    return a+b

@bot.command()
async def add(ctx,num1:int,num2:int):
    ans = add(num1,num2)
    await ctx.send(ans)
dusky pine
robust fulcrum
#

Whats wrong now

slate swan
#

Why would you convert to an int again

robust fulcrum
#

No prob

slate swan
#

You're basically converting an int to an int

dusky pine
slate swan
dusky pine
#

You are causing recursion

#

You don't need an extra function

slate swan
#

You can just directly send the addition

#

No need to overengineer and add another function

#

Otherwise you could add something like

def convertToInt(a):
    return int(a)
dusky pine
slate swan
robust fulcrum
#

Ok

#

Whats use of
from math import floor
Whats use of floor?

slate swan
#

floor division ig? try it and see

#

just puts to the closest number

#

either down, or up

#

!e
import math

print(math.ceil(300.16))
print(math.floor(300.16))

unkempt canyonBOT
#

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

001 | 301
002 | 300
slate swan
#

rounding

robust fulcrum
#

Oh floor means rounding to lowest

#

And ceil means rounding to highest

#

Floor is on down and ceil top

muted pecan
#

Hello! I have been in python for a relatively short time, could you tell me how to do a keyword search in a JSON table? I need to make it so that if a person enters for example "hamburger", then it gives out his price

If you give me documentation describing how to do this or similar, I will be even more grateful to you.

muted pecan
paper sluice
warped mirage
#
@client.tree.command(description="Check the membercount")
@app_commands.checks.has_permissions(administrator = True)
async def membercount(inter: discord.Interaction):
    em = discord.Embed(color=0x00FFFF, title="Members", description=f"{len(list(inter.guild.members))}", timestamp = datetime.datetime.utcnow())
    await inter.response.send_message(embed = em)``` when i try do the command it doesnt return a error but it says interaction failed
shell wing
#

So im making requirements.txt can i make it so that it installs all the modules im importing in main_imports.py like so that i dont have to write it separately

paper sluice
#

if your in a venv ( which you should be ) you can do pip freeze > requirements.txt it will put all the modules your environment has in requirements.txt

paper sluice
shell wing
warped mirage
shell wing
vocal plover
#

<@&831776746206265384> scam url

visual yarrow
#

!mute 922380062307799131

unkempt canyonBOT
#

:incoming_envelope: :ok_hand: applied mute to @split oracle until <t:1656765537:f> (59 minutes and 59 seconds).

paper sluice
paper sluice
shell wing
paper sluice
#

not sure why thats happening, try python -m pip freeze > requirements.txt

shell wing
#

hm

dusky pine
slate swan
#

role is None

warped mirage
#

idk ill double check

slate swan
#

make a getch

#

hm but that's a name

#

sheesh, double the check name or restart the bot

#

is there any reason that you are not using the role id but its name

slate swan
#

instead make a getch

role = message.guild.get_role(role_id)
await member.add_roles(role)
#

yes it's the same?

#

oh wait, it's a guild method ig

#

tf

#

weird

warm tulip
#

guys help

#

i have a say cmd and i want it to delete cmd after sending the mesage real user said

#

but it have a eror when i type cmd in a server

#
  async def say(self, ctx: commands.Context, *, message):
    await ctx.delete_after(message)
    await ctx.send(message)```
#

what i type : p!say hey

#

eror:

Ignoring exception in command say:
Traceback (most recent call last):
File "/home/runner/yoohooool/venv/lib/python3.8/site-packages/discord/ext/commands/core.py", line 85, in wrapped
ret = await coro(*args, **kwargs)
File "/home/runner/yoohooool/commands.py", line 28, in say
await ctx.delete_after(message)
AttributeError: 'Context' object has no attribute 'delete_after'

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

Traceback (most recent call last):
File "/home/runner/yoohooool/venv/lib/python3.8/site-packages/discord/ext/commands/bot.py", line 939, in invoke
await ctx.command.invoke(ctx)
File "/home/runner/yoohooool/venv/lib/python3.8/site-packages/discord/ext/commands/core.py", line 863, in invoke
await injected(*ctx.args, **ctx.kwargs)
File "/home/runner/yoohooool/venv/lib/python3.8/site-packages/discord/ext/commands/core.py", line 94, in wrapped
raise CommandInvokeError(exc) from exc
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: AttributeError: 'Context' object has no attribute 'delete_after'

paper sluice
#

!d discord.Guild.get_role

unkempt canyonBOT
#

get_role(role_id, /)```
Returns a role with the given ID.

Changed in version 2.0: `role_id` parameter is now positional-only.
paper sluice
#

oh wait i didn't read your original question

#

you can do await ctx.message.delete() to delete the user's message

warm tulip
#

ok

#

thank u

paper sluice
#

bot doesn't get get_role Guild does

#

so you would probably do ctx.guild.get_role(id)

#

or member.guild in this case

#

member, there is no ctx here

paper sluice
#

ya should be good

#

if the role is not in the cache it will return None so you might have to fetch it

slate swan
#

you cant fetch roles

#

unless you fetch every role of the server

robust fulcrum
#

Btw i want to ask one question

paper sluice
robust fulcrum
#

Is there any api or library that can convert a text into emoji?

robust fulcrum
#

@paper sluice

#

Any new challenge for me?

#

Any fun command challenge?

slate swan
robust fulcrum
#

I told for fun command not game

paper sluice
#

server cloner

robust fulcrum
#

Bruh

#

Bro i am asking for fun comamnd

#

Not for utility or any game comamnds

slate swan
#

what is "fun comamnd" ? you mean like "broke server" command or something like that?

robust fulcrum
slate swan
#

I see.

#

Did you try to challenge yourself by doing what dank memer bot does ?

dusky pine
#

then you can make Games to earn money

robust fulcrum
sick birch
#

Can I suggest a stable, expandable, and simple bot infrastructure again…

swift acorn
#

I can use commands.guild_only to make commands only work in servers but how do I do this for events?

robust fulcrum
paper sluice
#

text[::-1]

robust fulcrum
#

@paper sluice

#

Can I ask something

paper sluice
robust fulcrum
#

Is it possible to make triggered command like dank memer bot in discord.py?

swift acorn
paper sluice
robust fulcrum
#

That makes our avater look like we are triggered

paper sluice
# swift acorn How do I check that?

like if you have an on_message event you can do

if isinstance(message.channel, discord.DMChannel):
    return # to not respond to the dm things
#

or wait there is an intent which you can disable for the same

robust fulcrum
#

Like this

robust fulcrum
#

Is it possible to make it?

paper sluice
paper sluice
#

not sure if PIL can make a gif

robust fulcrum
#

PIL can't make .gif files ........

slate swan
robust fulcrum
#

I not able to understand what you mean

arctic nacelle
# robust fulcrum PIL can't make .gif files ........

to create gif you need multiple pictures (all different but kind of similar).
then maybe, there are some module that can create gif adding those different pictures.

  • to view motion, pics MUST be different (you should know).
dusky pine
#

GIF is just a bunch of pictures together, so is every video 🙂

robust fulcrum
dusky pine
#

If Dank Memer can, it's possible 😄

robust fulcrum
#

That's discord.js

dusky pine
#

Still you can do it

robust fulcrum
#

Discord.js have more Power features

robust fulcrum
cloud dawn
#

Python can do anything js can and in reverse.

arctic nacelle
cloud dawn
arctic nacelle
cloud dawn
#

nextcord is alright but py-cord is just not so good.

paper sluice
robust fulcrum
#

No prob

robust fulcrum
paper sluice
#

yes?

arctic nacelle
paper sluice
cloud dawn
paper sluice
#

^

robust fulcrum
#

Should I start with hikari?

#

Or any other fork?

paper sluice
#

if u feel like it

robust fulcrum
#

Hmm ig hikari

#

I'll start converting my bot to hikari from tommorow

cloud dawn
#

Not much support for Hikari and more difficult.

arctic nacelle
robust fulcrum
#

I want to make a ai chat comamdb but idk how to make

cloud dawn
slate swan
robust fulcrum
#

😴

dusky pine
#

too many cults in this server

robust fulcrum
#

How can we make our bot annoying?

#

I dont have any cult .

slate swan
dusky pine
#

there's Rust, C and Hikari, what next, Golang?

paper sluice
robust fulcrum
#

Me bored from dpy

cloud dawn
#

Hikari is a library lol

dusky pine
slate swan
#

panda boomer 😔

robust fulcrum
slate swan
robust fulcrum
arctic nacelle
robust fulcrum
robust fulcrum
#

Is there any way to make ai chat command?

arctic nacelle
robust fulcrum
#

Ai chat will make mor annoying

paper sluice
robust fulcrum
slate swan
arctic nacelle
slate swan
#

who cares about the intensity

arctic nacelle
paper sluice
robust fulcrum
slate swan
paper sluice
#

then you can't make it 🤷‍♂️

robust fulcrum
#

There no api

paper sluice
#

i can;t even see it lmao

sick birch
#

That’s what you get for amoled mode

paper sluice
#

😔

slate swan
#

😏 light theme be like

robust fulcrum
sick birch
#

Right

robust fulcrum
slate swan
#

some random api got a AI chat endpoint iirc

slate swan
robust fulcrum
#

I have ti go school after 3 days and no discord bot coding 😭

slate swan
#

manage time for that if you really like doing that.

robust fulcrum
#

Where would the message go?

slate swan
#

you would need a message an a key query

#

they have a discord server, ask them how to get a key

robust fulcrum
#

Ok

robust fulcrum
#

More rea

paper sluice
slate swan
paper sluice
#

sarth's pupils are white

gusty shard
#

im trying to code a fight bot

#

i used that code i found from here:

@bot.event
async def on_message(message):
    if message.content.startswith('$greet'):
        channel = message.channel
        await channel.send('Say hello!')

        def check(m):
            return m.content == 'hello' and m.channel == channel

        msg = await bot.wait_for('message', check=check)
        await channel.send(f'Hello {msg.author}!')```
#

i need to make the bot reply only when specified user writes hello

#

for example

#

when user writes

$greet @gusty shard

#

sorry i had to go

#

i want to make the bot reply when that specific user replies with hello

#

thats not i need

slate swan
slate swan
#

"prefix-less"

quick gust
#

oh

slate swan
#

oh wait nvm

#

they wanted "hello" first my bad

quick gust
slate swan
#

overkill

#

just ping the person directly...

paper sluice
#

why does no one use lambda for checks 😢

shrewd apex
#

how to send a message in an interaction after defering it

#

i don't think interaction.response.send_message will work will it?

#

after doing interaction.response.defer()?

slate swan
#

edit_message ;-;

shrewd apex
#

i want to send a message

paper sluice
paper sluice
slate swan
#

!d discord.InteractionResponse.edit_message

unkempt canyonBOT
#

await edit_message(*, content=..., embed=..., embeds=..., attachments=..., view=..., allowed_mentions=...)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).

Responds to this interaction by editing the original message of a component or modal interaction.
shrewd apex
#

nvm it works now

#

thx for help

gusty shard
#

guys

#

i want to bot reply

#

when the person i greet says "hello"

paper sluice
#

@gusty shard ^

gusty shard
#

oh thanks

slate swan
#

Hi all I wonder if anyone can help, I am just trying to build a basic reaction role atm (I am still learning), its of course not working... https://paste.pythondiscord.com/tagewuvaka

I am trying to send a set message to a certain channel with the bot reacting first, and then when someone reacts to the message with the emoji they get the role assigned. The emoji, the channel id and role name are correct.

So I can only assume I am going wrong in my code, but as I am new to python I am not sure what I am now missing, I was wondering if someone could assist me a little or point me in the right direction? 🙂

Intents is allowed for all, as the bot is just something I'll be using for myself and it has full admin rights too. I am not getting any errors, nor have I added any in as I am not sure where I would add error logging to my code to find out why its failing.

Also, while I am trying to use discord.py docs, is there any decent youtube/courses out there people would recommend?

hushed galleon
#

looks like you're using outdated dpy docs

robust fulcrum
#

@paper sluice can you give any interesting challenge?

slate swan
#

you done with the chatbot?

slate swan
slate swan
hushed galleon
#

also for a reaction role system its necessary to use on_raw_reaction_add(payload) since on_reaction_add is dependent on the message cache (after a bot restart, whatever message you have your reactions on won't be in the bot's cache so on_reaction_add won't fire when you want it to)

robust fulcrum
hushed galleon
paper sluice
slate swan
#

Ha, so I have written it in the old discord.py great, now to relearn everything 😐 hahah cheers for the advice, back to the drawing board I guess.....

robust fulcrum
slate swan
shrewd apex
frozen patio
#

Sureeee

robust fulcrum
slate swan
#

many variables there are defined out of function scope, so don't forget to check them.

robust fulcrum
robust fulcrum
slate swan
#

try making your own implementation of it, collect some quiz questions with 3-4 answers out of which 1 would be correct, send the questions along with answers and add buttons/ reactions for choosing the answer, the first user to select the correct reaction wins...

#

looli i use them even for longer ones rip py event: hikari.InteractionCreateEvent = await fun.bot.wait_for( hikari.InteractionCreateEvent, timeout=30, predicate=lambda inter: isinstance( inter.interaction, hikari.ComponentInteraction ) and inter.interaction.user.id==context.author.id and inter.interaction.message.id == msg.id and inter.interaction.component_type == hikari.ComponentType.SELECT_MENU, )

slate swan
slate swan
#

!d discord.ext.commands.Bot

unkempt canyonBOT
#

class discord.ext.commands.Bot(command_prefix, *, help_command=<default-help-command>, tree_cls=<class 'discord.app_commands.tree.CommandTree'>, description=None, intents, **options)```
Represents a Discord bot.

This class is a subclass of [`discord.Client`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Client "discord.Client") and as a result anything that you can do with a [`discord.Client`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Client "discord.Client") you can do with this bot.

This class also subclasses [`GroupMixin`](https://discordpy.readthedocs.io/en/latest/ext/commands/api.html#discord.ext.commands.GroupMixin "discord.ext.commands.GroupMixin") to provide the functionality to manage commands.

Unlike [`discord.Client`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Client "discord.Client"), this class does not require manually setting a [`CommandTree`](https://discordpy.readthedocs.io/en/latest/interactions/api.html#discord.app_commands.CommandTree "discord.app_commands.CommandTree") and is automatically set upon instantiating the class.

async with x Asynchronously initialises the bot and automatically cleans up.

New in version 2.0.
slate swan
#

This class is a subclass of discord.Client and as a result anything that you can do with a discord.Client you can do with this bot.

shell wing
#
Collecting discord.py
 
Downloading discord.py-1.7.3-py3-none-any.whl (786 kB)
 
ERROR: Could not find a version that satisfies the requirement discord_slash (from versions: none)
ERROR: No matching distribution found for discord_slash
 
ERROR: failed to build: exit status 1
 
ERROR: failed to build: executing lifecycle: failed with status code: 51
``` eh how i fix it ?
slate swan
#

there's no library called discord_slash on pypi

shell wing
#

what do i do....then.

slate swan
#

!pip discord-py-slash-command is the library name on pypi ig? also stop using it, its outdated

unkempt canyonBOT
slate swan
slate swan
#

good luck with that!, feel free to bring your doubts here.

slate swan
shell wing
#

cool ty

paper sluice
#

put them in a new line easy

slate swan
#

you can atleast try, you would be able to make the bot send a random question with options if not the complete command :)

paper sluice
#

!kindle try to implement one of these projects in ur discord bot

unkempt canyonBOT
#

Kindling Projects

The Kindling projects page on Ned Batchelder's website contains a list of projects and ideas programmers can tackle to build their skills and knowledge.

slate swan
#

codewars is a nice resource too

robust fulcrum
paper sluice
#

you cannot use \n outside strings, so put them inside a string

paper sluice
robust fulcrum
paper sluice
#

no, the part where you want to use \n

#

no like f'{...}\n{...}'

shrewd apex
slate swan
#
  • quotes
faint dagger
#

How to make an unban?

unkempt canyonBOT
#

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

Unbans this member. Equivalent to [`Guild.unban()`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Guild.unban "discord.Guild.unban").
slate swan
#

!d discord.Guild.unban , this exists too in case you don't wanna use an object but just the ID

await Guild.ban/unban(discord.Object(id=<the ID here>))
unkempt canyonBOT
#

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

Unbans a user from the guild.

The user must meet the [`abc.Snowflake`](https://discordpy.readthedocs.io/en/latest/api.html#discord.abc.Snowflake "discord.abc.Snowflake") abc.

You must have the [`ban_members`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Permissions.ban_members "discord.Permissions.ban_members") permission to do this.
plush bluff
#

how can i send any message in any text channel ?

#
@client.command(aliases=["msg"])
async def announce(ctx, channel: discord.TextChannel, string):
        await channel.send(string)

I am currently using this but it doesnt detect spaces between the text

paper sluice
shell wing
#
File "main.py", line 3, in <module>
from dinteractions_Paginator import Paginator
ModuleNotFoundError: No module named 'dinteractions_Paginator'
Traceback (most recent call last):
File "main.py", line 3, in <module>
from dinteractions_Paginator import Paginator
ModuleNotFoundError: No module named 'dinteractions_Paginator'

i have it added in requirement.txt

unkempt canyonBOT
slate swan
#

"official" like....heck

shell wing
#

ehh

paper sluice
slate swan
#
from interactions.ext.paginator import Page, Paginator
slate swan
paper sluice
#

oh, i didnt even notice its a full wrapper

shell wing
#

alr

shell wing
#

what do i write in requirements.txt though ?

slate swan
#

what library are you using>

shell wing
slate swan
#

your bot ofc

#

fix?

slate swan
fading kestrel
#

Ive been trying

fading kestrel
#

to join discord.py server, but Im banned, does anyone know

#

how to get unbanned from it?

fading kestrel
#

ok well my coding question is that

#

I dont know how to create select menus

#

using cogs?

shrewd apex
#

!d discord.ui.Select

unkempt canyonBOT
#

class discord.ui.Select(*, custom_id=..., placeholder=None, min_values=1, max_values=1, options=..., disabled=False, row=None)```
Represents a UI select menu.

This is usually represented as a drop down menu.

In order to get the selected items that the user has chosen, use [`Select.values`](https://discordpy.readthedocs.io/en/latest/interactions/api.html#discord.ui.Select.values "discord.ui.Select.values").

New in version 2.0.
fading kestrel
shrewd apex
#

for options

#

!d discord.SelectOption

unkempt canyonBOT
#

class discord.SelectOption(*, label, value=..., description=None, emoji=None, default=False)```
Represents a select menu’s option.

These can be created by users.

New in version 2.0.
lime rampart
#

Hello I don't really understand what went on with discord.py but I just know that it is coming back again as discord.py 2.0 .
I have used discord.py for all my bots so far and never bothered to switch to something like nextcord.

My questions are:
If I upgrade to discord.py 2.0 does this force me to use slash commands or can I still use regular any prefix commands?
Should I just stick with discord.py because I never switched out, not sure how different 2.0 is

fading kestrel
fading kestrel
#

However, if you would like to add slash commands and use the interaction module, then you can do that as well, additionally.

#

I only switched to 2.0 because I wanted to use the interactions module, with buttons, slash commands, select menus, etc..

#

I think its better to switch though, so that you can use the new features that are constantly being added.

#

You will have to make some changes to your code though after switching.

lime rampart
#

I see, can I leave my old code to run on the old version of discord.py or will I need to update all of it to 2.0?

fading kestrel
#

It will still work

lime rampart
slate swan
#

discord API v8 is not deprecated yet, it still works

fading kestrel
lime rampart
#

I guess keyword is yet, not sure how much longer and if it will still work after a certain amount of time.
I assume I would have to update all the old code to 2.0? x.x

fading kestrel
shell wing
fading kestrel
#

but it doesnt take too long

#

just read the docs

slate swan
shrewd apex
#

its barely few lines

shrewd apex
slate swan
#

chemistry?

shell wing
#

Eh ?

slate swan
shell wing
#

Rn I'm using the dpyv1.7

slate swan
slate swan
shell wing
#

The one which doesn't have slash and all integrated into it.

shell wing
slate swan
slate swan
#

they won't add new and breaking stuff to the same version.

#

for any change, a new version is created and uploaded to pypi

slate swan
slate swan
shell wing
#

ducky_yellow ik that 💀

#

I'm just telling cause then u all (not targeting) be like use the discord py2 cause it has slash and all

slate swan
#

then what's your point with "dpy shifting versions"
you are the one shifting version

shell wing
#

So I'm just telling u all in advance

slate swan
shell wing
shell wing
slate swan
slate swan
slate swan
slate swan
#

mutual feelings

lime rampart
#

So if I migrate to 2.0 I must use cogs? I'm not the best at coding so don't really understand classes as well

slate swan
#

no its not important to migrate to cogs if you use 2.0

slate swan
#

isnt dpy based on the principle of OOP 😔

slate swan
slate swan
shell wing
#

Discord py 1.7

shell wing
slate swan
paper sluice
shell wing
#

But it's still showing this

slate swan
shrewd apex
#

👀

slate swan
slate swan
slate swan
#

fml

slate swan
paper sluice
slate swan
#

dude

#

you guys need a life

#

no we just love black

shrewd apex
#

looks are important

slate swan
#

thats what she said

shrewd apex
#

^

paper sluice
#

PyCharm has has implemented linting in my blood

slate swan
#

You even need meditation, Ryuga

shrewd apex
#

do yoga

paper sluice
#

My parents say that as well

slate swan
#

nvm

slate swan
#

there was a chance that it could work if it was some fork, but thats not the case

slate swan
slate swan
#

bad english

#

i felt that it should be statically-typed

paper sluice
#

yea

slate swan
#

yep without the hyphen

#

CL_CatPatMeHarderBitch but left it just like that

paper sluice
#

why did I open pycharm to do rust pWut

slate swan
#

I don't think I'll be reading the gist; I cant stand grammatical errors 😔

#

fixed

slate swan
#

I'm better than grammarly /s

#

continues making typos

paper sluice
#

hw two spel pithink

slate swan
#

ash bill teach u

slate swan
slate swan
#

elaborate 😔

#

its required by the REST API too.

#

collectively both REST API and gateway

#

oh yeah forgot about the rest

#

i would really leave it in the dpy server if this was one for discord.py looli critics there would figure out lots of mistakes

paper sluice
slate swan
#

sure

#

what is it

#

oh wait

#

I'm sorry if I'm annoying smh

#

😔 i misunderstood ig

#

"Basic Example"

#

no 😔

paper sluice
#

they will wonder what events are after seeing the example and right under that they will find the answer

#

I don't see an issue with it

slate swan
#

am I the only one who doesn't plan future shit

slate swan
paper sluice
slate swan
#

i leave it upto github copilot

#

I uhhh

#

you guys seriously need meditation

paper sluice
paper sluice
slate swan
#

😏

#

sarth sarth I got a question

#

yes what is it

#

can you access the in-built logger for hikari?

#

with some property etc, no
from the source code, forsure

#

hm, that's bad, thanks

#

there may be some private methods, ill check

#

yeah im doing that

#

thanks though

#

you should study

#

apologies for disturbing 😔

unkempt canyonBOT
#

hikari/internal/ux.py line 62

def init_logging(```
slate swan
#

hm thanki cutie, I already found it

#

😔 smart people

#

smh

slate swan
#

no you absolutely cannot

#

have fun

sick birch
#

You can but everyone’s levels will get reset to 0 when your bot goes offline

slate swan
#

hi robin

sick birch
#

So I suggest you either use a database or make sure you’ve covered every single error and handled it all perfectly

sick birch
#

How else do you plan on saving persistent data in something as volatile as memory?

#

JSON is not a database and should not be used as such

paper sluice
#

json is not great for storing large amounts of data its not meant to be used as a db

slate swan
#

just write on a paper manually

sick birch
#

It’s a serialization format, not a database

paper sluice
slate swan
slate swan
#

😔

paper sluice
#

lucky

#

we had to write big tests and stuff 😔

sick birch
#

I’m also not home at the moment so it’ll be a while before I can do that

slate swan
paper sluice
#

ah then same

#

writing is so 2019 😳

#

wdym "with roles"?

#

add callbacks

#

when they select it, they get the role

#

why would you respond with a role?

#

you add role to the member who selected the option

slate swan
#

which lib?

#

py-cord?

paper sluice
#
role = guild.get_role(id) # define guild 
await member.add_role(role)
slate swan
#

imo py-cord is so godly that I'm forbidden to help

slate swan
#

or does pycord change the name

paper sluice
slate swan
#

doubt it

#

!d discord.Member.add_roles

paper sluice
#

no, you are always right

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

its an alias