#discord-bots
1 messages · Page 1123 of 1
even friends rqs are disabled, goodluck
bruh XD
lmao
you can use rest api in that app seperately...
how do you mean that?
doesn't really have something to do with your running bot
I want the rest api to be able to fetch data over my discord bot, how would I connect them?
So I only need this then I have all the functionality of discord.py and more?
yes and no
by "Rest api" do you mean Discord's Rest api or your own?
My own, using flask
what does that mean- importing discord gives you all the functionality
I mean like do I need to import discord aswell?
you can use hikari for that flask app, they provide you a seperate restclient which can be used to make request to discord and fetch data
You can set up a flask server alongside your discord bot right?
replit users: yes
oh, okay, I will look into that
Lmao not like that
I have a own vps, but I want the flask server to communicate with the bot, once someone requests, I want the bot to fetch for example a nickname
depends if you need anything from it, you probably will
Like if I need on_ready, I have to import discord?
well no
Umm if you already have a flask server running on a separate process, just make HTTP requests to it using your bot?
looks like you need an ipc
communication between the bot and flask server
Is discord.Interaction is ctx ?
Which endpoint is requesting guild nicknames and rich presence?
its Interaction, as the name suggests
hmmm
I dont understand whats your usecase. Could you elaborate it more?
why use the REST when you are already using discord.py tho?
discord.Interaction and commands.Context are different, most people name context ctx.
yeah but how can i send messages using it ? like ctx should i use interaction.send
I have stuff mentioned in the guide
with examples
I want to be able to fetch the rich presence as well as nicknames from the users of my guild (where my bot is in)
and server it on a flask app, where you can request the user id to get that data
interaction.response.send_message usually
ok, thank you
And send it to the "separately running" flask server to display it like on a site or smiliar?
Okay got it
Ipc is the easiest way imo
you are right.
what is ipc?
there's like topics that cover half the issues for slash commands, and I always get ignored 😭
inter process communication
!pypi discord-ext-ipc
A discord.py extension for inter-process communication.
discontinued, not supposed to use
Is it?
ah okay
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?
its time to roll 💀
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
wait, really? how?
and which endpoint do I call for rich presence?
sorry, but i got module 'discord' has no attribute 'app_commands' ?
restart your IDE
i am using discord.py 2.0
weird
i use vim
multiple python installations
^
idk, VSC does for me
i have one python installed which is python 3.10.4
that error is just for vscode, when you rin it that works
weird
mention the version explicitly ,use python3.10 <file>
type pip show discord.py and send output
oh, okay... uh well
Hi
👋
i use command python3 app.py and when i do python3 --version i got Python 3.10.4
wouldnt it be better to create a new event loop?
do what ryuga said
👋
hmm why not asyncio.gather
no idea im not good at asyncio ¯_(ツ)_/¯
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'
@slate swan
multiple event loops in same process isn't really a nice idea
check your discord version
Dont know about rick presence, but for other user related data: https://discord.com/developers/docs/resources/user
rick
$ 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*
2.0
ya u have discord.py 1.7, install 2.0 using pip install -U git+https://github.com/Rapptz/discord.py
ah no
pip install git+https://github.com/Rapptz/discord.py
it is 1.7
That's not 2.0
i will do, thank you all guys
✨ so many answers ✨
most helpful channel
ryuga 👀 i replaced the hikari banner with a custom one, wanna see
sure
!d discord.ext.commands.Bot.create_task
No documentation found for the requested symbol.
i swear tahts what it was
you can create a banner.txt to do so
thanks cool
What's anya
does it read it automatically?
mah bot
Oh nice looks great 👍
banner kwarg in GatewayBot
Yo why tf
It doesn't send emojj
ah ok
u need :.+:
Rich presence is received over gateway right..? If multiple connections can be made using the same bot then do it otherwise go back to IPC
Guys what's hikari?
another discord api wrapper
easy: dpy
better: hikari ( personal opinion )
Yes but I'm on phone its on recommendation
When I type thumb it show 👍 in recommend
phone 💀
Yes sadly, I'm out of station
i was last week to xD
Oh nice
my water filter is broken, i can't drink water sadge
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?
they installed a filter yesterday saying its been a year and it broke today :////
i see that in most of my dependabot errors
ya
req.txt?
apparently there is something wrong with that specific version, so for now u can do something like aiohttp>=3.8.1 to suppress it
How long pip install -U git+https://github.com/Rapptz/discord.py takes usually ?
it's been a year daddy, i really really miss you
depends on ur internet, but it shouldn't take long, if it does restart ur shell and try again
[[package]]
name = "aiohttp"
version = "3.8.1"
description = "Async http client/server framework (asyncio)"
category = "main"
optional = false
python-versions = ">=3.6"
``` i do have that
yeah, i will.
can't u do ~= or >= there?
definately can, this was automatically created by poetry
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
is there a way to execute a command via a webhook or like detect when a webhook has been sent
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])
?
word["meaning"][0]
Oh k
It gave this error
Okay imma try it
Drink from tap 😂
oh then word[0]
Hikari is taati and hard
@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 ?
Oof my English 😂
it's no problem, we all make mistakes
My keyboard do it cause i mostly type fast and my keyboard learns the wrong spelling
sick autocomplete
pretty sure definition is a word too
Still
use aiohttp, not requests as you're in an async context
why are u doing this on mobile
Oh k
or try printing out the response and seeing how its actually laid out instead of guessing keys
Just random words
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
sure
bro.. make your variable name descriptive
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']}
.
This is not a Modmail thread.
not d.py
!d discord.Client.wait_for
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**...
shhhhhhhhhhhhhh
Very strange response
instead of input(), you can use wait_for and wait for messages after your bot sends a message with the quesiton
oh, try nothi[0]["meanings"][0]["definitions"][0]["definition"]
thats a normal response you get from a json api
ahhhh awesome, and instead of write i use message send
why do requests yrself when u have https://github.com/Ay-355/asyncdictionary
Async Python wrapper for the freeDictionaryAPI (https://dictionaryapi.dev/) - GitHub - Ay-355/asyncdictionary: Async Python wrapper for the freeDictionaryAPI (https://dictionaryapi.dev/)
lots of classes have the .send method (User, TextChannel, context)
shit i needa learn dpy
yeah start off with a basic bot first
how long will it take
depends on how much python you know
fair
It worked how can I get synonyms and antonyms?
just go get the correct keys
https://mystb.in/WhateverApparentlyCorrected.json heres a formatted version of the response
i have this error can someone help @paper sluice
let me tell you a trick, use pprint.pprint to print the output from the api, then it would be easier for you to get what you want
Ok
@slate swan hikari slash is uhm.. interesting.
make sure your bot has the right permissions selected when inviting it
yeah its hard to make with hikari natively, use lightbulb/tanjun/crescent
do u have oauth2 enabled in dev portal?
no
you need to enable it
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
i had the order of the decorators messed up and it took me wayy to loong to figure out why the slash commands were not loading lmao
mhm decorators in python are called from bottom to top| in lightbulb you need to mention the command type first, then the command details, then the options, and at last add it to your plugin/bot
wheres that
Whats the lightbulb version of Client?
BotApp
go to discord developer portal
Are they forcing prefixes??
no thats an option arg
their
ya got it, thanks 😄
oof dodged a bullet.
now go to oauth2
their
select bot and administrator permissions
then re invite it, let me know if it works
it’ll generate a link for you to invite the bot
👀 also, you can help_slash_command=True there for the bot to make you an automatic slash help command, you can also override it
same thing
do you have the right token?
Personally why would you need a help command with slash commands.
maybe because discord does not display all the commands on the command pallete
this
yes
double check everything
and you could re invite the bot just in case
It's nice to see that this lib is clearly also more focused on the fact it needs to be async.
and your command categories etc
that’s what i told him but not sure if he’s doing it correctly
i just did
okay, re invite your bot with the right permissions
so bot commands is checked?
Are you using a bot token?
you’re definitely doing something wrong
u said are using discord.py
show your example code without your token
when did you update discord.py for the last time?
Not 100% sure but this usually only happens when you login with a user token on a bot application or something with oauth fails.
It's hard to tell since a 405 with this small of a tb can be anything.
yeah
Guys any new discord.py command challenge for me?
Do you have a git?
what
make a 2048 game mb
is there a way to execute a command via a webhook or like detect when a webhook has been sent
chess
yes a multiplayer chess
what a pity cant send more than 25 buttons at a time
you can use on_message events
!d discord.Message.webhook_id and check on this
If this message was sent by a webhook, then this is the webhook ID’s that sent this message.
otherwise we could make board games on discord :kek:
wait can that be used to like get message content too?
💀 imagine ratelimits
the thing i'm most scared of
https://paste.pythondiscord.com/ifitiyitiv
i can't figure out whats wrong 😔 😭
Whats the trick?
it just displays it, now u have to figure out how to get the data u want
Ig
tu = json.loads(data)
print(tu.text)
!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
@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
Is it also correct?
see its easier to figure stuff out now
?
you didnt build the view ( view.build())
pretty print, this looks like something I would make.
u have to call that, ok
Guys why PyDictionary collide with replit?
because its replit
nice
they should just add something like f{dict:#} for pretty print
like in rust
Btw is there any playstore api for searching apps?
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.
ya but thats extra work
just save the dictionary as a python file and run black on it 
!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:#}')
@paper sluice :white_check_mark: Your eval job has completed with return code 0.
001 | {
002 | "a": {
003 | "b": 2
004 | }
005 | }
lmao
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
you need to start the view too,
res = await ctx.respond(....)
view.start(await res.message())
oh ok, tyvm
can a bot receive a command from a webhook?
yeah just override the on_message
wdym
i dont have on_message anywhere in my code
💀
How do I get this full traceback to be sent as a message on discord?
But you don't want any errors?
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
I recommend just fixing them, this looks like you just don't have an error handler set up yet.
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
dm urself the traceback
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?
"override"
make a error handler and the save ur I'd ie use ur I'd to fetch ur member object then do user.send()
do i just put override on_message then? beofre async def?
I mean the first error is something that should have been handled anyways and the 2nd is unavoidable.
mhm i was just saying for the dm part
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)
!d discord.abc.Messageable.send why a payload?
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**.
im not using discord.py
no, create an on_message event ```py
@Bot.event
async def on_message(message: Message) -> None:
await Bot.process_commands(message)
im making my own lib, i want to send a json payload to the websocket
hm, 1min
oh thanks
Guys i saw many users use typing module in their discord bot. Whats use of typing module?
How do I set the activity of my discord.py bot? And when is the bot fully set up? Is it on_ready?
no
you can set it in the constructor
activity=...
It doesn't show up as an option. Do you mean where I set the command prefix?
Integrate your service with Discord — whether it's a bot or a game or whatever your wildest imagination can come up with.
thanks so much
@potent spear
bot = commands.Bot(..., activity=...)
autocomplete for dpy sucks in your IDE, don't rely on it
what's a "member background check"?
Account info, date created etc help pls?
Like this? bot = commands.Bot("!", help_command="!help", activity="Playing somegame") Gives me an error
TypeError: activity parameter must derive from BaseActivity.
well, activity doesn't take a string
!d discord.Activity needs to be this object ^ or any BaseActivity like Playing/Watching class
!d discord.ext.commands.Bot
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.
So I make an instance of the Activity class and then pass it to the constructor?
correct
Guys can anyone give me a suggestion for a command for my bot?
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
Check everything
Upto you, try a basic Command to start 🤔
How do I design command parsing for my bot
wdym not working? Whats the issue, show more of the code
Bruh i have nearly 14 commands
I asking for new suggestion for me
Think of what would be useful
Remind command without the use of asyncio.sleep
time.sleep XD
How do I create proper command parsing for my bot?
Like unix style
And what is ctx in discord.py
!d discord.ext.commands.Context
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.
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
Mine's green
What do I do with that class? Do I pass it to something and how/what do I instantiate it with
That is ctx
yeah but what do I do with it? And the second question ^^
It's passed when a command decorator is used on an async function.
and a command decorator is used to denote that its a command?
It's a variable that contains various information about the channel, guild, member, user and the command itself.
In Discord.py yes.
Not only to denote but to initialize.
Wdym its passed? From where
how can i do an command that will translate a text? like !translate (text)
it keeps giving me an error 4002 couldn't unpack payload
its red on mobile
👀 why lmao
Green for me
👀
just converting dpy stuff to hikari, cuz bored
i mean why import classes when you can import the module itself and access classes
@paper sluice
hmm habits ig
use an api, google it
used to be me until i got fed up
okay thanks
i dont even import, i just use the packages i want, pycharm imports and sorts everything for me
Uh, is it like calling a function normally?
ahh fair, i hate that thing tbh
hmm why?
Would you mind writing a short example of how to use the decorator to ban a user?
@bot.command
multiple libs with same class, can issue to wrong imports
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").
it gives me prompt asking which one to import
i can then type hi.. it selects hikari
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
hm makes sense
and use a venv
i should actually
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?
Client.event() missing 1 required positional argument: 'coro'
what does this mean and how do i fix it?
hmm ok, how do I make sure they add options like a user to ban?
Use args?
so just this?
Bot there is meant to be an instance not the class itself
Mobile
No, do this
like
bot = commands.Bot(...)
@bot.event
async def cool_stuff(...):
...
bot = commands.Bot(command_prefix=“”)
command_prefix=";",
case_insensitive=True
)```
oh wait L
just realised im dumb
ya now use bot not Bot
Ok

Same
I'm the only discord.py coder in the world if we don't count other discord.py coders
thanks for the info
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
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.
AttributeError: 'Intents' object has no attribute 'message_content'
when I pasted in your code. Btw what is an intent?
!d discord.Intents
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.
Is that for windows?
So it's like a permission?
It's more like letting Discord know what information you are going to be using.
intents = discord.Intents.default()
intents.message_content = True
So what do these do?
why does this say on_message() missing 1 required positional argument: 'username'
Not username, smartest person
U just have message, which is a discord.Message instance
not using, events that can be dispatched to the bot
These enable the "default" intents and the message content.
yeah but i want to take arguments
U can't (:
😭
It makes me able to read the message content?
noooo
What do you need access to?
message.author.name
yeah if you have them enabled from the dev portal
well i need to get the arguments from a webhook and i need access to test and ok
ah ok
i dont actually need the discord username thats just like name for the arg
make a command
wut
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
wdym wut
if my webhook sends a command it wont work
so thats why i use bot.event
yeah but im on windows
Wait what? I thought u were Musk's son
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.
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?
@jovial urchin read up here, got that git error covered
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
Richest man
i just told you how to do that
melon 🍈
yeah
but it can't take args
so ur musk
because thats not how you make commands.
the parameter inside on_message isnt an instance of message but of Message...
and you wont be doing anything in that override either.
i mean yeah i used yours but message wasnt defined so i did this and then it didnt work so idk thats why
it's discord.Message and bot.process_commands(...)
oh, nice to meet you 😄
Is it supposed to look like this when I do pip list? discord.py 2.0.0a4376+g55849d99
yes indeed.
ah alrightt
thanks
never seen such a weird version description before
so wait can i add args to this now?
or is it still the wrong way
its a beta version downloaded from github so you can expect that
its correct
alright then if i add an arg it would have to be like this right
if i add an arg like this it just doesn't work
on_message only gives you message
you can get it’s content by doing message.content
👀 the developer of revolt.py ( api wrapper for revolt )/ https://github.com/Zomatree
why would it, you can add arguments like that
if you wanna make a command use the commands module
message.content everything is already there.
what is revolt?
Typescript & Rust
nah, its open source and written in js + rust, this is just a part of the organisation
oh
huh but you said if i wanted to execute a command sent from a webhook i could do it like this
that just "allows" you to
actually i have an idea
you need to create commands with the commands module
im aware i have a million commands already but im trying to get it so that it sends information from a game to discord then my bot processes that information but i think i know how to do that rn
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
how do I accept a bot tester invite?
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.
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
more like broken code, not the library.
I mean the bot has administrator priviliges?
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
@pliant gulch what happened to yours !!
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
died
Yeah but then it doesn't execute the func
ah
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?
well, you need to learn SQL first of all
since you'll have to create a table which stores the member ID and the message count
well yeah but should I do it with sqlite or a dbms? Which is best suited
anyone can help me make a Gmail gen?
do you even know the difference?
not related to this channel #❓|how-to-get-help
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?
sqlite IS a DBMS ...
it's just a filebased dbms
We sort of do this with @lusty spear, you may find inspiration there
a client/server dbms is mysql or postgresql etc
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
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
What do you mean by "management"?
I guess CRUD operations
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).
Overall, yes, that is correct
But it would be easier to use sqlit3 since there wont be a super heavy workload
?
SQLite is easier in general, but not necessarily because of a lack of heavy workload
migrating isn't hard anyways, so sure, you could start with a file-based dbms
aight
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?
have you googled the error before coming here?
pip install -U git+https://github.com/Rapptz/discord.py
You need git installed before you can install with git+
Cannot find command 'git' - do you have 'git' installed and in your PATH?
do you?
googling it gave me stuff relating to files not being found rather than git
well how would I install git
like pip install git
It also happens the first result is the official download link to install git
😔
https://git-scm.com/book/en/v2/Getting-Started-Installing-Git here you are anyway
Hey I have a problem with an error
It sends that discord_components is not named
And really
why don't you copy paste the error in here instead of taking pics of your screen?
third party libs moment
I don’t think about that 🤣🤣🤣
Excuse me
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
Yes I have installed discord components
not in your venv
I’m using Ubuntu Operating System
doesn't matter
Ok
idk what YT tutorial you're following, but let me tell you, they suck
Ok 🤣
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
🙉
🌝
you can check how many reactions are there on the message, if its 1, then only one reaction was added
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
commands.Bot already has commandtree, why are u making one?
latest one
because the example
ya which example? can u link it?
latest one
hi how does one decrypt python files
oh my bad
ok, here as well, they are using the tree directly, dont do self.tree = discord.app_commands.CommandTree(self) its already done by commands.Bot
Python files aren't encrypted in the first place. Do you mean decompile from bytecode?
yep
.pyc to .py? why
project
do you have a specific reason to convert it back?
its a task my AI lecturer gaves us and he wants to convert it back and he never taught us this
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
ok first of all, this is not the right place to ask about this and he wants you to convert a pyc to py?
.pyc isnt a file that shouldnt really be touched
because the guild id is a random in copy_global_to
it is the id of the bot right ?
i put it
also for token ...
what i should put there ? application id ? i put client id
where can i ask my questions?
server id
oh i forget that guild means server.
sorry again
i have no clue, ur question i dont think ur question really fits any topical channel, u can ask in #❓|how-to-get-help probably #internals-and-peps or #esoteric-python
it's okay
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
!d discord.Member.add_roles
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.
Thanks
Does mine parameters correct?
!d discord.Member.add_role
No documentation found for the requested symbol.
yes you can just use member.add_roles(role)
i get server id from this right ?
the same thing, no thing happened
yes god
try adding the guild to sync too
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")
sync ?
yes?
oh you mean copied code
yes I know what I wrote
Sorry Ryuga, I'm not home and I have a shi*' WiFi here
oh, sad
i am just very beginner to this, this is my first time
damn
where you are calling sync
await self.tree.sync(guild=discord.Object(id=12345678765432123467))
Also I didn't deleted that its discord smh
lol
yeah, i will do that
what is 403 Forbidden (error code: 50001): Missing Access ?
@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
can you tell what the error is?
ok sure
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
that will fix it?
Imagine sending ban msg and can't ban 💀
you mean me ?
ya i was gonna that
no
u can just jump in a well and die then
no face to live on
So check if u can ban them or not first then send
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))
hi
sparky doing fortune telling
👋
Imagine sending ban msg and can't ban 💀
you didnt invite the bot with application commands perm scope
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```
see the last line of the error
select bot and application.command and select the permissions u want ru bot to have, then copy the link and re-invite the bot
dms blocked :kek:
they banned the user, and tried sending the message later
thank you
totally not me moment
i guess i need to make a if statement and if a user has dms closed it still bans the user BUT it returns a ephemeral message, i need the help lol
i didn't check application commands
use try except
OK enough I'm going to sleep I can't even msg
try:
# sending dm
except discord.Forbidden:
# couldnt send
Gn everyone 
gn sweet dreams
watch yt
gn
what's Ashley typing from so long 👀 💀
another gist
isnt that a good thing? ur helping the community
me no uwu, me just an uwufier
Due to sh** WiFi *
reminds me that hunter sent this -> https://github.com/virejdasani/pythOwO
What does uwu means
the thumbnail 💀
absolutely not
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
¯_(ツ)_/¯
its not just indents
.wa uwu
I mean 😔 nobody cares about my gists, I'm totally fucked up in every place
i am pretty sure i will forget english reading that
not really, i use that to tell ppl why not use dpy
You got yours pinned
sign of cuteness
u literally had someone making a bot using ur gist 5 mins ago, idk what ur talking about
this works?
absolutely
rule 1 of programming, click the run button ( always )
Ooh thanks
btw, that permission check wont work
where would i add a another message? cuz i need to say that the users dms are blocked
ok what do i do then
ctx.reply()
idky was i using my github alt but yes
Instead of banning them right away, why don't you send a message to the user being banned before banning them
import checks from app_commands
https://gist.github.com/Ash-02014/b6f57065f394b54f43666037ade38d32#checking-for-permissions-and-roles
Then it wouldn't error because the user is still in a mutual guild with the bot
Then afterwards do the ban call
so i dont need to addanything?
th-thanks-
They can still have messages from guild members turned off
oh i see
not add, change the imports
Yes, but the way they have it right now, it'll always send a message in the channel
Just change the ordering of the calls and it'll work for DMs
Good point
Unless User has another mutual guild
Rather than always send in the channel, it'll only send if sending in DMs doesn't work
much better?
ban after sending the message
ye but if the user doesnt get banned..
absolutely
delete the message then
lmao im confusedn lg
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?
thats the Translated Object...
also, dont create a Translator instance each time, not memory efficient
i need it to send , dm message , normal message and if any errors it will ctx.reply and let u know the error
i dont use my pc to host my bot, so idc
still blocking
💀 just make a global one no
^
just like ur bot variable
and isnt u.translsate blocking?
does this work?
it should be
yeah it probably is
it prolly uses requests
why dont you just send the message first and ban later?
bruh im confused
i dont think its confusing at all.
indents only 1 level
^
f
🤦
u said
yeah though asher was unclear
just put it at the Bottom
this doesnt make any sense now
yeah i should prolly write a gist abt it👀
bruh 💀 you guys
:kek:
say that once more and I'm deleting that gist
if the exception here doesn't trigger it will not ban the user lol
sorry UwU
become UwU again
no you aint doing that, how will make people uninstall dpy then
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 .
no thanks, it's annoying, really annoying
is there a way to make PR for gist?
https://gist.github.com/Ash-02014/b6f57065f394b54f43666037ade38d32 i need to change "resumation" to "resumption" everywhere
🥲
can someone help me then
try:
sending message
except:
couldnt send
ban user
``` i dont think its hard at all.
pffftttt, I wrote resumation? my bad
i think we still lack the level of expertise to help u just jk
thats what u explained basically..
put it in finally 💀
😔 isnt jk just kidding already
thats not what you were doing above sir
thanks btw
is it done then
yep
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
you do it
even if the dm hasnt been sent will the user still get banned or do i need to add more
you'll get credits if you do a re-write with more information and link it in the comment section
@slate swan
i am not smart enough to contribute to your gist 🙏
😩 .
imagine still making fun of me
i am being serious!!
even if the dm hasnt been sent will the user still get banned or do i need to add more?
yes
i need to add more fr?
shes high on knowledge, ignore her for now
thats all you need to do
bro it's fine just run it
so it will still ban the user no matter what?
remember ryuga's rule number 1
i just said yes
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)
are u trying to kick the owner or something 👀 💀
go to settings, integerations, select your bot and toggle the settings on and off
ryuga and ashley would be such a good couple
?
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'```
channel send permission
this worked
@bot.tree.command(name="ping", description="...")
async def _ping(interaction: discord.Interaction):
await interaction.response.send_message("pong")
ephemeral is only for interactions
you dont really need send message perms for slash commands :p
both perm systems work different
oh, the bot has "member" role which can "send messages"
yep
also if u are using slash then why do u have avatar_url
like this?
bro i don't know slash commands enough to help u ask sarth and Ashley
@slate swan
remove ctx
it's interaction.response.send_message()
and its inter.response.send_message
f my bad
even I'm not indulging, let sarthak poof his mind alone
What should I be logging in my discord bot? Like what's important
so what should i do ? before i make "slash command" the join messages worked ?
ur bot commands usage
probably how much its reconnecting to the gateway
✨ i dont even have a functional brain ✨
dpy does that for you now itself iirc
u and Oki have inbuilt interpreters👀
it does with the logging module but it never shows for me😔
Then how do I send the message {ctx.guild} …
😏 im rust i compile
i need youuuuuu😩
!d discord.Interaction.guild inter.guild
property guild```
The guild the interaction was sent from.
bro why do u want ctx and interaction at same time
I still dont understand how much you guys can shitpost
humans have infinite potential
So {inter.guild}?
yes
they are just trying to take ctx to 69k
I don't why but I'm feeling like I'm becoming too serious 😭
yea
why does log messages never appear in stdout if theyre on another file? 😳
near Almost just 1k more
update bro
is there another way to post on_member_join messages ?
i mean like discord.Interaction, i got Missing permissions. because discord.Interaction worked well
Btw for one of the messages u put interaction. And other stuff , can I change it back to inter since that’s my interaction
they keep sending updates in 2-3 hrs im not going to update all the time 
then do it
😡
calm down
lmaO
ok gn i gtg
night night
its not been even 2hrs
Gn 👋
How many ways to send messages in a specific channel ?
didn't u go to sleep half an hour ago👀
дарова
update or kali go boom
4-5
or 3 ✨ pure ✨ ones
русские есть?
woah, i know the bot.get_channel(id).send can you tell me another way ?
!rule 4 please
4. Use English to the best of your ability. Be polite if someone speaks English imperfectly.
😅 lol
ch = await Bot.fetch_channel(id)
ch.send()``` this is used incase you have cache disabled
```py
await Bot.http.send_message(channel_id, "message")
``` this is the method uses by all other methods to send the message
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👁️👁️
To ban someone, do I need to give the ban function the id of the person or the full username like alfons#7577?
i can pass embed in second method right ?
yes ofcourse
thanks
@slate swan
Okimii what's the time there BTW?
the 2nd and 3rd one are kinda same, the 1st one is route to the 3rd one itself
Anyone know?+
can you elaborate
I know, sir
fun fact: you can use all 3
2:12pm and i just wokeup
Oh ok nvm inter good
Bruh
whats the third? I mentioned 2
Why so late
the username only
i always wakeup at that hour😩
this Bot is should be discord.ext.commands.Bot or i can use discord.Client ?
both
And sleep?
wait wdym. Not all 3 only the username?
Nice!
i sleep at like 2 or 3am most times
