#discord-bots
1 messages · Page 18 of 1
!d discord.app_commands.AppCommand.options
A list of options.
takes list of Argument
class discord.app_commands.Argument```
Represents a application command argument.
New in version 2.0.
ah
guys how make edit last send message of the bot
look bot send "hi"
i want edit "hi"
!d discord.Message.edit
await edit(*, content=..., embed=..., embeds=..., attachments=..., suppress=False, delete_after=None, allowed_mentions=..., view=...)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Edits the message.
The content must be able to be transformed into a string via `str(content)`.
Changed in version 1.3: The `suppress` keyword-only parameter was added.
Changed in version 2.0: Edits are no longer in-place, the newly edited message is returned instead.
Changed in version 2.0: This function will now raise [`TypeError`](https://docs.python.org/3/library/exceptions.html#TypeError "(in Python v3.10)") instead of `InvalidArgument`.
if msg.user.id == my_id:
self.last_msg = msg```
o
what this do

cmon master can't you do some better psuedocode than that!
he doing his best
im lafy
E
so what this do
o it set msg to last message of bot
right???
right
that is very raw example
it is not even python code
it's not valid as-is
syntax error
it take id then check if id is the bot the send
Do you know basic python?
So any one make it no errors :(

i start python tommorw :)
yestarday*
!resources
The Resources page on our website contains a list of hand-selected learning resources that we regularly recommend to both beginners and experts.
too early for bot
Docs of python is trash
I don't think you should jump into bots after learning for one day
lol
this is what beginners say.
I just i even make a game
want try the game :)
dm :)
What?
No don't DM me
I make a game by the bot
by python
in 2 days
when someone here sent me this, as beginner I pressed Beginner on the left panel and then didn't know what to do
without know anything in python
me too
How
Beginner then Type
wym how has that never happened to you before
No, personally..
see, needs explanation lol
pretty self explanatory if you go on the site and look for more than 5 seconds
well, don't think that's possible
who ever does that
different files, hahaahaa
I don't know maybe people who want to learn
yeah that can be a case but the errors usually mention the files where the error comes from, too dumb for a user who doesn't read that
see this is why you should look at your traceback
oh wait i've got an idea: PEP8 No blank at the end of file
well probably it won't say 103
and probably it won't appear cus that's not an error
but who cares
2.0
@slate swan you like the bot :)
No
pip install git+https://github.com/Rapptz/discord.py
python -m pip install git+https://github.com/Rapptz/discord.py I usually do
if you want lol
yes but why should I do that :)
Nitro?
2.0 is still in beta
@silk fulcrum Don't do it bro he's gonna put you in timeout like me
he was mean to me
No y9
but he said hell give nitro
was keep spam
He was keep spam
NO
and error the bot
sorry bro that's not my fault
and i was neeed restart all the bot to fix it
dude you do !count 10000 and the bot was fight
what it should do
It will errord dummy
I don't know
o
whoa don't call me that word
what word?
does dummy word is bad?
sus
can you rate it without nitro
i want gift it to my gf
:(
I am a python new user, how can i user python to build discord-bot.
User is not a verb is the issue
!resources Learn python first
The Resources page on our website contains a list of hand-selected learning resources that we regularly recommend to both beginners and experts.
!resources
The Resources page on our website contains a list of hand-selected learning resources that we regularly recommend to both beginners and experts.
LOL 😭
i start in 1 day and i make very cool game
Resources won't help you to rickroll someone with base64
LOL
you would be using some Discord API wrapper ( or make ur own) like discord.py / hikari or forks
but before that make sure you have enough experience with python
done
well that's not what MEE6 does so it doesn't matter
Thank you, this is a active community.
I wanna make my own API wrapper but I'm too lazy to learn websockets
then dont make API wrapper
Yesterday I was experimenting in #bot-commands and here's my creation (this is the last offtopic message here by me for today I promise) py import base64;[print(chr(int(base64.urlsafe_b64decode(s+"="))>>69),end="") for s in 'NDYwNDMwNzMyMDc5NzkwNDA4MzM1MzY=NTk2MTk4NzY4NDYyMjkyNzA4MjI5MTI=Njk2NTQ5MDU2MjIzMjcyNjY5MDIwMTY=NTk2MTk4NzY4NDYyMjkyNzA4MjI5MTI=NjcyOTM3MjIzODA4OTI0NDQyOTUxNjg=MTg4ODk0NjU5MzE0Nzg1ODA4NTQ3ODQ=NjA4MDA0Njg0NjY5NDY2ODIxMjYzMzY=NjU1MjI4MzQ5NDk4MTYzMjczNDAwMzI=NjQ5MzI1MzkxMzk0NTc2MjE2ODgzMjA=NjQ5MzI1MzkxMzk0NTc2MjE2ODgzMjA=NTcyNTg2OTM2MDQ3OTQ0NDgyMTYwNjQ=MTg4ODk0NjU5MzE0Nzg1ODA4NTQ3ODQ=NjA4MDA0Njg0NjY5NDY2ODIxMjYzMzY=NjE5ODEwNjAwODc2NjQwOTM0Mjk3NjA=Njk2NTQ5MDU2MjIzMjcyNjY5MDIwMTY=NTk2MTk4NzY4NDYyMjkyNzA4MjI5MTI=MTg4ODk0NjU5MzE0Nzg1ODA4NTQ3ODQ=NzE0MjU3OTMwNTM0MDMzODM4NTcxNTI=NjU1MjI4MzQ5NDk4MTYzMjczNDAwMzI=NjkwNjQ2MDk4MTE5Njg1NjEyNTAzMDQ=MTg4ODk0NjU5MzE0Nzg1ODA4NTQ3ODQ=NjkwNjQ2MDk4MTE5Njg1NjEyNTAzMDQ=NjYxMTMxMzA3NjAxNzUwMzI5OTE3NDQ='.split("=") if len(s)>0]
😔I'll just wrap the wrapper instead
lmao okay
Why
I once tried to do it with java and I lost consciousness after 2 minutes
java is such a pain
at least I managed to make it connect to ws and send identity
It could even send heartbeat
I made a rest client but nothing more than that
try creating minecraft server on ubuntu 18.04, I promise you it will be a lot fun :lemao: 💀
which is probably the easiest part
Isn't it like 2 commands
Idk I once tried doing that and from what I remember it's not hard at all
Just my VPS with 1gb couldn't handle it lmao
My region is Russia and that's like hardest region to survive for a programmer rn
😳 😳 😳
are u seriously from russia?
Yes
me egypt
O
lol
O
!ot these memes are going too far
Off-topic channel: #ot2-never-nester’s-nightmare
Please read our off-topic etiquette before participating in conversations.
Yeah
As a new python user, where should i learn python?
do i will get ban?
What I meant was we're just disconnected from most of services cause they just decline our cards
I would personally recommend Stepik
They have quite many courses especially about python
oh yeah that site, i remember how I was solving every task there in 0.27ms
I don't know Stepik, would you get me a link please?
https://stepik.org iirc
thanks
e
code? or full traceback?
you used ['something'] on a list
what's example ( i mean the data type of example )? and what are you trying to archive?
dict*
Oh wait now I see
it should be {ranking['data'][0]['currenttierpatched']}
since ranking['data'] is a list
you are using the dict as a 2 dimensional dict, something like this:
my_dict = {'data': ['currenttierpatched': "platinum 1"],}
haven't noticed those little []
it's the first index of the list
you have a dict which stores a list which stores another dict
absolutely
if you want to iterate through that list it will be something like:
for elements in ranking['data']: #yourstuff
well it's a dict so elements is fine

homie :uwu:
So I want to do a system that would automatically create issues on github if the bot faces an exception and now I want to make the exceptions that are caught in on_error uniquely identifiable
i think I help here a lot is cus this is the only place I talk to people this summer
I mean they aren't really getting caught
what if you make custom exception? 
But I can use sys.exc_info() and get the data I need
Nah it needs to work for every exception
I was thinking about something like
btw you can even use something like this id(object) and it will return an unique ID of that object
!e py import sys try: raise KeyError() except Exception as e: t, v, tb = sys.exc_info() print(f"{hash(t)}-{hash(v)}")
@vale wing :white_check_mark: Your 3.11 eval job has completed with return code 0.
8776030874708-8776030293518
that's fair too ig
The id changes between script runs afaik
Hash would be better ig
As it should be the same ig?
i don't really now, i will try it on my powershell
Mhh nope i have a different result
!e py import sys for i in range(30): try: raise KeyError() except Exception as e: t, v, tb = sys.exc_info() print(f"{hash(t)}-{hash(v)}")
@vale wing :white_check_mark: Your 3.11 eval job has completed with return code 0.
001 | 8744021622356-8744021041678
002 | 8744021622356-8744021041684
003 | 8744021622356-8744021041678
004 | 8744021622356-8744021041684
005 | 8744021622356-8744021041678
006 | 8744021622356-8744021041684
007 | 8744021622356-8744021041678
008 | 8744021622356-8744021041684
009 | 8744021622356-8744021041678
010 | 8744021622356-8744021041684
011 | 8744021622356-8744021041678
... (truncated - too many lines)
Full output: https://paste.pythondiscord.com/asezejivik.txt?noredirect
Ok it doesn't get preserved between the runs
it change for every exception
Ah even for every exception
Yeah notice how it's like half ending with 78 and other 84 wtf
Ok I got another idea
This function returns a tuple of three values that give information about the exception that is currently being handled. The information returned is specific both to the current thread and to the current stack frame. If the current stack frame is not handling an exception, the information is taken from the calling stack frame, or its caller, and so on until a stack frame is found that is handling an exception. Here, “handling an exception” is defined as “executing an except clause.” For any stack frame, only information about the exception being currently handled is accessible.
!e py import sys for i in range(30): try: raise KeyError() except Exception as e: t, v, tb = sys.exc_info() print(hash(t.__name__))
@vale wing :white_check_mark: Your 3.11 eval job has completed with return code 0.
001 | -8528757346533736868
002 | -8528757346533736868
003 | -8528757346533736868
004 | -8528757346533736868
005 | -8528757346533736868
006 | -8528757346533736868
007 | -8528757346533736868
008 | -8528757346533736868
009 | -8528757346533736868
010 | -8528757346533736868
011 | -8528757346533736868
... (truncated - too many lines)
Full output: https://paste.pythondiscord.com/woxuhasuqo.txt?noredirect
String hashes should always be the same right?
But just identifying the exceptions by class name hash isn't useful
I think that it is the current thread, so it is something related to the actual execution ig
or maybe the actual except block
Ok I got another beautiful idea I will just use inspect to get all exception classes then sort them by name and give each a number
wtf did I smoke
@placid skiff :white_check_mark: Your 3.11 eval job has completed with return code 0.
139668861134144
!e py import inspect import sys exceptions = inspect.getmembers(__builtins__, lambda x: inspect.isclass(x) and issubclass(x, BaseException)) exceptions.sort(key=lambda x: x[0]) ordered_exceptions = {e[0]: i for i, e in enumerate(exceptions)} print(ordered_exceptions)
@vale wing :white_check_mark: Your 3.11 eval job has completed with return code 0.
{'ArithmeticError': 0, 'AssertionError': 1, 'AttributeError': 2, 'BaseException': 3, 'BaseExceptionGroup': 4, 'BlockingIOError': 5, 'BrokenPipeError': 6, 'BufferError': 7, 'BytesWarning': 8, 'ChildProcessError': 9, 'ConnectionAbortedError': 10, 'ConnectionError': 11, 'ConnectionRefusedError': 12, 'ConnectionResetError': 13, 'DeprecationWarning': 14, 'EOFError': 15, 'EncodingWarning': 16, 'EnvironmentError': 17, 'Exception': 18, 'ExceptionGroup': 19, 'FileExistsError': 20, 'FileNotFoundError': 21, 'FloatingPointError': 22, 'FutureWarning': 23, 'GeneratorExit': 24, 'IOError': 25, 'ImportError': 26, 'ImportWarning': 27, 'IndentationError': 28, 'IndexError': 29, 'InterruptedError': 30, 'IsADirectoryError': 31, 'KeyError': 32, 'KeyboardInterrupt': 33, 'LookupError': 34, 'MemoryError': 35, 'ModuleNotFoundError': 36, 'NameError': 37, 'NotADirectoryError': 38, 'NotImplementedError': 39, 'OSError': 40, 'OverflowError': 41, 'PendingDeprecationWarning': 42, 'PermissionError': 43, 'ProcessLookupEr
... (truncated - too long)
Full output: https://paste.pythondiscord.com/idequzapal.txt?noredirect
ok
Ok ig I gotta understand the IDs too
Actually maybe they will work
Actually custom error are just subclasses
so before doing all of that you just check if the class has a subclass and if it is give and id to that too
id(object)```
Return the “identity” of an object. This is an integer which is guaranteed to be unique and constant for this object during its lifetime. Two objects with non-overlapping lifetimes may have the same [`id()`](https://docs.python.org/3/library/functions.html#id "id") value.
**CPython implementation detail:** This is the address of the object in memory.
Raises an [auditing event](https://docs.python.org/3/library/sys.html#auditing) `builtins.id` with argument `id`.
it is, watch
!e
class Uwu():
def __init__(self):
pass
my_uwu = Uwu()
print(id(my_uwu), id(Uwu))
@placid skiff :white_check_mark: Your 3.11 eval job has completed with return code 0.
140545396765776 94187746169984
however object ids change in different runs
the objects, not the class, it will change only on different machines
!e
for i in range(5):
print(id(KeyError))
!e
for i in range(5):
print(id(KeyError))
Now we have flooded the channel with ids lmao
Uhm nope it changes on different runs
that's strange, with the shell it doesn't
even if I rerun it
So it's memory based
it's probably linked to memory addresses and more
!e
import hashlib
x = hashlib.sha256(KeyError.__name__.encode('utf-8')).hexdigest()
print(x)
@glad cradle :white_check_mark: Your 3.11 eval job has completed with return code 0.
f0f0edf867a4213fae7f94050498c643a345fdb204e65919cc0c35116e5916e5
!e
import hashlib
x = hashlib.sha256(KeyError.__name__.encode('utf-8')).hexdigest()
print(x)
@glad cradle :white_check_mark: Your 3.11 eval job has completed with return code 0.
f0f0edf867a4213fae7f94050498c643a345fdb204e65919cc0c35116e5916e5
Base64 could also work and yk what I will just do that

I’m guessing there’s no good way to format or colour text on the mobile app?
Anyone knows about send respond to only specific text channel?
i google a lot and tried this code but this seems not working.
await channel.send('hello')```
Is there a way to fix this?
@client.command()
async def ascii(ctx, *, text: str):
await ctx.send(pyfiglet.figlet_format(text))
if message.channel.name == ‘channel name’: await message.channel.send(response)
.
i tried specify channel by id, how about this code?
id is int
no quotes
Send your code
!code
Here's how to format Python code on Discord:
```py
print('Hello world!')
```
These are backticks, not quotes. Check this out if you can't find the backtick key.
ctx.channel.id and no quotes, it needs to be an int
and time.sleep blocks your bot for a minute making you disconnect
ok i will try it
what's the difference between that and time.sleep?
is the mobile app unable to use ansi or css?
time.sleep will block the bot from running other commands and tasks
none of them
That’s a shame
Can you help me fix this?
fix what
Is there anyway to show one thing on noble and another on desktop?
discord is a stable platform 
this
nvm I fixed it myself
This is simply just a EC2 server controller.
translated to slash command from normal "!" trigger
from discord.ext import commands
import asyncio
import os
import time
import boto3
# required py-cord extension by pip3 install py-cord
client = commands.Bot(command_prefix="!")
ec2 = boto3.resource("ec2", region_name="ap-northeast-1")
instance = ec2.Instance("i-0441ff1241243123")
@client.event
async def on_ready():
print("Logged in as")
print("client.user.name")
print("----------------")
await client.change_presence(activity=discord.Activity(type=discord.ActivityType.watching, name="Server"))
@client.slash_command(description="Server start")
async def start(ctx):
if message.channel.id == 100461054634937:
if InstanceStart():
await ctx.respond(f"{ctx.user.mention} Please wait, Server is about to start...")
time.sleep(60)
await ctx.respond(f"{ctx.user.mention} Server has been started successfully!")
else:
await ctx.respond(f"{ctx.user.mention} An error occurred. Please contact administrator.")
def InstanceStart():
try:
instance.start()
return True
except:
return False```
you forgot to add py
!code
Here's how to format Python code on Discord:
```py
print('Hello world!')
```
These are backticks, not quotes. Check this out if you can't find the backtick key.
And tell me what you want to do.
oops, sorry
import discord
from discord.ext import commands
import asyncio
import os
import time
import boto3
# required py-cord extension by pip3 install py-cord
client = commands.Bot(command_prefix="!")
ec2 = boto3.resource("ec2", region_name="ap-northeast-1")
instance = ec2.Instance("i-0441ff1241243123")
@client.event
async def on_ready():
print("Logged in as")
print("client.user.name")
print("----------------")
await client.change_presence(activity=discord.Activity(type=discord.ActivityType.watching, name="Server"))
@client.slash_command(description="Server start")
async def start(ctx):
if message.channel.id == 100461054634937:
if InstanceStart():
await ctx.respond(f"{ctx.user.mention} Please wait, Server is about to start...")
time.sleep(60)
await ctx.respond(f"{ctx.user.mention} Server has been started successfully!")
else:
await ctx.respond(f"{ctx.user.mention} An error occurred. Please contact administrator.")
def InstanceStart():
try:
instance.start()
return True
except:
return False
i wanna respond the text only in "10046105463493755" channel
with slash command enabled
You want to send the bot's message in a specified channel?
channel = client.get_channel(10046105463493755)
await channel.send(response)
try this
ok i will try this now
its ok
@client.command()
async def start(ctx):
if ctx.channel.id != 10046105463493755:
return
#code here
!=
wow this just works very smoothly!
Thank you so much!! @crystal glen and @vocal snow
You're welcome ❤️
How do I delete the member's message that ran the command
For example I do ?ping
And then it deletes my message and send the ping?
await ctx.message.delete
await ctx.message.delete()
Thanks ❤️
# image to ascii
@client.command()
async def ascii_image(ctx, *, image_url: str):
# delete the author's message
await ctx.message.delete()
# get the image
async with aiohttp.ClientSession() as session:
async with session.get(image_url) as resp:
image = await resp.read()
# convert the image to ascii
ascii_image = pyfiglet.figlet_format_ascii(image)
# send the ascii image
await ctx.send(f"{ascii_image}")
Will this work? 🥲
try it and see
What link should I put
What I meant is, Will every link work
btw, This is generated by Github Co-Pilot lol
!pypi pyfiglet
because it does?
Wdym 😢
What do I do now?
idk
lol there's a chance that most of the part of it wont work
hello again. is there a way where if someone sends a message in one channel itll add it to another channel with the users id, or does it have to be via the bot?
Problem with jishaku or libraries incompatibilities
That session is only a warning, not the main issue ig
prbbly
Why...
webhooks?
yeah, isaac's said before they use pycord so jishaku's likely incompatible with that
Oh heck no
i dont really get what you want
@client.command()
async def play(ctx, *, url: str):
try:
url = ctx.message.content.split()[1]
voice_client = await ctx.message.author.voice.channel.connect()
voice_clients[ctx.message.author.id] = voice_client
loop = asyncio.get_event_loop()
data = await loop.run_in_executor(None, lambda: yt_dl.download([url]))
song = data["url"]
player = discord.FFmpegPCMAudio(song, **ffmpeg_options)
voice_client.play(player)
except Exception as e:
print(e)
await ctx.send("Error: {}".format(e))
Please someone get this working for me pleaseeeeeeeeeeee
Master @silk fulcrum
me
This master
noone helps with ytdl
ctx.message.created_at, not ctx.created_at
Ohh fuck
ez token
Ig they can just fork jishaku and edit the source code then if pycord can be replaced with discord.py
I reset it lmao
never looked into webhooks, will have a gander thanks
shku
they removed the a from jishaku
jishkuwu
ye
.
Please help ☝️
Tell me how to make a music bot
What unique features does jishaku have anyway
user.message.created_at?
well there are many but people just keep it limited to an eval command
Lmao
other things include playing music/sound from an URI etc
Just make eval by yourself
!ytdl
Per Python Discord's Rule 5, we are unable to assist with questions related to youtube-dl, pytube, or other YouTube video downloaders, as their usage violates YouTube's Terms of Service.
For reference, this usage is covered by the following clauses in YouTube's TOS, as of 2021-03-17:
The following restrictions apply to your use of the Service. You are not allowed to:
1. access, reproduce, download, distribute, transmit, broadcast, display, sell, license, alter, modify or otherwise use any part of the Service or any Content except: (a) as specifically permitted by the Service; (b) with prior written permission from YouTube and, if applicable, the respective rights holders; or (c) as permitted by applicable law;
3. access the Service using any automated means (such as robots, botnets or scrapers) except: (a) in the case of public search engines, in accordance with YouTube’s robots.txt file; (b) with YouTube’s prior written permission; or (c) as permitted by applicable law;
9. use the Service to view or listen to Content other than for personal, non-commercial use (for example, you may not publicly screen videos or stream music from the Service)
moment
If it's official spotify API (idk if they have one) then it's ok ig
And if it is some sort of scraper which breaks ToS no
spotify does have an API but they don't hand over audio
I WANNA MAKE A MUSIC BOT, HOW DO I DO IT
First do the sound making system itself and then integrate it into a bot
?fart, The bot should join the voice and play a fart sound
The first part isn't related to this channel's topic
Well idk how to do this
What library should I use?
Sound generation hm
Read some articles about sound generation first, it's not that easy ig
if you have a fart sound file saved locally, you can play that
do you even load the cog
i mean you could just download certain files
# play a sound from a file
@client.command()
async def play(ctx, *, url: str):
if not ctx.voice_client:
await ctx.author.voice.channel.connect()
await ctx.send(f"Now playing {url}")
source = discord.FFmpegPCMAudio(url)
ctx.voice_client.play(source)
ctx.voice_client.source = source
I bored . Can anyone give me idea why type of bot should i make || i cant make rpg or game bot ||
you can use soundcloud api as long as you just load the songs in cache
Do you want to make my 3am idea
It's very sussy
Will this work?
if url points to a valid audio file sure
If the url is streamable I think
What should be the url?
Straight link to the file
Any suggestions?
there isn't any need to manually set the source attr
Ok
Nerd bot
Can I make that or is there any available
a bot that creates graphs of a user's chatting activity against date 😳
It would argue with every statement and say "um, actually" at the beginning
How would it do for all users?
up 😂
not all users, but the ones your bot can see
Hmm i need DB ig?
For example if you say "sky is blue" it will reply with "um, actually, sky isn't blue 🤓"
yes
And i need to use datetime module
!pypi pendulum is better imo
Ok
jishaku is a cog...
you won't necessarily need that if your db has datetime functions
Bot how would my bot know 24 hours have passed?
Someone send me a link to useeeeeeee
🗿 because you need to `bot.load_extension('jishaku')
also make sure that you uninstall discord.py and its jishaku
why would it need to know that
So that it could calculate messages sent in 1 day
Ok time to create nerd bot ig 🤓
if you're storing the timestamps of the messages sent then that can be calculated easily, with only sql
Didn't I explain the concept
but the implementation is up to you
Hmmm i confused how you want me to make
yes and did you uninstall discord.py and jishaku?
Alright cya
yes because jishaku has the same namespace as jishkucord
and pycord and discord.py both use discord namespace
remove it from your requirements.txt
😭 date
@client.command()
async def play(ctx, *, filename: str):
await ctx.send(f"Playing {filename}")
voice = get(client.voice_clients, guild=ctx.guild)
if voice and voice.is_playing():
voice.stop()
voice = await ctx.author.voice.channel.connect()
source = discord.FFmpegPCMAudio(filename)
voice.play(source)
await ctx.send(f"Now playing {filename}")
await ctx.send(f"Disconnecting...")
await voice.disconnect()
await ctx.send(f"Disconnected")
get is not defined
How do I fix this?
Then define it
🤮
Even better, use guild.voice_client directly
@client.command()
async def play(ctx, *, filename: str):
await ctx.send(f"Playing {filename}")
voice = ctx.guild.voice_client
if voice and voice.is_playing():
voice.stop()
voice = await ctx.author.voice.channel.connect()
source = discord.FFmpegPCMAudio(filename)
voice.play(source)
well the panel will do it for you ( unless they have some weird configs )
and just mention the libraries you use there
So like this?
you can even ctx.voice_client to make it shorter
ctx.voice_client or ctx.voice_client()
add the name of the libraries you use there
without ()
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: ClientException: ffmpeg was not found.
wtf do u mean ffmpeg was not founddddddddddd
py-cord
all the other libraries you use
for example if i use aiohttp and sketch-py for a project this would be my requirements.txt ```
aiohttp
sketch-py
I swear I downloaded it...
its not added to path then
@client.command()
async def slaw(ctx):
voice = ctx.voice_client
voice = await ctx.author.voice.channel.connect()
voice.play(discord.FFmpegPCMAudio(executable="C:/ffmpeg/ffmpeg.exe", source="D:\Desktop\Haryad Bot\s.mp3"))
Will this work?
Well it doesn't
But how do I make it to work
How do I fix this again? Make a real directory?
why use requests and aiohttp lol
also those discord imports are mostly redundant
i wanna bleach my eyes after those imports
.
ofcourse it needs to be a real path
where you have you ffmpeg.exe
@client.command()
async def slaw(ctx):
voice = ctx.voice_client
voice = await ctx.author.voice.channel.connect()
voice.play(discord.FFmpegPCMAudio(executable="C:/ffmpeg/ffmpeg.exe", source="D:\Desktop\Haryad Bot\s.mp3"))
It connects but doesn't play the soundddddddddd
nvm it works now...
Ah yes
lmao
Now how do I make it leave after it finished talking?
Thanks nerd bot
@vale wing
In 1.7 it's avatar_url
how do i fix?
tf that means
discord_slash isn't needed anymore
Fork like disnake or nextcord
every relevant python library supports slash commands now
this is wut i downloaded how would i have the fixed version of this code?
from discord_components import *
from discord.ext import commands
from discord_slash.context import ComponentContext
from discord_slash import SlashContext, SlashCommand
from discord_slash.model import ButtonStyle
from discord_slash.utils.manage_components import create_button, create_actionrow, create_select, create_select_option, wait_for_component
url=.....
discord_components isn't needed anymore either
You mean you copypasted this or smth
yes
i just dowloaded this file but i was getting errors
I don't help people who copypaste the code without even knowing how to code
bruh
https://gist.github.com/Ash-02014/b6f57065f394b54f43666037ade38d32 < guide on building slash in discord.py
@vale wing
What is kwarg?
set_thumbnail(*, url)```
Sets the thumbnail for the embed content.
This function returns the class instance to allow for fluent-style chaining.
Changed in version 1.4: Passing `None` removes the thumbnail.
you need to set the kwarg
Keyword argument
bro help me bro please
func(positional_argument, key_word_argument=10)
read the gist I posted
@client.command()
async def play(ctx, filename: str):
voice = ctx.voice_client
voice = await ctx.author.voice.channel.connect()
voice.play(discord.FFmpegPCMAudio(executable="C:/ffmpeg/ffmpeg.exe", source=f"D:/Desktop/Haryad Bot/sounds/{filename}.mp3"))
How it disconnects from the channel after it's finished?
await voice.disconnect() iirc?
use avatar_url
It instantly disconnects, Doesn't play the sound
Man I can just give you the correct version but you need to understand that
Where?
Play has after kwarg afaik
You can parse the function to there
I forgot if it can be a coro or not
Can u just spoonfeed me?
.
Nah I am not a spoonfeeder
Im hard at understanding things
you're using avatar.url currently
replace it
Please...
!d discord.VoiceClient.play
play(source, *, after=None)```
Plays an [`AudioSource`](https://discordpy.readthedocs.io/en/latest/api.html#discord.AudioSource "discord.AudioSource").
The finalizer, `after` is called after the source has been exhausted or an error occurred.
If an error happens while the audio player is running, the exception is caught and the audio player is then stopped. If no after callback is passed, any caught exception will be logged using the library logger.
Changed in version 2.0: Instead of writing to `sys.stderr`, the library’s logger is used.
Are docs a joke for you
voice.play(discord.FFmpegPCMAudio(executable="C:/ffmpeg/ffmpeg.exe", source=f"D:/Desktop/Haryad Bot/sounds/{filename}.mp3"), after=await voice.disconnect())
So this?
read what I told you and then read what you wrote
await voice.disconnect() actually executes, you need to parse voice.disconnect and see if it can execute coros
replace avatar.url with avatar_url
you: user.avatar.url
??
Also you could make a loop that would check if the vc is playing currently and disconnect if it's not
Because I am unsure if you can parse a coro to after
Ok you can't
Please help me 😢
!d discord.VoiceClient.is_playing then use a loop that would check for this
is_playing()```
Indicates if we’re currently playing audio.
And by loop I mean @tasks.loop
Bruh this is so complicated for me
!d discord.ext.tasks.loop examples are on top
discord.ext.tasks.loop(*, seconds=..., minutes=..., hours=..., time=..., count=None, reconnect=True)```
A decorator that schedules a task in the background for you with optional reconnect logic. The decorator returns a [`Loop`](https://discordpy.readthedocs.io/en/latest/ext/tasks/index.html#discord.ext.tasks.Loop "discord.ext.tasks.Loop").
Both for cogs and non cogs just find the suitable for you
Why do I need to do all this just to disconnect after playing the sound?
Because you can't parse a coroutine
The problem is you can't parse a coroutine to there
guys who can test my bot in 3 mins??
You can run it with run_coroutine_threadsafe tho
voice.play(discord.FFmpegPCMAudio(executable="C:/ffmpeg/ffmpeg.exe", source=f"D:/Desktop/Haryad Bot/sounds/{filename}.mp3"), after=await voice.disconnect())
Ig that's the method
You can schedule a coro there with asyncio.create_task
You still need to await it
No
Tasks need to be awaited aren't they
what are you guys talking about, Again?
Some async stuff don't mind
Only if you need the result
Ok one sec
But for disconnecting a "fire and forget" would be fine
aw :(
Last time I used it the task just executed everything not awaitable and stopped
@client.command()
async def play(ctx, filename: str):
voice = ctx.voice_client
voice = await ctx.author.voice.channel.connect()
voice.play(discord.FFmpegPCMAudio(executable="C:/ffmpeg/ffmpeg.exe", source=f"D:/Desktop/Haryad Bot/sounds/{filename}.mp3"), after=await voice.disconnect())
I just need to disconnect after it finishes talking
can som1 help me with nextcord
Exactly what I said
spoonfeed meeeeeeeeeeeeee
Might have missed that, sorry!
just ask
You could just create a second account, log in to discord via the web and test it that way.
i wrote down a simple code using nextcord it also has a ping command embed , so now idk why its not working it doesen't shoows any type of error it just da command doesen't works
send code
See
@client.command()
async def play(ctx, filename: str):
voice = ctx.voice_client
voice = await ctx.author.voice.channel.connect()
voice.play(discord.FFmpegPCMAudio(executable="C:/ffmpeg/ffmpeg.exe", source=f"D:/Desktop/Haryad Bot/sounds/{filename}.mp3"))
while voice.is_playing():
await asyncio.sleep(1)
await voice.disconnect()
CO-PILOT DID ITTTTTTTTTT
Non awaited tasks don't execute awaitable statements inside
What
isn't while blocking?
It literally did it for me
Thank you github co-pilot
ilysm
You could not await it and pass control to the event loop and it would be fine
The what
I forgot the loop or smth
Ah yes sorry
!e ```py
import asyncio
async def stuff():
await asyncio.sleep(1)
print("Stuff")
async def main():
asyncio.run_coroutine_threadsafe(stuff(), asyncio.get_event_loop())
asyncio.run(main())```
@vale wing :warning: Your 3.11 eval job has completed with return code 0.
[No output]
Ok weird
!e ```py
import asyncio
async def f():
print(2)
async def t():
print(1)
await f()
async def main():
asyncio.create_task(t())
asyncio.run(main())
@vocal snow :white_check_mark: Your 3.11 eval job has completed with return code 0.
001 | 1
002 | 2
Ah yes I am not waiting in the main that's the issue
I'm on mobile apologies for the 2 space indents
And I was fricking sure that tasks need to be awaited because of me using sleep
Sorry man
o
!e
code
!eval [python_version] <code, ...>
Can also use: e
*Run Python code and get the results.
This command supports multiple lines of code, including code wrapped inside a formatted code block. Code can be re-evaluated by editing the original message within 10 seconds and clicking the reaction that subsequently appears.
If multiple codeblocks are in a message, all of them will be joined and evaluated, ignoring the text outside of them.
By default your code is run on Python's 3.11 beta release, to assist with testing. If you run into issues related to this Python version, you can request the bot to use Python 3.10 by specifying the python_version arg and setting it to 3.10.
We've done our best to make this sandboxed, but do let us know if you manage to find an issue with it!*
!eval 3
import nextcord
from nextcord.ext import commands
from flask import Flask
from threading import Thread
bot = commands.Bot(commands_prefix = "r!")
bot.remove_command('help')
@bot.event
async def on_ready():
print("""
____ _____ __
| _ \ / _ \ \/ /
| |_) | | | \ /
| _ <| |_| / \
|_| \_\\___/_/\_\
""")
@bot.command()
async def ping(ctx):
embed = nextcord.embed(name ="Pong!", description = f"``{round(bot.latency * 1000)}``Ms")
await ctx.send(embed = embed)
bot.run(sex.token)
@stiff flicker :x: Your 3.10 eval job has completed with return code 1.
001 | Traceback (most recent call last):
002 | File "<string>", line 1, in <module>
003 | ModuleNotFoundError: No module named 'nextcord'
This?
Please help
Send the full code so i can end this suffering
You would need to send your full code.
And not as a screenshot preferably
@client.command()
async def whois(ctx, user: discord.Member=None):
r = random.randrange(0, 255)
g = random.randrange(0, 255)
b = random.randrange(0, 255)
embed = discord.Embed(color = discord.Colour.from_rgb(r, g, b,), timestamp = ctx.message.created_at)
embed.set_author(name = f"User Info - {user}")
embed.set_thumbnail(url=user.avatar_url),
embed.set_footer(text=f"Requested by - {ctx.author}", url_icon=ctx.author.avatar.url),
embed.add_field(name="ID",value=user.id,inline=False),
embed.add_field(name="Name",value=user.display_name)
embed.add_field(name="Created at",value=user.created_at,inline=False)
embed.addfield(name="Joined at",value=user.joined_at,inline=False)
embed.add_field(name="Bot?",value=user.bot,inline=False)
ctx.send(embed=embed)
@client.command()
async def list(ctx):
await ctx.message.delete()
for file in os.listdir(f"D:/Desktop/Haryad Bot/sounds"):
if file.endswith(".mp3"):
await ctx.send(f"{file}")
How to send them all at once and not seperate?
As a list
Someone?
I dont believe Discord allows that, but lists each file individually. I could be wrong though, but when I have attached multiple attachments to 1 message and they always get listed.
Python should be able to do it tho

Python doesn't manage Discord.
Someone will help you in their time, patience.
this is what I meant...
@client.command()
async def list(ctx):
await ctx.message.delete()
list = []
for file in os.listdir(f"D:/Desktop/Haryad Bot/sounds"):
list.append(file)
await ctx.send(f"{list}")
You might want to do
await ctx.send(file=file)
instead of f string
list.append([file:-4])
How do I do this properly?
@client.command()
async def list(ctx):
await ctx.message.delete()
list = []
for file in os.listdir(f"D:/Desktop/Haryad Bot/sounds"):
list.append([file:-4])
await ctx.send(f"{list}")```
Can someone help me test something rq so I can see if my discord bot is working properly?
dm me
Sure
class HelpView(discord.ui.View):
def __init__(self, user):
super().__init__(timeout=120)
self.user = user
self.action = None
self.add_item(HelpSelect(self))
async def interaction_check(self, interaction) -> bool:
return interaction.user.id == self.user.id
@discord.ui.button(
emoji=":doubleLeft:",
custom_id="first-page",
row=1,
style=discord.ButtonStyle.blurple,
)
async def double_left(self, button, interaction):
self.action = "first-page"
self.stop()
@discord.ui.button(
emoji=":Left:",
custom_id="page-1",
row=1,
style=discord.ButtonStyle.blurple,
)
async def left(self, button, interaction):
self.action = "page-1"
self.stop()
@discord.ui.button(
emoji=":Lock:",
custom_id="stop",
row=1,
style=discord.ButtonStyle.blurple
)
async def _stop(self, button, interaction):
self.action = "stop"
self.stop()
@discord.ui.button(
emoji=":Right:",
custom_id="page+1",
row=1,
style=discord.ButtonStyle.blurple,
)
async def right(self, button, interaction):
self.action = "page+1"
self.stop()
@discord.ui.button(
emoji=":doubleRight:",
custom_id="last-page",
row=1,
style=discord.ButtonStyle.blurple,
)
async def double_right(self, button, interaction):
self.action = "last-page"
self.stop()
is this correct ?
the reactions are not being added to the embed
ping
Why
Lmao
Reactions? You mean buttons?
i haave a question if client = commands.Bot
How are you sending the view
then can we not make the bot reply to a normal message like
if user_message.lower() == 'hi":
await message.channel.send(f'hello')
can we?
helps = {
"1": embed_1,
"2": embed_2,
"3": embed_3,
"4": embed_4,
"5": embed_5,
"6": embed_6,
"7": embed_7,
"home": embed_1,
"fun": embed_2,
"image": embed_3,
"moderation": embed_4,
"information": embed_5,
"economy": embed_6,
"setup": embed_7,
}
if command_name is None:
cur_page = 1
view = HelpView(ctx.author)
view.children[0].disabled = True
view.children[1].disabled = True
message = await ctx.send(embed=helps["1"], view=view)
while True:
wait = await view.wait()
if wait is True:
for child in view.children:
child.disabled = True
view.timeout = 1
await message.edit(view=view)
return
action = view.action
new_view = HelpView(ctx.author)
if action == "stop":
for child in view.children:
child.disabled = True
view.timeout = 1
await message.edit(view=view)
return
You could send it as an embed
or do some kind of str manipulation
does"\n" .join(list) work?
whats view.action i dont remember there being such a var?
no '\n'.join()
we can
oh like that
sry 
Because you dont har any commands?
try !help, its a default command
oh you deactivated it
Give more context... Is this a pypi thing?
yes, it is
its their nature
- Did you install the jsk using pip?
- Did you load the extension to your code?
One of my 3 am ideas implemented
Nerdbot
class Month(ui.Select):
def __init__(self, ctx):
self.ctx = ctx
...
async def callback(self, interaction):
await interaction.response.defer()
if not interaction.author == self.ctx.author:
return await self.ctx.send(f"**{interaction.author}, nem te.**")
@commands.cooldown(1, 360, commands.BucketType.user)
@commands.command(aliases=["birthday"])
async def birth(self, ctx):
...
await ctx.send("**A hónap amiben születtél...**", view=View(Month(ctx)))
``` why is the if statement in the callback ignored
my bot doesn't work >:c
@client.command()
async def list(ctx):
files = []
await ctx.message.delete()
for file in os.listdir(f"D:/Desktop/Haryad Bot/sounds"):
if file.endswith(".mp3"):
files.append(file)
files_list = '\n'.join(files)
await ctx.send(f"{files_list}")
@crystal glen
< 50 lines of code
No wonder why it's so dumb
I gotta write 5000 so it's a true nerd
in one file
I wasn't talking about your code sorry lol
Ok so have you tried !jsk py <arguement here>, so for example !jsk py 1+1 for instance https://pypi.org/project/jishaku/
Damn the bot got smarter suddenly
class HelpView(discord.ui.View):
def __init__(self, user):
super().__init__(timeout=120)
self.user = user
self.action = None
self.add_item(HelpSelect(self))
async def interaction_check(self, interaction) -> bool:
return interaction.user.id == self.user.id
@discord.ui.button(
emoji=":doubleLeft:",
custom_id="first-page",
row=1,
style=discord.ButtonStyle.blurple,
)
async def double_left(self, button, interaction):
self.action = "first-page"
self.stop()
@discord.ui.button(
emoji=":Left:",
custom_id="page-1",
row=1,
style=discord.ButtonStyle.blurple,
)
async def left(self, button, interaction):
self.action = "page-1"
self.stop()
@discord.ui.button(
emoji=":Lock:",
custom_id="stop",
row=1,
style=discord.ButtonStyle.blurple
)
async def _stop(self, button, interaction):
self.action = "stop"
self.stop()
@discord.ui.button(
emoji=":Right:",
custom_id="page+1",
row=1,
style=discord.ButtonStyle.blurple,
)
async def right(self, button, interaction):
self.action = "page+1"
self.stop()
@discord.ui.button(
emoji=":doubleRight:",
custom_id="last-page",
row=1,
style=discord.ButtonStyle.blurple,
)
async def double_right(self, button, interaction):
self.action = "last-page"
self.stop()
is this correct ?
the buttons are not being added to the embed
cud someone help me
@slate swan what functionality do you need from jishaku
Well thats me out, sorry, I don't use pypi, nor have I used jishaku, I don't want to just keep randomly guessing at what you need to do and currently working so cant fire up my test box to do some testing to help you.
@slate swan
Any sample code for timeout users ??
first of all why do you gotta redefine bot
Pseudocode or actual code
actual one
oh that may be the problem(?
and wheres the line that makes it run with the token
and have you actually registered the jishaku extension?
bot.load_extension("jishaku") after creating ur bot object
why is interaction.author always the same as self.ctx.author
because that object is created on every interaction iirc
which one
Month? UI objects?
self.ctx doesn't change
oh Month
no
callback is called on every interaction
self.ctx doesn't change, neither does the Month object
but somehow the if statement is never True
probably just store the initial author ID in another variable
its all in disnake...and what is the convertor ? i cant install it..
!paste
Pasting large amounts of code
If your code is too long to fit in a codeblock in Discord, you can paste your code here:
https://paste.pythondiscord.com/
After pasting your code, save it by clicking the floppy disk icon in the top right, or by typing ctrl + S. After doing that, the URL should change. Copy the URL and post it here so others can see it.
https://paste.pythondiscord.com/piyusekaxi
Idk how much the chances are of people just copying it
It's all defined in code
the if statements in the callbacks of Month and Day are both ignored
Copypasters protection haha
at the start
[2022-08-04 15:45:45] [ERROR ] discord.ui.view: Ignoring exception in view <View timeout=180.0 children=2> for item <Button style=<ButtonStyle.success: 3> url=None disabled=False label='Yeah' emoji=<PartialEmoji animated=False name='p_thumbsup' id=1003403273966977114> row=None>
Traceback (most recent call last):
File "C:\Users\***\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\discord\ui\view.py", line 423, in _scheduled_task
await item.callback(interaction)
File "C:\Users\***\PycharmProjects\syno\main.py", line 74, in yesButton_callback
await interaction.response.send_message(
File "C:\Users\***\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\discord\interactions.py", line 724, in send_message
self._parent._state.store_view(view, entity_id)
File "C:\Users\***\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\discord\state.py", line 371, in store_view
self._view_store.add_view(view, message_id)
File "C:\Users\***\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\discord\ui\view.py", line 546, in add_view
view._start_listening_from_store(self)
AttributeError: 'NoneType' object has no attribute '_start_listening_from_store'
lmao its just so hard to read 😭
dont u have a easy to read and use code ?
Nah my code is pretty good
could someone help me fix this error
I mean if you open it in IDE you have more chances of understanding
not all pieces of code are compatible with every project :P
Just reading it on github won't really help
That too ofc
But he asked for sample code, I gave him sample code lol
It's just probably not really sample
that piece of code may rely on a specific project's utility functions, classes, helpers, etc
Imma make this b work someday somehow
anyone?
Could you show your code
Of that button callback
How can i make my python bot 24/7
async def yesButton_callback(interaction):
embed = Embed(title=f" banned {member.display_name}", colour=0x36393E)
embed.set_footer(text=f"requested by {ctx.author}", icon_url=ctx.author.avatar)
await interaction.message.delete(delay=5)
await interaction.response.send_message(
content=f' banned **{member.display_name}** | "{reason}"', view=None)
try:
await member.send(f" you were banned from **{member.guild}** for the reason: {reason}")
except:
pass
How can i do it?
Just don't parse view kwarg at all @dry urchin
What i gonna do?
Not you
You are going to get a virtual machine, you can connect to it and execute commands on it
for some reason delete_after= doesn't work?
I don't have money
I don't see it anywhere in your code

evem though it's in the docs https://docs.pycord.dev/en/master/api.html#discord.InteractionResponse.send_message
If you have a bank card you can abuse some free tiers
Amazon AWS provides free tier VPS for 1 year
It is but where is it in your code
I dont have one
i removed it because it gave me an error
Im 14
How do I get the nickname of the author without passing an arg?
You could ask parents ig
They not gonna do it
Passing an arg to where
Well sad
# Raid score command
@commands.command()
async def score(self, ctx:commands.Context):
worksheet = await gs.get_worksheet()
author = ?
Usually it's ctx.author.display_name
However if you have discord.py 1.7.3 I think you don't have that attribute
I don't yeah, not using beta
it still exists
I can use the display_name for the User class
!d discord.Member.display_name
property display_name```
Returns the user’s display name.
For regular users this is just their username, but if they have a guild specific nickname then that is returned instead.
1.5 mb, not sure
Wait does ctx.author give a user class?
ctx.author.name then
Help
depends, if the command was used in a server its a discord.Member, if the command was used in dms its discord.User
If the command is invoked in guild and you have members intent it should be giving discord.Member
Oh, right, it's confusing
@slate swan if your bot isn't very expensive to run I could put it on my server
Thanks
Can i use discloud?
Idk
url=user.avatar_url simply
I already put it
Well error says you didn't
Waht is the difference?
Look
you need to restart the bot too.
also in the footer, its icon_url, not url_icon
cool!
Help me @slate swan
Please

what;s the issue?
@vale wing for the timeout (https://docs.pycord.dev/en/master/api.html#discord.Member.timeout) how do I specify the duration?
let's say I want it for 5mins
I alrdy did datetime.datetime.utcnow() +
from datetime import timedelta
...
await member.timeout(duration=timedelta(days=5))```
avatar_url, not avatar.url
!d datetime.timedelta for more info
class datetime.timedelta(days=0, seconds=0, microseconds=0, milliseconds=0, minutes=0, hours=0, weeks=0)```
All arguments are optional and default to `0`. Arguments may be integers or floats, and may be positive or negative.
Only *days*, *seconds* and *microseconds* are stored internally. Arguments are converted to those units...
ty
from datetime import datetime, timedelta
await member.timeout_for(timedelta(days=5))
# or
await member.timeout(datetime.utcnow()+timedelta(days=5))
ty
@vale wing
elif isinstance(error, commands.MissingPermissions):
member = ctx.author
await member.timeout_for(duration=timedelta(minutes=5), reason="ran ban command when they don't have perms")
owner = bot.get_user(ctx.guild.owner.id)
await owner.send(f" I have timed out **{ctx.author}** for 5m because they ran my ban command without perms.")
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: AttributeError: 'Member' object has no attribute 'timeout_for'
await timeout(until, /, *, reason=None)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Applies a time out to a member until the specified date time or for the given [`datetime.timedelta`](https://docs.python.org/3/library/datetime.html#datetime.timedelta "(in Python v3.10)").
You must have the [`moderate_members`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Permissions.moderate_members "discord.Permissions.moderate_members") permission to use this.
This raises the same exceptions as [`edit()`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Member.edit "discord.Member.edit").
pycord
Then why is it discord.ext.commands...
oh
thir party libraries 😫
Disnake is actually better than dpy imo
why?
because he built a bot on it
More user friendly in terms of slash commands
no?
Those tree.sync dpy has
bruh is that hard
That's not hard but like I gotta write it in every single bot
lmao you have to write import disnake in every single bot
There's no even need to call any functions to sync the tree in disnake
but that sucks what if i want them on a particular server
In dpy too so not an argument
no way
There are kwargs both for bot constructor and for specific commands that allow to sync the commands only in the given guilds
What the hell discord
lmmmao
what version of pycord?
Anyway that's preference
yeah
Does someone know how to get this badge on my bot?
add a slash command to ur bot
I did already
Do you folks think it's overkill to use pydantic to safeguard embed creation against length limit (https://discord.com/developers/docs/resources/channel#embed-object-embed-limits)?
😳
Do i have to restart my bot or kick the bot from the server and invite it again?
Discord smokes grass with these badges they sometimes don't get assigned
depends, if you invited it with application.commands scope or not
I did
:\
i mean why would you need that, you can do that manually yourself
you need global slash command
So i have to make my bot public right?
no, which library do you use?
For slash commands i use from discord import app_commands
I don't know about 2.0, did you mention your guild id somewhere to sync the commands instantly?
discord.py does not sync automatically
😄
@slate swan :warning: Your 3.11 eval job has completed with return code 0.
[No output]
@slate swan :white_check_mark: Your 3.11 eval job has completed with return code 0.
foobar
#bot-commands?
arent we all 
except me 
no u are at least 100000 times better than me
but that's just my guess
probably you are 10000 times better than my guess
N O
discord just really wants you to follow rules
i fixed some of my bot code but im still having some errors
Hastebin is a free web-based pastebin service for storing and sharing text and code snippets with anyone. Get started now.
how do I restart my bot
Ctrl + C in terminal and then start it again
ok thanks ill try it
upload_tweet = api.media_upload(filename, status=tweet_text) #Posts Tweet
, line 3560, in media_upload
return self.simple_upload(
, line 46, in wrapper
return method(*args, **kwargs)
, line 3604, in simple_upload
return self.request(
, line 259, in request
raise Forbidden(resp)
tweepy.errors.Forbidden: 403 Forbidden
you'd better reset these all
if it's possible
and token also
reset token, RN
thank you
!pypi tweepy
📸
swearing aint gonna help
well, so you send a request for posting a tweet and... access denied! we can't know why is it denied, maybe your bot got banned or smth like that
im not banned i know that
and i reseted all the keys
then it's denied for some other reason
idk why can it be denied, I never even used twitter in my life :lmao:
well the thing is as I already told that you've got 403 (access denied)
blocking calls 
env files exist
what's that
^^
@client.command()
async def nuke(ctx):
x = ctx.author.voice.channel
for i in range(10):
await x.connect()
asyncio.sleep(1)
await x.disconnect()
Why it doesn't disconnect and says disconnect is no attribute?
the command name 💀
💀
i was testing quick and forgot to put it in the env
I wanna annoy my friends
💀
Come on... Tell me
api abuse up to heights but this
BRO JUST TELL ME
tell you what, what even is the tb
nvm I found out myself
@client.command()
async def nuke(ctx):
x = ctx.author.voice.channel
for i in range(10):
await x.connect()
asyncio.sleep(1)
y = ctx.voice_client
await y.disconnect()
are u guys trying to be funny or smth?
🆒
- you are re-defining a variable with fixed values
- your type hint for
optis actually saying thatoptcould be None anddict[None]will always return a KeyError exception
a better way could have been
emojis = {}
def cool_emo(self, option: str) -> Optional[str]:
return emojis.get(option)
which will return a None if the key isnt found or the key if it is found
im attempting to post memes through a bot but i cant get it to access the folder tey are in
they*
it cant recognize the path i give it
- I don't get first paragraph
- I have
Nonein my dict
Then I'll do lookup.get(opt, '<default_cool>') , so if key not found then it'll give default cool
what's wrong?
What have you tried
is this valid? ctx.guild.roles
Yes
IDK ALOT OF YT THINGS
@client.command()
async def lockdownmode(ctx):
await ctx.message.delete()
for channel in ctx.guild.channels:
await channel.set_permissions(ctx.guild.roles, send_messages=False, read_messages=False, connect=False, speak=False)
await ctx.send("Lockdown mode enabled")
so this works?
also that prooves another time that u'r 100000 times better than me
try it and see
YouTube is a bad place for discord.py walkthroughs. Check the examples in the documentation and in the examples folder of the GitHub repo
read the error 
I want to do it for every role, How do I do it
Just do it for everyone role



