#discord-bots

1 messages · Page 1123 of 1

slate swan
#

its a third party Library for a third party library

#

dont even know how

cerulean folio
#

I can't, ur dms are disabled :o

#

lemme send u friend rq

slate swan
#

even friends rqs are disabled, goodluck

cerulean folio
#

bruh XD

paper sluice
#

lmao

slate swan
#

you can use rest api in that app seperately...

cosmic socket
slate swan
#

doesn't really have something to do with your running bot

cosmic socket
jovial urchin
#

So I only need this then I have all the functionality of discord.py and more?

slate swan
#

yes and no

slate swan
cosmic socket
upbeat gust
jovial urchin
#

I mean like do I need to import discord aswell?

slate swan
#

You can set up a flask server alongside your discord bot right?

#

replit users: yes

cosmic socket
slate swan
cosmic socket
upbeat gust
jovial urchin
#

Like if I need on_ready, I have to import discord?

upbeat gust
#

well no

slate swan
upbeat gust
#

thats a decorator of discord.Client or commands.Bot

#

just import it anyway

upbeat gust
#

communication between the bot and flask server

slate swan
#

Is discord.Interaction is ctx ?

upbeat gust
#

no?

#

ctx is commands.Context

cosmic socket
slate swan
#

its Interaction, as the name suggests

slate swan
slate swan
slate swan
upbeat gust
slate swan
slate swan
#

with examples

cosmic socket
slate swan
slate swan
slate swan
#

Okay got it

#

Ipc is the easiest way imo

#

you are right.

cosmic socket
#

what is ipc?

slate swan
#

there's like topics that cover half the issues for slash commands, and I always get ignored 😭

upbeat gust
slate swan
#

!pypi discord-ext-ipc

unkempt canyonBOT
upbeat gust
#

discontinued, not supposed to use

slate swan
#

Is it?

cosmic socket
#

I have to read into that more, but how does it work?

#

I have two python instances running (flask and discord bot) as usual and they can communicate somehow?

paper sluice
#

its time to roll 💀

slate swan
#

Well I'd prefer using rest api instead of messing around with your bot. Request to Discord's api with bot token and simply get the data

#

Also in case your bot goes offline, your site/flask server will still work

cosmic socket
#

wait, really? how?

cosmic socket
slate swan
#

sorry, but i got module 'discord' has no attribute 'app_commands' ?

slate swan
#

weird

slate swan
slate swan
#

^

slate swan
#

vim

slate swan
slate swan
slate swan
#

weird

upbeat gust
#

uh you can

#

even multiple bots on teh same process

slate swan
paper sluice
cosmic socket
#

oh, okay... uh well

upbeat gust
slate swan
#

Hi

paper sluice
#

👋

slate swan
slate swan
slate swan
dusky pine
upbeat gust
slate swan
# slate swan do what ryuga said
envy:~/Desktop/projects/KenoieBot $? $ python3.10 app.py
Traceback (most recent call last):
  File "/home/envy/Desktop/projects/KenoieBot/app.py", line 18, in <module>
    bot    = SlashClient()
  File "/home/envy/Desktop/projects/KenoieBot/app.py", line 12, in __init__
    self.tree = discord.app_commands.CommandTree(self)
AttributeError: module 'discord' has no attribute 'app_commands'
paper sluice
slate swan
#

multiple event loops in same process isn't really a nice idea

slate swan
#

rick

slate swan
# paper sluice type `pip show discord.py` and send output
$ pip show discord.py
Name: discord.py
Version: 1.7.3
Summary: A Python wrapper for the Discord API
Home-page: https://github.com/Rapptz/discord.py
Author: Rapptz
Author-email: 
License: MIT
Location: /home/envy/.local/lib/python3.10/site-packages
Requires: aiohttp
Required-by: 
#

rich*

slate swan
paper sluice
slate swan
#

ah no

dusky pine
slate swan
#

it is 1.7

slate swan
#

i will do, thank you all guys

#

✨ so many answers ✨

paper sluice
#

most helpful channel

slate swan
#

ryuga 👀 i replaced the hikari banner with a custom one, wanna see

paper sluice
#

sure

upbeat gust
#

!d discord.ext.commands.Bot.create_task

unkempt canyonBOT
#
Noooooo!!

No documentation found for the requested symbol.

upbeat gust
#

i swear tahts what it was

slate swan
#

you can create a banner.txt to do so

paper sluice
slate swan
slate swan
slate swan
#

Yo why tf

#

It doesn't send emojj

paper sluice
paper sluice
slate swan
robust fulcrum
#

Guys what's hikari?

paper sluice
robust fulcrum
#

Is dpy better or hikari?

#

Means easy

slate swan
#

easy: dpy
better: hikari ( personal opinion )

slate swan
#

When I type thumb it show 👍 in recommend

paper sluice
#

phone 💀

slate swan
paper sluice
#

i was last week to xD

slate swan
#

Oh nice

paper sluice
#

my water filter is broken, i can't drink water sadge

slate swan
#

is someone else dealing with the

aiohttp v3.8.1 was discovered to contain an invalid IPv6 URL which can lead to a Denial of Service (DoS).
thing?

paper sluice
#

they installed a filter yesterday saying its been a year and it broke today :////

slate swan
#

i see that in most of my dependabot errors

paper sluice
slate swan
#

How long pip install -U git+https://github.com/Rapptz/discord.py takes usually ?

dusky pine
#

it's been a year daddy, i really really miss you

paper sluice
slate swan
paper sluice
#

ya that was just to suppress the warning, the warning will go once aiohttp fixes it

#

its a pretty nice system, they warn for fatal vulnerabilities

eager bluff
#

is there a way to execute a command via a webhook or like detect when a webhook has been sent

robust fulcrum
#

Guys if a json file have 5 meaning thing
And i want the first one
Is it correct way to get
meaning = response(word[0])
?

robust fulcrum
#

Oh k

robust fulcrum
cloud dawn
robust fulcrum
dusky pine
robust fulcrum
#

Hikari is taati and hard

robust fulcrum
# dusky pine oh then `word[0]`
@bot.command()
async def meaning(ctx,word):
    noth = requests.get(f"https://api.dictionaryapi.dev/api/v2/entries/en/{word}")
    nothi = json.loads(noth.text)
    meaning = nothi["defination"][0]
    await ctx.send(meaning)

Here is my command

#

The api returns a lot of definations

#

I want the first one

#

How to get first one ?

dusky pine
#

nothi["definition"][0]

#

it's spelled "definition" not "defination"

robust fulcrum
#

Oof my English 😂

dusky pine
#

it's no problem, we all make mistakes

robust fulcrum
dusky pine
#

sick autocomplete

slate swan
#

pretty sure definition is a word too

robust fulcrum
rain olive
upbeat gust
robust fulcrum
#

Oh k

dusky pine
#

also why is it named "nothi" not "definitions"

upbeat gust
#

or try printing out the response and seeing how its actually laid out instead of guessing keys

robust fulcrum
fresh iron
#
class members:
    def __init__(self, name, age, gender, location, about):
        self.name = name
        self.age = age
        self.gender = gender 
        self.location = location 
        self.about = about

noting = open('notes.txt', 'a')
member = members( input("Enter name: "), input("Enter age:"), input("Enter gender: "), input("Enter location: "), input("Tell us something about you: "))


noting.write("Name: " + member.name.capitalize() + "\n")
noting.write("Age: " + member.age.capitalize() + "\n")
noting.write("Gender: " + member.gender.capitalize() + "\n")
noting.write("Location: " + member.location.capitalize() + "\n")
noting.write("About me: " + member.about.capitalize() + "\n")
noting.write("_____________________________________ \n")

is it possible to convert this into discord intro through a discord bot, like accept inputs and post the intro in a specific intro channel with an embed that carries the user's pfp in it

upbeat gust
#

sure

dusky pine
robust fulcrum
# dusky pine uh, try `nothi[0]`

It gave me something strange
{'word': 'paste', 'phonetic': '/peɪst/', 'phonetics': [{'text': '/peɪst/', 'audio': 'https://api.dictionaryapi.dev/media/pronunciations/en/paste-us.mp3', 'sourceUrl': 'https://commons.wikimedia.org/w/index.php?curid=1113778', 'license': {'name': 'BY-SA 3.0', 'url': 'https://creativecommons.org/licenses/by-sa/3.0'}}], 'meanings': [{'partOfSpeech': 'noun', 'definitions': [{'definition': 'A soft moist mixture, in particular:', 'synonyms': [], 'antonyms': []}, {'definition': 'A substance that behaves as a solid until a sufficiently large load or stress is applied, at which point it flows like a fluid', 'synonyms': [], 'antonyms': []}, {'definition': 'A hard lead-containing glass, or an artificial gemstone made from this glass.', 'synonyms': [], 'antonyms': []}, {'definition': 'Pasta.', 'synonyms': [], 'antonyms': []}, {'definition': 'The mineral substance in which other minerals are embedded.', 'synonyms': [], 'antonyms': []}], 'synonyms': [], 'antonyms': []}, {'partOfSpeech': 'verb', 'definitions': [{'definition': 'To stick with paste; to cause to adhere by or as if by paste.', 'synonyms': [], 'antonyms': []}, {'definition': 'To insert a piece of media (e.g. text, picture, audio, video) previously copied or cut from somewhere else.', 'synonyms': [], 'antonyms': []}, {'definition': 'To strike or beat someone or something.', 'synonyms': [], 'antonyms': []}, {'definition': 'To defeat decisively or by a large margin.', 'synonyms': [], 'antonyms': []}], 'synonyms': [], 'antonyms': []}], 'license': {'name': 'CC BY-SA 3.0', 'url': 'https://creativecommons.org/licenses/by-sa/3.0'}, 'sourceUrls': ['https://en.wiktionary.org/wiki/paste']}

upbeat gust
#

.

novel apexBOT
#

This is not a Modmail thread.

rain olive
dusky pine
#

!d discord.Client.wait_for

unkempt canyonBOT
#

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

Waits for a WebSocket event to be dispatched.

This could be used to wait for a user to reply to a message, or to react to a message, or to edit a message in a self-contained way.

The `timeout` parameter is passed onto [`asyncio.wait_for()`](https://docs.python.org/3/library/asyncio-task.html#asyncio.wait_for "(in Python v3.10)"). By default, it does not timeout. Note that this does propagate the [`asyncio.TimeoutError`](https://docs.python.org/3/library/asyncio-exceptions.html#asyncio.TimeoutError "(in Python v3.10)") for you in case of timeout and is provided for ease of use.

In case the event returns multiple arguments, a [`tuple`](https://docs.python.org/3/library/stdtypes.html#tuple "(in Python v3.10)") containing those arguments is returned instead. Please check the [documentation](https://discordpy.readthedocs.io/en/latest/api.html#discord-api-events) for a list of events and their parameters.

This function returns the **first event that meets the requirements**...
upbeat gust
upbeat gust
dusky pine
slate swan
fresh iron
rain olive
upbeat gust
fresh iron
#

shit i needa learn dpy

upbeat gust
fresh iron
#

how long will it take

upbeat gust
#

depends on how much python you know

fresh iron
#

fair

robust fulcrum
upbeat gust
storm verge
#

i have this error can someone help @paper sluice

paper sluice
robust fulcrum
#

Ok

cloud dawn
#

@slate swan hikari slash is uhm.. interesting.

slate swan
slate swan
paper sluice
storm verge
slate swan
#

then re invite it

#

make sure you’re selecting ‘bot’ and the other permissions selected which are known as ‘scopes’ your bot is needing to work

paper sluice
slate swan
storm verge
cloud dawn
slate swan
slate swan
cloud dawn
slate swan
storm verge
cloud dawn
slate swan
storm verge
slate swan
#

then re invite it, let me know if it works

#

it’ll generate a link for you to invite the bot

storm verge
slate swan
storm verge
#

same thing

slate swan
#

do you have the right token?

cloud dawn
slate swan
#

maybe because discord does not display all the commands on the command pallete

zealous jay
storm verge
slate swan
zealous jay
#

and you could re invite the bot just in case

cloud dawn
slate swan
#

that’s what i told him but not sure if he’s doing it correctly

storm verge
slate swan
#

okay, re invite your bot with the right permissions

zealous jay
#

so bot commands is checked?

slate swan
#

^

#

applications.commands

#

make sure you have all intents enabled too

storm verge
#

now their is this

zealous jay
#

huh

cloud dawn
#

Are you using a bot token?

slate swan
#

you’re definitely doing something wrong

storm verge
slate swan
#

show your example code without your token

cloud dawn
#

Not 100% sure but this usually only happens when you login with a user token on a bot application or something with oauth fails.

zealous jay
#

hmm

#

are you trying to create an user account that works as a bot?

cloud dawn
#

It's hard to tell since a 405 with this small of a tb can be anything.

zealous jay
#

yeah

robust fulcrum
cloud dawn
#

Do you have a git?

slate swan
eager bluff
#

is there a way to execute a command via a webhook or like detect when a webhook has been sent

cloud dawn
slate swan
#

looli yes a multiplayer chess

shrewd apex
#

what a pity cant send more than 25 buttons at a time

slate swan
#

!d discord.Message.webhook_id and check on this

unkempt canyonBOT
shrewd apex
#

otherwise we could make board games on discord :kek:

eager bluff
slate swan
#

yea

#

if you have message_content intents, sure

slate swan
#

the thing i'm most scared of

shrewd apex
#

who isnt

#

imagine ludo and snake and ladder on discord

paper sluice
paper sluice
robust fulcrum
#

Ig
tu = json.loads(data)
print(tu.text)

paper sluice
#

!e

from pprint import pprint
a =  {'word': 'paste', 'phonetic': '/peɪst/', 'phonetics': [{'text': '/peɪst/', 'audio': 'https://api.dictionaryapi.dev/media/pronunciations/en/paste-us.mp3', 'sourceUrl': 'https://commons.wikimedia.org/w/index.php?curid=1113778', 'license': {'name': 'BY-SA 3.0', 'url': 'https://creativecommons.org/licenses/by-sa/3.0'}}], 'meanings': [{'partOfSpeech': 'noun', 'definitions': [{'definition': 'A soft moist mixture, in particular:', 'synonyms': [], 'antonyms': []}, {'definition': 'A substance that behaves as a solid until a sufficiently large load or stress is applied, at which point it flows like a fluid', 'synonyms': [], 'antonyms': []}, {'definition': 'A hard lead-containing glass, or an artificial gemstone made from this glass.', 'synonyms': [], 'antonyms': []}, {'definition': 'Pasta.', 'synonyms': [], 'antonyms': []}, {'definition': 'The mineral substance in which other minerals are embedded.', 'synonyms': [], 'antonyms': []}], 'synonyms': [], 'antonyms': []}, {'partOfSpeech': 'verb', 'definitions': [{'definition': 'To stick with paste; to cause to adhere by or as if by paste.', 'synonyms': [], 'antonyms': []}, {'definition': 'To insert a piece of media (e.g. text, picture, audio, video) previously copied or cut from somewhere else.', 'synonyms': [], 'antonyms': []}, {'definition': 'To strike or beat someone or something.', 'synonyms': [], 'antonyms': []}, {'definition': 'To defeat decisively or by a large margin.', 'synonyms': [], 'antonyms': []}], 'synonyms': [], 'antonyms': []}], 'license': {'name': 'CC BY-SA 3.0', 'url': 'https://creativecommons.org/licenses/by-sa/3.0'}, 'sourceUrls': ['https://en.wiktionary.org/wiki/paste']}
pprint(a)
#

fff

unkempt canyonBOT
#

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

001 | {'license': {'name': 'CC BY-SA 3.0',
002 |              'url': 'https://creativecommons.org/licenses/by-sa/3.0'},
003 |  'meanings': [{'antonyms': [],
004 |                'definitions': [{'antonyms': [],
005 |                                 'definition': 'A soft moist mixture, in '
006 |                                               'particular:',
007 |                                 'synonyms': []},
008 |                                {'antonyms': [],
009 |                                 'definition': 'A substance that behaves as a '
010 |                                               'solid until a sufficiently '
011 |                                               'large load or stress is '
... (truncated - too many lines)

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

robust fulcrum
paper sluice
#

see its easier to figure stuff out now

paper sluice
slate swan
cloud dawn
#

pretty print, this looks like something I would make.

paper sluice
robust fulcrum
#

Guys why PyDictionary collide with replit?

paper sluice
#

because its replit

robust fulcrum
paper sluice
#

they should just add something like f{dict:#} for pretty print

#

like in rust

robust fulcrum
#

Btw is there any playstore api for searching apps?

cloud dawn
#

Just use json dump

#

!d json.dumps

unkempt canyonBOT
#

json.dumps(obj, *, skipkeys=False, ensure_ascii=True, check_circular=True, allow_nan=True, cls=None, indent=None, separators=None, default=None, sort_keys=False, **kw)```
Serialize *obj* to a JSON formatted [`str`](https://docs.python.org/3/library/stdtypes.html#str "str") using this [conversion table](https://docs.python.org/3/library/json.html#py-to-json-table). The arguments have the same meaning as in [`dump()`](https://docs.python.org/3/library/json.html#json.dump "json.dump").

Note

Keys in key/value pairs of JSON are always of the type [`str`](https://docs.python.org/3/library/stdtypes.html#str "str"). When a dictionary is converted into JSON, all the keys of the dictionary are coerced to strings. As a result of this, if a dictionary is converted into JSON and then back into a dictionary, the dictionary may not equal the original one. That is, `loads(dumps(x)) != x` if x has non-string keys.
paper sluice
slate swan
#

just save the dictionary as a python file and run black on it DaniGlasses

paper sluice
#

!e

import json

from fishhook import hook, orig


@hook(dict)
def __format__(self, formatter):
    if formatter == '#':
        return json.dumps(self, indent=4)
    return orig(formatter)


a = {'a': {'b': 2}}
print(f'{a:#}')
unkempt canyonBOT
#

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

001 | {
002 |     "a": {
003 |         "b": 2
004 |     }
005 | }
paper sluice
#
    view = miru.View()
    view.add_item(WikiOptions(results, cls=wiki, invoker=ctx.user))
    await ctx.respond(embed=embed, components=view.build())

@slate swan callback isn't being called

slate swan
paper sluice
#

oh ok, tyvm

eager bluff
#

can a bot receive a command from a webhook?

slate swan
#

yeah just override the on_message

eager bluff
#

i dont have on_message anywhere in my code

#

💀

drifting arrow
#

How do I get this full traceback to be sent as a message on discord?

cloud dawn
#

But you don't want any errors?

drifting arrow
#

I know I dont want errors/bugs in my program. but it's not always possible to avoid them. there's always something new

#

So I want it to be sent as a message in discord instead of appearing in console

cloud dawn
#

I recommend just fixing them, this looks like you just don't have an error handler set up yet.

drifting arrow
#

I do intend on fixing them.. but I dont want to have to load up the console each time and view it through there.

#

I want it to appear in a message

shrewd apex
#

dm urself the traceback

drifting arrow
#

Still doesnt help. Coz If I could DM myself, i'd be able to send it as a message..

#

what do I need to target in order to even send it at all?

slate swan
shrewd apex
eager bluff
cloud dawn
shrewd apex
#

mhm i was just saying for the dm part

crude coyote
#

how would you go about sending a payload to the discord websocket (im using version 9 ), to send a message? I have already retrieved a message and its content but i do not know how to send a payload to the gateway to send a message (if you know what i mean)

slate swan
#

!d discord.abc.Messageable.send why a payload?

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

Sends a message to the destination with the content given.

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

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

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

im making my own lib, i want to send a json payload to the websocket

slate swan
#

hm, 1min

crude coyote
#

oh thanks

robust fulcrum
#

Guys i saw many users use typing module in their discord bot. Whats use of typing module?

jovial urchin
#

How do I set the activity of my discord.py bot? And when is the bot fully set up? Is it on_ready?

potent spear
#

you can set it in the constructor
activity=...

jovial urchin
#

It doesn't show up as an option. Do you mean where I set the command prefix?

slate swan
crude coyote
#

thanks so much

potent spear
crystal cliff
#

Hi 👋 how do I link member background check to on member join in d.py?

potent spear
crystal cliff
jovial urchin
#

Like this? bot = commands.Bot("!", help_command="!help", activity="Playing somegame") Gives me an error

#

TypeError: activity parameter must derive from BaseActivity.

potent spear
slate swan
#

!d discord.Activity needs to be this object ^ or any BaseActivity like Playing/Watching class

cloud dawn
#

!d discord.ext.commands.Bot

unkempt canyonBOT
#

class discord.Activity(**kwargs)```
Represents an activity in Discord.

This could be an activity such as streaming, playing, listening or watching.

For memory optimisation purposes, some activities are offered in slimmed down versions:

• [`Game`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Game "discord.Game")

• [`Streaming`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Streaming "discord.Streaming")
#

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.
jovial urchin
#

So I make an instance of the Activity class and then pass it to the constructor?

slate swan
#

correct

robust fulcrum
#

Guys can anyone give me a suggestion for a command for my bot?

vagrant terrace
#

You're about to say I'm an idiot... but I'm coding a discord bot and can anyone explain to me why this is not working

crystal cliff
jovial urchin
#

How do I design command parsing for my bot

jovial urchin
robust fulcrum
#

I asking for new suggestion for me

jovial urchin
cloud dawn
robust fulcrum
jovial urchin
#

How do I create proper command parsing for my bot?

#

Like unix style

cloud dawn
#

!d discord.ext.commands.Context

unkempt canyonBOT
#
class discord.ext.commands.Context(*, message, bot, view, args=..., kwargs=..., prefix=None, command=None, invoked_with=None, invoked_parents=..., invoked_subcommand=None, ...)```
Represents the context in which a command is being invoked under.

This class contains a lot of meta data to help you understand more about the invocation context. This class is not created manually and is instead passed around to commands as the first parameter.

This class implements the [`Messageable`](https://discordpy.readthedocs.io/en/latest/api.html#discord.abc.Messageable "discord.abc.Messageable") ABC.
paper sluice
#

discord.py:

from abc import ABC
from functools import partial
import re
from textwrap import shorten, wrap
from typing import Optional, Pattern

from aiohttp import ClientSession
from async_lru import alru_cache
from bs4 import BeautifulSoup
import discord
from discord import app_commands, Embed, SelectOption
from discord.ext import commands
from discord.ext.menus import ListPageSource
from wikipediaapi import Wikipedia

from ryubot import RyuBot
from utils.abstract import check_author
from utils.paginator import Paginator
from utils.utilz import color

hikari:

from asyncio import get_event_loop
from functools import partial
import re
from textwrap import shorten, wrap
from typing import Optional, Pattern, TYPE_CHECKING

from aiohttp import ClientSession
from async_lru import alru_cache
from bs4 import BeautifulSoup
import hikari
from hikari import Embed, SelectMenuOption
import lightbulb
import miru
from miru import SelectOption
from wikipediaapi import Wikipedia

from utils.helper import check_author, Color
from utils.paginator import RyuPages

if TYPE_CHECKING:
    from bot import RyuBot
#

interactions in hikari are quicker compared to discord.py

slate swan
#

So much red

cloud dawn
#

Mine's green

jovial urchin
jovial urchin
cloud dawn
maiden fable
#

@slate swan what's yr client?

jovial urchin
#

and a command decorator is used to denote that its a command?

cloud dawn
#

It's a variable that contains various information about the channel, guild, member, user and the command itself.

cloud dawn
#

Not only to denote but to initialize.

jovial urchin
swift pumice
#

how can i do an command that will translate a text? like !translate (text)

crude coyote
#

it keeps giving me an error 4002 couldn't unpack payload

paper sluice
maiden fable
paper sluice
paper sluice
slate swan
paper sluice
#

hmm habits ig

paper sluice
slate swan
#

used to be me until i got fed up

swift pumice
paper sluice
jovial urchin
#

Uh, is it like calling a function normally?

slate swan
paper sluice
jovial urchin
#

Would you mind writing a short example of how to use the decorator to ban a user?

#

@bot.command

slate swan
jovial urchin
#

what

#

Wdym make a command?

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/latest/api.html#discord.Guild.ban "discord.Guild.ban").
paper sluice
#

i can then type hi.. it selects hikari

jovial urchin
#

oooh, so far ive just read the message they sent and see if it matches up with a string like "!mute" and then I mute

slate swan
paper sluice
jovial urchin
#

So if I create a function like ban-user and make it a command then it can be called by using the prefix and the function name in discord?

eager bluff
#

Client.event() missing 1 required positional argument: 'coro'

what does this mean and how do i fix it?

frozen patio
#

Remove the ()

#

don’t need that for events

eager bluff
frozen patio
#

Ok

#

Then it should work

#

Try to run it

eager bluff
#

then i get the error i just said

frozen patio
#

Yeah

#

I thought they did that smh

jovial urchin
#

hmm ok, how do I make sure they add options like a user to ban?

frozen patio
#

Use args?

eager bluff
#

so just this?

slate swan
# eager bluff

Bot there is meant to be an instance not the class itself

slate swan
frozen patio
paper sluice
frozen patio
#

bot = commands.Bot(command_prefix=“”)

eager bluff
#

oh wait L

#

just realised im dumb

paper sluice
eager bluff
#

yeah i just realised

#

im actually the smartest man alive

frozen patio
#

Ok

paper sluice
frozen patio
#

Same

heady sluice
paper sluice
#

thanks for the info

jovial urchin
#
activity = discord.Game("!help")
bot = commands.Bot("!", activity=activity)

@bot.event
async def on_ready():
    print(f"We have logged in as {bot.user}")


@bot.event 
async def on_message(message):
    pass

@bot.command()
async def testprint(ctx):
    print("testing")

why doesn't this print "testing" when I do !testprint in the server? @slate swan

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.
jovial urchin
#

AttributeError: 'Intents' object has no attribute 'message_content'

#

when I pasted in your code. Btw what is an intent?

cloud dawn
#

!d discord.Intents

unkempt canyonBOT
#

class discord.Intents(value=0, **kwargs)```
Wraps up a Discord gateway intent flag.

Similar to [`Permissions`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Permissions "discord.Permissions"), the properties provided are two way. You can set and retrieve individual bits using the properties as if they were regular bools.

To construct an object you can pass keyword arguments denoting the flags to enable or disable.

This is used to disable certain gateway features that are unnecessary to run your bot. To make use of this, it is passed to the `intents` keyword argument of [`Client`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Client "discord.Client").

New in version 1.5.
jovial urchin
#

Is that for windows?

jovial urchin
cloud dawn
jovial urchin
eager bluff
#

why does this say on_message() missing 1 required positional argument: 'username'

maiden fable
#

Not username, smartest person

#

U just have message, which is a discord.Message instance

slate swan
cloud dawn
eager bluff
maiden fable
eager bluff
jovial urchin
eager bluff
#

noooo

maiden fable
#

What do you need access to?

slate swan
eager bluff
jovial urchin
eager bluff
#

i dont actually need the discord username thats just like name for the arg

eager bluff
#

already tried many times

slate swan
jovial urchin
#

I can't update to v2.0. I try to use pip install -U discord.py but it says that everything is already satisfied and remains at 1.7.3

eager bluff
#

if my webhook sends a command it wont work

#

so thats why i use bot.event

jovial urchin
#

yeah but im on windows

maiden fable
#

Wait what? I thought u were Musk's son

jovial urchin
#

C:\Users\Alfons>python3 -m pip install git+https://github.com/Rapptz/discord.py
Python was not found; run without arguments to install from the Microsoft Store, or disable this shortcut from Settings > Manage App Execution Aliases.

slate swan
#

python not python3

#

that wont work unless you have python 1 or 2

jovial urchin
#

C:\Users\Alfons>python -m pip install git+https://github.com/Rapptz/discord.py
Collecting git+https://github.com/Rapptz/discord.py
Cloning https://github.com/Rapptz/discord.py to c:\users\alfons\appdata\local\temp\pip-req-build-zladnbz5
ERROR: Error [WinError 2] The system cannot find the file specified while executing command git version
ERROR: Cannot find command 'git' - do you have 'git' installed and in your PATH?

slate swan
eager bluff
#

okay wait is there a different way to receive a command from a webhook than this or not?
@bot.command() doesnt work for whatever reason so idk

maiden fable
#

Richest man

slate swan
paper sluice
#

melon 🍈

eager bluff
eager bluff
paper sluice
#

so ur musk

slate swan
#

the parameter inside on_message isnt an instance of message but of Message...

#

and you wont be doing anything in that override either.

eager bluff
slate swan
#

you need to change the Bot below too

#

and wrong typehints

slate swan
paper sluice
#

oh, nice to meet you 😄

jovial urchin
#

Is it supposed to look like this when I do pip list? discord.py 2.0.0a4376+g55849d99

slate swan
#

yes indeed.

eager bluff
eager bluff
jovial urchin
eager bluff
#

or is it still the wrong way

slate swan
slate swan
eager bluff
eager bluff
fossil monolith
#

you can get it’s content by doing message.content

slate swan
slate swan
#

if you wanna make a command use the commands module

fossil monolith
#

^

#

I’m pretty sure using on_message for commands is discouraged

cloud dawn
paper sluice
#

what is revolt?

pliant gulch
#

Typescript & Rust

slate swan
#

nah, its open source and written in js + rust, this is just a part of the organisation

paper sluice
#

oh

eager bluff
eager bluff
#

actually i have an idea

slate swan
#

you need to create commands with the commands module

eager bluff
jovial urchin
#

The problem was that I had an on_message function active that seemed to take precedence over the command, basically not allowing the command to view what was sent

slate swan
#

how do I accept a bot tester invite?

unkempt canyonBOT
#

Using intents in discord.py

Intents are a feature of Discord that tells the gateway exactly which events to send your bot. By default discord.py has all intents enabled except for Members, Message Content, and Presences. These are needed for features such as on_member events, to get access to message content, and to get members' statuses.

To enable one of these intents, you need to first go to the Discord developer portal, then to the bot page of your bot's application. Scroll down to the Privileged Gateway Intents section, then enable the intents that you need.

Next, in your bot you need to set the intents you want to connect with in the bot's constructor using the intents keyword argument, like this:

from discord import Intents
from discord.ext import commands

intents = Intents.default()
intents.members = True

bot = commands.Bot(command_prefix="!", intents=intents)

For more info about using intents, see the discord.py docs on intents, and for general information about them, see the Discord developer documentation on intents.

jovial urchin
#

No I removed the intents stuff and downgraded to 1.7.3 again and just removed the on_message part and now It works

#

I agree but thats what happened

slate swan
#

more like broken code, not the library.

jovial urchin
#

I mean the bot has administrator priviliges?

slate swan
#

The problem was that I had an on_message function active that seemed to take precedence over the command, basically not allowing the command to view what was sent
if this was the case most of the bots would be at 1% of their functionality

#

message_content is included in the message intent in 1.7.3, and when you dont pass intents in 1.7.3 its discord.Intents.default

#

which has message intent already

vocal snow
jovial urchin
#
import discord
from discord.ext import commands


activity = discord.Game("!help")
bot = commands.Bot("!", activity=activity)


@bot.event
async def on_ready():
    print(f"We have logged in as {bot.user}")

@bot.event 
async def on_message(message):
    print("read")

@bot.command()
async def test(ctx, arg):
    await ctx.send(arg)

with open("token.txt", "r") as f:
    token = f.read()
bot.run(token)

The command is only run when I comment out the on_message part, when its not commented it prints "read" instead of executing the test() func

pliant gulch
jovial urchin
#

Yeah but then it doesn't execute the func

jovial urchin
#

Say for example, I wanted to keep track of how many messages a member has sent, whats the best way to do it?

#

Is it sqlit3? Like create a db file or do I need an entire dbms like mysql?

potent spear
#

since you'll have to create a table which stores the member ID and the message count

jovial urchin
#

well yeah but should I do it with sqlite or a dbms? Which is best suited

slate swan
#

anyone can help me make a Gmail gen?

potent spear
potent spear
jovial urchin
# potent spear do you even know the difference?

sqlit3 works directly from the script and can do in memory storage or interract with another .db file to store the data. A dbms creates a connection for me to interract with a database management system like mysql?

#

@potent spear is it not correct?

potent spear
#

it's just a filebased dbms

sick birch
potent spear
#

a client/server dbms is mysql or postgresql etc

jovial urchin
#

Yeah but what I meant is that the management is performed in the script itself, while connecting to a dbms just tells it what to do and it does it for me

potent spear
#

when to choose A over B?

As SQLite is a file-based DBMS, it can cause performance issues with larger datasets because of file system limitations. It would be appropriate to choose client/server databases like MySQL and PostgreSQL in these instances, especially when dealing with large datasets like Big Data

sick birch
#

What do you mean by "management"?

potent spear
#

I guess CRUD operations

jovial urchin
#

I thought, that when using something like mysql in python, I created a connection object which I fed all the instructions through and then mysql did the management(crud like sniper said).

sick birch
#

Overall, yes, that is correct

jovial urchin
#

?

sick birch
#

SQLite is easier in general, but not necessarily because of a lack of heavy workload

potent spear
#

migrating isn't hard anyways, so sure, you could start with a file-based dbms

jovial urchin
#

aight

hardy wing
#

trying to install the latest version of discord.py by doing this pip install git+https://github.com/Rapptz/discord.py
it's telling me The system cannot find the file specified while executing command git version ERROR: Cannot find command 'git' - do you have 'git' installed and in your PATH?
how would I fix this?

potent spear
#

pip install -U git+https://github.com/Rapptz/discord.py

pliant gulch
#

You need git installed before you can install with git+

sick birch
hardy wing
#

googling it gave me stuff relating to files not being found rather than git

#

well how would I install git

#

like pip install git

potent spear
#

that's also a question you can google

#

we are NOT your personal google

sick birch
#

It also happens the first result is the official download link to install git

quaint epoch
sick birch
plucky forge
#

Hey I have a problem with an error

#

It sends that discord_components is not named

#

And really

potent spear
#

why don't you copy paste the error in here instead of taking pics of your screen?

plucky forge
heady sluice
#

third party libs moment

plucky forge
#

Excuse me

potent spear
#

I hope you know what a venv is, right?

#

since you're using it

#

well anyways, you still have to install the components lib in your venv

plucky forge
#

Yes I have installed discord components

potent spear
#

not in your venv

plucky forge
#

I’m using Ubuntu Operating System

potent spear
#

doesn't matter

plucky forge
#

Ok

plucky forge
#

Thanks 😊

potent spear
#

idk what YT tutorial you're following, but let me tell you, they suck

plucky forge
#

Ok 🤣

plucky forge
#

It works

#

Thanks

balmy bobcat
#

hi, I want my bot to send a gif when someone reacts to a message with a certain emote, but I want the gif to be sent only once no matter how many people click on the reaction

#
@client.event
async def on_raw_reaction_add(payload):
    if payload.emoji.name=="✝️":
        channel = payload.channel_id
        channel = client.get_channel(channel)
        await channel.send("https://tenor.com/view/caesar-anthonio-zeppeli-jo-jos-bizarre-mad-angry-pissed-gif-15097694")
#

because here if we are 5 to click on the reaction, the gif will be sent 5 times

slate swan
#

🙉

balmy bobcat
#

🌝

slate swan
#

but this check fails if someone reacts and unreacts

#

Hi, what is this This client already has an associated command tree.

#

i didn't any before & after that line: self.tree = discord.app_commands.CommandTree(self)
it is from the example in pinned messages

#

the client already has a CommandTree

#

are you using commands.Bot?

#

yeah

#

ig that affects

#

which example did you use?

#

i used commands.Bot.command

paper sluice
#

commands.Bot already has commandtree, why are u making one?

slate swan
slate swan
paper sluice
slate swan
paper sluice
#

send the link of the example u are referring to

slate swan
#

pinned messages

#

i mean there are many examples in that one, which one did you use?

hot quartz
#

hi how does one decrypt python files

paper sluice
slate swan
#

sorry, i didn't notice that i should use Client

#

thank you all

sick birch
paper sluice
#

.pyc to .py? why

sick birch
#

There are a few tools but it's not really viable

#

Why do you need to decompile it?

hot quartz
paper sluice
hot quartz
slate swan
#

Sorry i am very new to this but

import discord

class SlashClient(discord.Client):
    def __init__(self) -> None:
        super().__init__(intents=discord.Intents.default())
        self.tree = discord.app_commands.CommandTree(self)
    
    async def setup_hook(self) -> None:
        self.tree.copy_global_to(guild=discord.Object(id=12345678900987654))
        await self.tree.sync()

client = SlashClient()

@client.tree.command(name="ping", description="...")
async def _ping(interaction: discord.Interaction) -> None:
    await interaction.response.send_message("pong")

client.run("token")

if i typed /ping the bot should say pong right ? but nothing happened

paper sluice
slate swan
slate swan
#

i put it

#

also for token ...

slate swan
#

I should add comments there ig

slate swan
slate swan
#

oh i forget that guild means server.

#

sorry again

paper sluice
slate swan
#

How can I check if a role is mentioned in command with these parameters? async def add(ctx,member:discord.Member,role:discord.Role):

#

I want a command when I send !add tag a member mention role , to add the role to that member

torn sail
#

!d discord.Member.add_roles

unkempt canyonBOT
#

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

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

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

sparky has been typing for ages just to say .

#

then delete it pithink

unkempt canyonBOT
#
Not gonna happen.

No documentation found for the requested symbol.

torn sail
slate swan
#

the same thing, no thing happened

slate swan
slate swan
#

my whole code:

import discord
from discord.utils import get
from discord.ext import commands
from discord.ext.commands import Bot

intents = discord.Intents.default()
intents.members = True

class SlashClient(discord.Client):
    def __init__(self) -> None:
        super().__init__(command_prefix="/", intents=intents)
        self.tree = discord.app_commands.CommandTree(self)

    async def setup_hook(self) -> None:
        self.tree.copy_global_to(guild=discord.Object(id=969031491587821638))
        await self.tree.sync()

bot = SlashClient()

@bot.event
async def on_ready():
    print("Ready")

@bot.tree.command(name="ping", description="...")
async def _ping(interaction: discord.Interaction):
    await interaction.response.send_message("pong")

bot.run("token")
slate swan
slate swan
slate swan
#

yes I know what I wrote

slate swan
slate swan
#

NO!

#

nvm

slate swan
#

i am just very beginner to this, this is my first time

paper sluice
slate swan
slate swan
paper sluice
slate swan
warped mirage
#
@client.tree.command()
@commands.has_permissions(ban_members = True)
async def ban(ctx, member : discord.Member, *, reason: str):
    await member.ban(reason=reason)
    await ctx.send(f"{member.id} has been banned for {reason}")
    await member.send(f"You have been banned in {ctx.guild} for {reason}")``` can someone check this code, i received errors with it before
paper sluice
warped mirage
#

ok sure

paper sluice
#

ok i see it, u can't send message to a person after kicking/banning from guild

#

unless the bot and the user have a guild in common

#

so send the message b4 banning

warped mirage
#

that will fix it?

paper sluice
#

it should

#

well, idk if the error is exactly that, but i assume it is

slate swan
paper sluice
paper sluice
shrewd apex
#

no face to live on

slate swan
#

So check if u can ban them or not first then send

slate swan
# paper sluice no

ah, i got 403 Forbidden (error code: 50001): Missing Access btw
line 16, in setup_hook await self.tree.sync(guild=discord.Object(id=969031491587821638))

shrewd apex
#

exactly

#

lmao

slate swan
#

hi

shrewd apex
#

sparky doing fortune telling

shrewd apex
slate swan
slate swan
warped mirage
#
Ignoring exception in command 'ban':
Traceback (most recent call last):
  File "C:\Users\Dom\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\app_commands\commands.py", line 650, in _do_call
    return await self._callback(interaction, **params)  # type: ignore
  File "C:\Users\Dom\Desktop\ZEEFUT UTILITIES\main.py", line 50, in ban
    await member.send(f"You have been banned in {ctx.guild} for {reason}, Would you like to appeal? Join this server: ")  File "C:\Users\Dom\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\abc.py", line 1537, in send
    data = await state.http.send_message(channel.id, params=params)
  File "C:\Users\Dom\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\http.py", line 496, in request
    raise Forbidden(response, data)
discord.errors.Forbidden: 403 Forbidden (error code: 50007): Cannot send messages to this user

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

Traceback (most recent call last):
  File "C:\Users\Dom\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\app_commands\tree.py", line 1122, in call
    await command._invoke_with_namespace(interaction, namespace)
  File "C:\Users\Dom\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\app_commands\commands.py", line 675, in _invoke_with_namespace
    return await self._do_call(interaction, transformed_values)
  File "C:\Users\Dom\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\app_commands\commands.py", line 668, in _do_call
    raise CommandInvokeError(self, e) from e
discord.app_commands.errors.CommandInvokeError: Command 'ban' raised an exception: Forbidden: 403 Forbidden (error code: 50007): Cannot send messages to this user```
paper sluice
shrewd apex
#

dms blocked :kek:

slate swan
#

they banned the user, and tried sending the message later

slate swan
#

totally not me moment

warped mirage
slate swan
#

i didn't check application commands

slate swan
#

OK enough I'm going to sleep I can't even msg

#
try:
    # sending dm
except discord.Forbidden:
    # couldnt send
#

Gn everyone pyllow

shrewd apex
paper sluice
shrewd apex
#

what's Ashley typing from so long 👀 💀

paper sluice
slate swan
slate swan
#

it worked thank you all !

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

the thumbnail 💀

slate swan
warped mirage
#

lol im confused lmao

slate swan
#

cool

#

!indents

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

paper sluice
slate swan
#

!Pip uwu

unkempt canyonBOT
warped mirage
#

its not just indents

paper sluice
#

.wa uwu

slate swan
shrewd apex
#

i am pretty sure i will forget english reading that

slate swan
paper sluice
#

.wa meaning uwu

#

lmao

slate swan
#

..

slate swan
paper sluice
warped mirage
#

this works?

slate swan
paper sluice
slate swan
slate swan
warped mirage
warped mirage
shrewd apex
#

ctx.reply()

slate swan
pliant gulch
#

Instead of banning them right away, why don't you send a message to the user being banned before banning them

pliant gulch
#

Then it wouldn't error because the user is still in a mutual guild with the bot

#

Then afterwards do the ban call

warped mirage
slate swan
sick birch
warped mirage
#

oh i see

slate swan
pliant gulch
#

Just change the ordering of the calls and it'll work for DMs

sick birch
#

Good point

pliant gulch
sick birch
#

Rather than always send in the channel, it'll only send if sending in DMs doesn't work

warped mirage
paper sluice
warped mirage
slate swan
slate swan
warped mirage
#

lmao im confusedn lg

swift pumice
#
async def übersetze(ctx,*, args):
    ü = Translator()
    translation = ü.translate(args, dest="de")
    await ctx.send(translation)
``` my problem  i want that it will only send like hallo wie gehts the text you guys know?
slate swan
#

nice

#

which library

slate swan
#

also, dont create a Translator instance each time, not memory efficient

warped mirage
#

i need it to send , dm message , normal message and if any errors it will ctx.reply and let u know the error

swift pumice
slate swan
swift pumice
#

sry

slate swan
#

💀 just make a global one no

#

^

#

just like ur bot variable

#

and isnt u.translsate blocking?

warped mirage
#

does this work?

shrewd apex
#

it should be

slate swan
#

yeah it probably is

shrewd apex
#

it prolly uses requests

slate swan
warped mirage
shrewd apex
#

after except

slate swan
#

i dont think its confusing at all.

shrewd apex
#

indents only 1 level

warped mirage
shrewd apex
warped mirage
slate swan
#

f

shrewd apex
#

🤦

warped mirage
#

u said

slate swan
#

yeah though asher was unclear

shrewd apex
#

just put it at the Bottom

slate swan
#

after the except block

#

just use discord's ban command.

warped mirage
#

this doesnt make any sense now

shrewd apex
slate swan
#

bruh 💀 you guys

shrewd apex
#

:kek:

slate swan
slate swan
shrewd apex
#

sorry UwU

shrewd apex
slate swan
warped mirage
#
send a message that user is banned in dms
send a message in chat that user is banned
if a user has dms closed return a error message that the user has been banend but the dm coudnt have been sent``` i need this .
slate swan
vocal snow
#

is there a way to make PR for gist?

slate swan
#

not yet

vocal snow
shrewd apex
#

🥲

warped mirage
#

can someone help me then

slate swan
slate swan
shrewd apex
#

i think we still lack the level of expertise to help u just jk

slate swan
#

just jk

#

do bot.event need permissions ?

warped mirage
paper sluice
slate swan
slate swan
warped mirage
slate swan
#

yep

toxic thicket
#

How to make it so that if a certain person entered a command, then a picture was sent to him, and another picture was sent to others, and if a certain person was pinged, then the same picture was sent

slate swan
warped mirage
#

even if the dm hasnt been sent will the user still get banned or do i need to add more

slate swan
# slate swan thanks btw

you'll get credits if you do a re-write with more information and link it in the comment section

vocal snow
paper sluice
slate swan
vocal snow
#

i am being serious!!

warped mirage
#

even if the dm hasnt been sent will the user still get banned or do i need to add more?

slate swan
warped mirage
#

i need to add more fr?

paper sluice
slate swan
slate swan
shrewd apex
warped mirage
#

so it will still ban the user no matter what?

shrewd apex
#

remember ryuga's rule number 1

slate swan
#

i just said yes

slate swan
# slate swan do `bot.event` need permissions ?

i got missing permissions again, i did bot application commands and Administrator.

@bot.event
async def on_member_join(member):
    ch = bot.get_channel(990901540275507260)
    em = discord.Embed(title="Welcome!", url="https://discord.com/channels/969031491587821638/969031491587821641",
                       description="Feel free here to talk. there is only one rule which is **DON'T HURT ANYONE** that's all.\nMore information in the above link!", color = discord.Color.blue())
    em.set_author(name=member, icon_url=member.avatar_url)
    await ch.send(embed=em)
shrewd apex
#

are u trying to kick the owner or something 👀 💀

slate swan
swift pumice
#

ryuga and ashley would be such a good couple

slate swan
#

oh this is

#

you're missing send perms ig

slate swan
warped mirage
#
Ignoring exception in command 'ban':
Traceback (most recent call last):
  File "C:\Users\Dom\Desktop\ZEEFUT UTILITIES\main.py", line 52, in ban
    await ctx.send(f"{member.id} has been banned for {reason}")
AttributeError: 'Interaction' object has no attribute 'send'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\Dom\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\app_commands\commands.py", line 650, in _do_call
    return await self._callback(interaction, **params)  # type: ignore
  File "C:\Users\Dom\Desktop\ZEEFUT UTILITIES\main.py", line 54, in ban
    await ctx.reply(f"The user you are trying to ban has DM's closed", ephemeral = True)
AttributeError: 'Interaction' object has no attribute 'reply'

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

Traceback (most recent call last):
  File "C:\Users\Dom\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\app_commands\tree.py", line 1122, in call
    await command._invoke_with_namespace(interaction, namespace)
  File "C:\Users\Dom\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\app_commands\commands.py", line 675, in _invoke_with_namespace
    return await self._do_call(interaction, transformed_values)
  File "C:\Users\Dom\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\app_commands\commands.py", line 668, in _do_call
    raise CommandInvokeError(self, e) from e
discord.app_commands.errors.CommandInvokeError: Command 'ban' raised an exception: AttributeError: 'Interact
ion' object has no attribute 'reply'```
shrewd apex
#

channel send permission

slate swan
# shrewd apex channel send permission

this worked

@bot.tree.command(name="ping", description="...")
async def _ping(interaction: discord.Interaction):
    await interaction.response.send_message("pong")
shrewd apex
slate swan
#

both perm systems work different

slate swan
#

yep

shrewd apex
#

also if u are using slash then why do u have avatar_url

warped mirage
shrewd apex
#

bro i don't know slash commands enough to help u ask sarth and Ashley

warped mirage
slate swan
shrewd apex
#

it's interaction.response.send_message()

slate swan
#

and its inter.response.send_message

shrewd apex
#

f my bad

slate swan
jovial urchin
#

What should I be logging in my discord bot? Like what's important

slate swan
shrewd apex
slate swan
slate swan
slate swan
shrewd apex
#

u and Oki have inbuilt interpreters👀

slate swan
warped mirage
slate swan
slate swan
slate swan
unkempt canyonBOT
shrewd apex
slate swan
#

I still dont understand how much you guys can shitpost

shrewd apex
warped mirage
shrewd apex
slate swan
slate swan
slate swan
#

why does log messages never appear in stdout if theyre on another file? 😳

shrewd apex
slate swan
#

is there another way to post on_member_join messages ?
i mean like discord.Interaction, i got Missing permissions. because discord.Interaction worked well

warped mirage
#

Btw for one of the messages u put interaction. And other stuff , can I change it back to inter since that’s my interaction

slate swan
slate swan
vocal snow
#

lmaO

shrewd apex
#

ok gn i gtg

slate swan
#

night night

slate swan
slate swan
slate swan
shrewd apex
thick marsh
#

дарова

slate swan
slate swan
#

or 3 ✨ pure ✨ ones

thick marsh
#

русские есть?

slate swan
# slate swan 4-5

woah, i know the bot.get_channel(id).send can you tell me another way ?

#

!rule 4 please

unkempt canyonBOT
#

4. Use English to the best of your ability. Be polite if someone speaks English imperfectly.

slate swan
slate swan
#

all sends and replies revolve around the 2nd method

#

thank you, ig i will use the second one

#
await Context.send()
await TextChannel.send()
await abc.Messageable.send()

are the methods

#

internal method usage👁️👁️

jovial urchin
#

To ban someone, do I need to give the ban function the id of the person or the full username like alfons#7577?

slate swan
#

yes ofcourse

#

thanks

slate swan
slate swan
slate swan
warped mirage
slate swan
jovial urchin
slate swan
#

Why so late

slate swan
slate swan
slate swan
slate swan
jovial urchin
slate swan
slate swan