#discord-bots
1 messages · Page 771 of 1
what don't you understand about it
can i see your task
I changed the timing from 90 to 300 so it isnt refreshing so often
@tasks.loop(seconds = 300) # repeat after every 90 seconds
async def myLoop():
channel = client.get_channel(934725310027530260)
await channel.edit(name=f"Counter: {str(len(client.guilds))}")
client doesn't have commands
!d discord.ext.commands.Bot.process_commands
await process_commands(message)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
This function processes the commands that have been registered to the bot and other groups. Without this coroutine, none of the commands will be triggered.
By default, this coroutine is called inside the [`on_message()`](https://discordpy.readthedocs.io/en/master/api.html#discord.on_message "discord.on_message") event. If you choose to override the [`on_message()`](https://discordpy.readthedocs.io/en/master/api.html#discord.on_message "discord.on_message") event, then you should invoke this coroutine as well.
This is built using other low level tools, and is equivalent to a call to [`get_context()`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.Bot.get_context "discord.ext.commands.Bot.get_context") followed by a call to [`invoke()`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.Bot.invoke "discord.ext.commands.Bot.invoke").
This also checks if the message’s author is a bot and doesn’t call [`get_context()`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.Bot.get_context "discord.ext.commands.Bot.get_context") or [`invoke()`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.Bot.invoke "discord.ext.commands.Bot.invoke") if so.
i use client instead of Bot
same
you just named it wrong
not for you
so just do myLoop.start() underneath the loop
wait_until_ready 
i already have on_message event, can i add 1 more?
Hmm what can i do then?
put code in your on_message
How do I check if a message that sent is from a spammer?
yeah he can add await bot.wait_until_ready() so the cache is complete I know
he has to
what do you mean spammer
otherwise the get will return None
Sometimes discord hides messages that from a spammer on chat
i couldnt figure out how to use it? i tried writing await wait_until_ready but it showed "wait_until_ready" is not defined
That will probably be part of it's moderation settings and client side to those specific members, I don't think you can
!d discord.ext.commands.Bot.wait_until_ready
await wait_until_ready()```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Waits until the client’s internal cache is all ready.
in your case, await client.wait_until_ready()
?
hey i have this command ad i get thir error ```python
@j1mk0l.command()
async def test123(ctx):
r = requests.get(f'http://51.89.34.216:30802/players.json')
events = r.json()
name = str(config['servername'])
em = nextcord.Embed(title=':green_circle: Server Is Online!', description=f"Για να συνδεθείτε στον {name}Ανοίγεται FiveM, πατάτε F8 και γράφεται `connect `", color=color, timestamp=datetime.now())
em.set_author(name=name)
em.add_field(name = '`Online Playes:`', value= int(events['id']), inline = True)
await ctx.send(embed=em)
Command raised an exception: TypeError: list indices must be integers or slices, not str
@tasks.loop(seconds = 300) # repeat after every 300 seconds
async def myLoop():
await client.wait_until_ready()
channel = client.get_channel(934725310027530260)
await channel.edit(name=f"Counter: {str(len(client.guilds))}")
myLoop.start()
``` like that?
yes
that broke my bot so it won't run
yes
should i just remove it
cool thank you
don't tell me you didn't put a :
i did
yes i just put it on the wrong command i have a leave and join
?
why does it print all the channels
no idea what your code looks like now
let me grab it
import os
import discord
import time
import datetime
import asyncio
from discord.ext import commands
class Events(commands.Cog):
def __init__(self,client):
self.client = client
@commands.Cog.listener()
async def on_ready(self):
for guild in self.client.guilds:
print(guild.name)
print(guild.me.guild_permissions)
print(
f'{self.client.user} is connected to the following guild:\n'
f'{guild.name}(id: {guild.id}) \n'
)
members = '\n - '.join([member.name for member in guild.members])
print(f'Guild Members:\n - {members}')
@commands.Cog.listener()
async def on_member_join(self, member: discord.member):
if member.guild.id == 804864012184977438 : return
channels = member.guild.channels
for channel in channels:
if ('welcome' in channel.name.lower()) or ('joins' in channel.name.lower()): #or ('testing' in channel.name)
embed=discord.Embed(title=f"Welcome {member.name}", description=f"Thanks for joining {member.guild.name}!")
embed.set_thumbnail(url=member.avatar_url)
if isinstance(channel, discord.TextChannel):
await channel.send(embed=embed)
@commands.Cog.listener()
async def on_member_remove(self, member: discord.member):
if member.guild.id == 804864012184977438 : return
channels = member.guild.channels
print([channel.name for channel in channels])
for channel in channels:
if ('leave' in channel.name.lower()) or ('goodbye' in channel.name.lower()): #or ('testing' in channel.name):
embed=discord.Embed(title=f"Goodbye, {member.name}", description=f"Bye {member.name} come again soon")
embed.set_thumbnail(url=member.avatar_url)
if isinstance(channel, discord.TextChannel):
await channel.send(embed=embed)```
posted
so now
lol 😆
read code
yeah I read it
print([channel.name for channel in channels])
i had no idea it was there
no wonder lol
huh
I read this
channels = member.guild.channels
for channel in channels:
if ('welcome' in channel.name.lower()) or ('joins' in channel.name.lower()): #or ('testing' in channel.name)
embed=discord.Embed(title=f"Welcome {member.name}", description=f"Thanks for joining {member.guild.name}!")
embed.set_thumbnail(url=member.avatar_url)
if isinstance(channel, discord.TextChannel):
that if statement at the end is always true
and it works i just get a print of every channel because i can't read lol 😆
so you can remove that isinstance line
no py @commands.Cog.listener() async def on_member_remove(self, member: discord.member): if member.guild.id == 804864012184977438 : return channels = member.guild.channels print([channel.name for channel in channels]) for channel in channels: if ('leave' in channel.name.lower()) or ('goodbye' in channel.name.lower()): #or ('testing' in channel.name): embed=discord.Embed(title=f"Goodbye, {member.name}", description=f"Bye {member.name} come again soon") embed.set_thumbnail(url=member.avatar_url) if isinstance(channel, discord.TextChannel): await channel.send(embed=embed) find the print line
i forgot it was there
lol
I SEE IT BUT I'M TALKING ABOUT SOMETHING ELSE 😢
the code works fine now
i made a mistake
I know
ok
Where can i host my bot for free?
your pc
i mean
are you willing to pay
i guess you can use stuff like paypal
seems good?
no
hm
if message in ...:
you need to put it in strings
have you tried azure or aws
what's kelimeler
No
pretty sure its a list or somethingwith strings
[]
i would recommend using ids instead of guild and member objects
try those im sure they accept paypal
Ok
well message isn't gonna be in that
message.content?
the list is empty so it will always return false
that's a string, yeah
yea
that works
thx
Both only accept debit/credit card
also i add a for loop for send x4 times, is that true?
Oh
ah why i returned msg veriable smh
try checking something.host
it sends 5 times and also you can easily get rate limited if that event is triggered too often
remote the return btw
how to make slash commands with 3rd party libraries
wdym third party libraries
elaborate a bit more
k
?
Do you mean cooldowns for commands?
Hi group. I am trying to find a good place to ask some noobish stuff about GPT-NEO and happytransformer.
hm
Is this something you make use of?
nvm i just a bit confused
ah yes smh, ty
@commands.Cog.listener()
async def on_guild_channel_update(self, before, after):
async with aiohttp.ClientSession() as session:
async with self.db.execute(
f"SELECT webhook, guild_id from 'logging' where guild_id = {before.guild.id}",
) as cursor:
config = await cursor.fetchone()
if config is not None:
webhook = Webhook.from_url(config[0], adapter=AsyncWebhookAdapter(session))
if before.guild.id == int(config[1]):
async for entry in before.guild.audit_logs(action=discord.AuditLogAction.channel_update,
oldest_first=False):
embed = discord.Embed(
description=f'Channel was updated ({after.mention})',
color=discord.Color.dark_theme()
)
embed.set_author(name=entry.user, icon_url=entry.user.avatar_url)
embed.timestamp = datetime.datetime.utcnow()
embed.set_footer(text=f'{self.bot.user}', icon_url=self.bot.user.avatar_url)
embed.add_field(name='Creation date', value=f'<t:{round(before.created_at.timestamp())}:D>',
inline=False)
if before.overwrites:
embed.add_field(name='Overwrite deleted',
value=f'For: role Undefined',
inline=False)
if after.overwrites:
embed.add_field(name='Overwrite created',
value=f'For: role Undefined',
inline=False)
await webhook.send(embed=embed)```does anyone know why the field is not added, although I add a permission to a channel
OSError: [WinError 10038] An operation was attempted on something that is not a socket. How to fix this error
:/ hmm
Can i get help her for my discord bot?
You forgot await
yep i fixed thx
sure, you can ask anything here (related to python discord api wrappers or forks), and we'll try to help you with our best
Anyone? 0.0
well, i'm trying to get a username from a steamid64 for my bot, not sure how implement the SteamAPI, more here #help-bagel
is there anyway to host your dc bot free on a online cloud?
nope
Whats the best free way to host you bot
host on ur pc
But then my pc needs to run the whole time
yes
is there any other way
How to define buckettype
!d discord.ext.commands.BucketType import commands from discord.ext and use this commands.BucketType
class discord.ext.commands.BucketType```
Specifies a type of bucket for, e.g. a cooldown.
Thanks
!e
a = 1
b = 2
print(a+b)
@karmic lintel :white_check_mark: Your eval job has completed with return code 0.
3
he asked question to add 2 numbers right?
@boreal ravinethe coding realm ...
How to define buckettype
no
what about it
hi guys, my problem: This code created Muted role, but not set speak false etc.., and not add to member.
just set permissions to 0
@client.command()
@commands.has_permissions(kick_members=True)
async def mute(ctx,member : discord.Member,*, reason="Not specified"):
guild = ctx.guild
mutedRole=discord.utils.get(guild.roles, name="Muted")
if not mutedRole:
await guild.create_role(name="Muted")
if member==ctx.author:
await ctx.send("You cannot mute yourself.")
for channel in guild.channels:
await channel.set_permission(mutedRole, speak=False, send_messages=False, read_message_history=True, read_messages=False)
embed=discord.Embed(title="Muted", description=f"{member.mention} was muted ", colour=discord.Colour.light_gray())
embed.add_field(name="reason:", value=reason, inline=False)
await ctx.send(embed=embed)
await member.add_roles(mutedRole, reason=reason)
await member.send(f" you have been muted from: {guild.name} reason: {reason}")
perms = discord.Permissions(permissions=0)
muted_role = await context.guild.create_role(name="Muted", permissions=perms)
and why is your for loop inside the if where it checks for the author
there are other problems to discuss
mhmm
@cloud dawn you here?
so, a quick question, here's my code:
await inter.response.send_message(embed=embed)
msg = await inter.original_message()
await msg.add_reaction(emoji="\U00002705")```
so there's nothing wrong with this, but I'm wondering how do I get a user printed out every time someone reacts to the message? I tried using `msg.users` but for apparently my msg has no attribute users
msg.reactions
does anyone have the datetime format link for like <t:unixtime:R>
@potent spear oh ok, thanks!
now work
hellow guys. I have a command with buttons (which works) but when i restart the bot i need to resend the command in order for tha button to work. How can i make it permantly?
how can i make a command work if someone is replying to something? I keep getting issues where it requires arguments that are missing
How can i check if message author is bot?
if message.author.bot:
do something```
Can I use 3 and inside an if condition?
if something and something and something:
do something```
yes
what is your problem
you probably just want
if shit in ['fart', 'new pants', 'flush']:
not if shit == 'fart' and shit == 'new pants' and ...:
which isn't possible anyways, but yeah
it is
shit can't be fart AND new pants
it should work on bots, but when owo bot send message, my bot is not doing anything...
you should prolly do that in multiple lines
hellow guys. I have a command with buttons (which works) but when i restart the bot i need to resend the command in order for tha button to work. How can i make it permantly?
ok, you probably think that the first expression is
if any word in kelimeler is in message.content, right?
with another if cond.?
it times out so yhou cant really make it permanent. i dont know of a way to do it so maybe someone else dores
if something in something:
if something:
etc etc
yes
well, that's incorrect
hmm.. why
google
"if any element of list is in string python"
you'll found out why
but is this not same with "if something and something:"
what you're currently checking is if message.content is any element in that list
it is
okay what are you trying to do
How do i delete a message
await message.delete()
hello everyone, i'm working on a basic python bot. its currently setup on my private server just for some testing reasons. i have pip installed the discord module and everything is going great. i'm following some code off a tutorial i found, and currently i'm just trying to get the bot to appear online. when the tutor is executing the code, and once it works, the message "we have logged in as (bot-name#example number) will appear when it runs. the bot will also appear online. i have been trying to do the same thing, although when i use my code, `import discord
import random
TOKEN = "example of token"
client = discord.Client()
@client.event
async def on_ready():
print("We have logged in as {0.user}".format(client))
client.run(TOKEN)` but instead of it saying we have logged in as i specified, it instead floods me with so many errors, so many to even count. can someone tell me what i'm doing wrong? my dms are open btw
look. i want to check owo bot's messages and if owo bot send messages in my message list, bot will dm me
you'll know when you've done it right by this exercise:
shit_list = ['shit', 'fart', 'new pants']
shit_string = "yesterday, I let out a big fart"
now make an expression which returns true because "fart" is a word which is in the shit_list
hint
if shit_string in shit_list:
is incorrect
ah
anyone know why this is so?
so what is correct?
can you use codeblocks?
async def createMutedRole(ctx):
mutedRole = await ctx.guild.create_role(name = "Muted",
permissions = discord.Permissions(False),
reason = "Creation of the Muted role to mute people.")
for channel in ctx.guild.channels:
await channel.set_permissions(mutedRole, send_messages = False, speak = False)
return mutedRole
async def getMutedRole(ctx):
roles = ctx.guild.roles
for role in roles:
if role.name == "Muted":
return role
return await createMutedRole(ctx)
This code not set permissions, but created Role. Anybody help ? 
its discord.Permissions(permissions=0)
they already helped you in the dpy server mate
i was seaching but u pinged me and i back
uh, im using pycharm instead, is that okay?
that has nothing to do with it
codeblocks are discord's code formatting
nothing to do wiht ide
codeblocks is this
shitting = True
while shitting:
print("wipe")```
oh
what an example of shitting
oh ok, whats the command to use a code block?
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.
yup, same question, better format
import discord
import random
TOKEN = "example token"
client = discord.Client()
@client.event
async def on_ready():
print("We have logged in as {0.user}".format(client))
client.run(TOKEN)
HOW DO I UNDO SMTH ON PYCHARM
lol, i confused it with an IDE for c++ im stupid
thankssssssssss
you didn't add py
that gives the nice colours
True```

ctrl + z
best practice is just to use github, in case you messed up yesterday, you can just check a previous commit
it's something to get used to tho
how would i add that to the codeblock?
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.
Guys how do I fix this? Like whats wrong
there you go, any reason why it has so many errors?
I wanna get rid of embed
ctx doesn't exist in an event
it shouldn't have any errors
but if you're trying to run this, you obviously have to pass a token lol
@potent spear
well, think about what you're doing
alright?
if a new member joins, how in the world would a bot know to WHICH channel he should send a message?
no?
your second line gets the channel, that's great
Yeah,
channel = client.get_channel(<shit_id>)
await channel.send("hi")
your first line should create an embed ofc
it's not ctx.send, it's discord.Embed
then do this, it's not that hard
where should I put this then
replace it with the first 2 lines in the if statement
the hi would be replaced with what you want to send
exactly. the code is pefect, the token is correct, yet it keeps flooding me with errors
it's probably just one error
show me the traceback
have you read EVERY line of the traceback? something, just reading is enough
btw, the errors are so many, its -774 below the discord character limit
!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.
Use this
ok ty
is there any way to modify the author of a message before using bot.process_commands? Or to construct a new context with a different author but the same reference message
async def with_commit(func: Callable[..., R]) -> Callable[..., Awaitable[R]]:
async def inner(*args, **kwargs) -> R:
await commit()
return func(*args, **kwargs)
return await inner
Isn't this function beautiful?
doesn't work properly but 😍
are you on MacOS by any chance?
yeah
oh!
simple fix
Getting [SSL: CERTIFICATE_VERIFY_FAILED] on Python 3 on OS X?
Navigate to your Applications/Python 3.X/ folder and double click the Install Certificates.command to fix this.
Happy coding!```
so I still can't get my reaction list to populate
await inter.response.send_message(embed=embed)
msg = await inter.original_message()
await msg.add_reaction(emoji="\U00002705")
users = set()
for reaction in msg.reactions:
async for user in reaction.users():
users.add(user)```
what am i doing wrong?
[SSLCertVerificationError: (1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:997)')]
what's not doing what it should? stop being vague xd
ah that explains it
well, users.add(user) doesn't do a thing. users stays empty.
well, are you even sure reaction.users() isn't an empty list?
@potent spear i did as u said, i have installed the certificate and HOLY, IT WORKS, THANK YOU SO MUCH
gl
well yeah, it's got at least 2 reactions on the original_message()
no, you're just assuming it would work
just print whenever you loop in the for loop
that way, you'll be sure there's even something in there
hmm ok let me try
someone experienced with using steamapi?
shouldn't be that hard I'd say
welp i'm very new to python lol
try the basics first
like learn OOP (classes, methods attributes, ...) move on from there
discord bot is not a good beginner project
whats the ellipsis for
managed to get this https://github.com/ckbaudio/valheim-discord-bot outdated bot running for a game server, only problem i have now is, that i want to get a players username and all i have is their steamid64
I changed it to this @boreal ravine
def with_commit(func: Callable[P, R]) -> Callable[P, Awaitable[R]]:
async def inner(*args: P.args, **kwargs: P.kwargs) -> R:
await commit()
return func(*args, **kwargs)
return inner
ot but whats P/R
P is a paramspec variable
from typing module?
so i can enforce the params of the inner func
more info?
well, the bot reads the game server logfile and sends msgs to discord if it finds certain text
well i did and it remains empty
await inter.response.send_message(embed=embed)
msg = await inter.original_message()
await msg.add_reaction(emoji="\U00002705")
users = set()
for reaction in msg.reactions:
async for user in reaction.users():
users.add(user)
print(f"players: {users}")```
returns `players: set()`
nah, all I want to know is WHY you need the steamname, why you only have their ID currently
and why the bot needs the steamname
show me your print code
it's there, literally that print(f"players: {users}") line
can you read once more what I typed pls?
"whenever you loop IN the for loop"
well the log only contains the steamid64 when someone connects/disconnects from the game server, i would prefer to send their steam username instead of their steamid64 to discord
like print("looping through reaction")
print("looping through user")
ye ok my bad, sry.
what command are you using to get the steamID's?
eh ffs I gotta run now, but I'll keep it in mind. cya guys later
this checks for certain text per line
not really relevant
I just want to know where it saves the steam ID
if you can just replace the steam ID with the steam name via an API, it'll be simple
the only problem could be: the data gets stored for a long time and someone changes his steam username
that's why people use steamID's, since those can't change
what you CAN do tho, is get the username whenever you print, instead of saving the username, you still save the ID, but get its username
this saves some infos in a csv
error.param <- gives me missing parameters in erorr, but how i get what name of command it was used
line 57 is what you're looking for
so I have a list like this with some IDs of discord member
spammers = [id, another id, another id]
And now I want to check if one ID is five times or more in this list
Anyone knows how to do that?
I want that you also can permit roles to join a channel. How can i do that?
set_permission can take a member object or a role object... as arg
what do i need to change in the first line
there are many things wrong with your current command that you haven't tested
let's start with the first big error
if you try ?permit @finite cobalt when you're not in a voice channel, you'll get a big error
Am i right in thinking that this will check if the role id of the after role is in my list of level_rewards but will only start checking from the third item in the list? ```py
level_reward_role = discord.utils.get(after.guild.roles, id = [id for id in self.bot.config.level_rewards[2:]])
How can i fix this error
handle things man,
write down what you THINK before coding it
first thing you should check
if the author isn't in a voicechannel, notify him and stop the command (return)
that's the VERY FIRST step
it is a self bot -.-;
ok im trying it
second big thing to fix
bot_commands is a terrible variable name
better would be
bot_commands_channel = guild.get_channel(<yourstinkychannelID>)
im working on my bot, everything is going well, but an issue i have come across is that i want the bot to say text, only that it would be covered in because its a spoiler. in my code i do py print ("sample text \r /spoiler suprise!")
can somone help?
what are you on about?
How?
what do you think \r does?
||this is a spoiler||
e
||hello|| is ||hello||
uh sorry i meant \n
im creating a new line for my spoiler text
why this isnt working?
spammers.append(message.author.id)
spammers = []
a = dict(Counter(spammers))
When I pint a in only get {} with nothing in it
But when I print spammers I get a full list with many IDs two times or more
spoiler text looks like this
||this is a stinky spoiler||
||this is a stinky spoiler||
I had a stroke while trying to read that
why?
lmao
I just want to do it right but idk how to
what are you trying to dfo
yes i know, that variable is what i need to convert to a steam username, just don't know how with steamapi, pretty new to python
I want to add the message.author id to the list evrytime he sends a message
And then if the id is more then 5 times in the list I want to send something
just look for a steam API wrapper in python, preferable an async one
just append the context.author.id
Is it possible to get a python code from discord
Example command
!execute await ctx.send("test execute")
And execute it like
@client.command(hidden=True
async def execute(ctx,*,snip):
exec(snip)
😅
cof cof
how to do the if thing?
So if and then?
that's an eval command
you don't want to recreate that, since if you code anything wrong, people with bad intentions can basically run a command which deletes all the files on your pc
use jishaku (it's a dpy extension which has an eval command built-in)
@fresh orchid you can get the author id and use the append function
thats what i said ye'
thats where I copied it from
might look something like this
Where can I get jishaku
authors = []
authors.append(context.author.id)
ok
Woah, cool
i will try
and then do
How do i check if a user is connected to a voice channel?
K i'll just google
google
discord jishaku
well
if you do
ctx.author.voice
voice will be None if the user doesn't have a voice_client
!d discord.Member.voice
property voice: Optional[discord.member.VoiceState]```
Returns the member’s current voice state.
primarily to test simple stuff or for eval commands
uhuh
@potent spear :white_check_mark: Your eval job has completed with return code 0.
I smell like shit
Uhuh
Also also
I have a question
AttributeError: 'NoneType' object has no attribute 'channel'
because voice is None, THINK MATE
if you wanted to do ctx.author.voice.channel
you can't, because voice is None
How do I convert a user's pfp to pixel form
But im checking if its none and it gives me this error
Use pillow or any API (easier way)
I guess you need Pillow for that
uhuh, tysm
!pypi pillow

Tho using dagpi API or smth is easier
it's a python lib, idk why it's called that
that's just them having an existential crisis
I'm not "that" dumb
Okay, sorry about that
Lmao
the bar has to be low nowadays, you don't wanna know what kind of questions get asked here
They are a PIL fork, so ig they had to have a matching name?
uhuh
no idea, I don't use any
I made this now
if collections.Counter(spammers) > 4:
print(message.author.id)
But its not working
because you don't know what it's doing
Lmao
Exactly
LMAO
you don't know what the Counter() is returning obviously
Thats insulting lol
PIL is the original version, Pillow is just a fork of PIL
the counter returns something like {id : 5}
dude ends careers day in and day out
yes, it's a dict, that's what they call it
a dict has key value pairs
the key being your member id, the value being how many times it was counted in the list
so if I wanted to know how many times I shat it would be
Counter(shit_list)['shat']
How do i check if a user isn^t connected to a voice channel
shit_list= ['shat', 'shat', 'clean_pants', 'clean_pants']
How to install jishaku?
if member.voice is None:
the github readme tells you
Nvm
or even better: their docs
Pypi
i get an error
no, actually
https://jishaku.readthedocs.io/en/latest/
if it's member is not defined don't talk to me
its working thank you for the help
gl!
Cry about it the error is?
'NoneType' object has no attribute 'channel'
Eh?
The user voice is none
print("not connected")```
Apply brain
do you realize what this checks?
Im new to programming so i dont know
in YOUR CASE
this only checks if the member you mentioned is in a voicechannel
it DOESN'T check if the author is in a voicechannel
it's logic, not really programming involved
You jumped to discord bots
Totally cool
am i the only one who spent 20 hours learning python
But i need to know if the author is in a voice channel
you know perfectly how to get the author...
Uhuh
print("not connected")```But this is also an error
Lmaooo
author = ctx.author is defined
ABOVE that if statement?
yes
What the "error" is?( Wrong ping sorry)
Cuz Who needs explanation when you've got code
well, your main problem is, even though you print that the author isn't connected, you still process the other code
you have to RETURN after finding out the author isn't connected
the error?
Its fine big brother
mhm makes sense , I don't see anything which may raise an error ( except for if the command was used in dms)
return
else:
print("connected")```like this?
Yeah
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: AttributeError: 'NoneType' object has no attribute 'channel'
No
you did author.voice.channel somewhere
that's where the error comes from.
It means you need to learn python first

Who cares when you can copy code from stack 
still the same error
FULL error
@slate swan btw what is hikari
who uses stack when you can just check random git repos and copy code
^^ main method
Api wrapper
my girl jk ,it's an discord api wrapper
Who does this this shit when you can just sleep 😴
!PyPi hikari
Actually u did the opposite but okay cool
Aw, how patriotic, "my" girl
Why is it so famous lol , is it even stable

I mean , it's actually kind of same
!pypi pincer
Yea

both are in alpha
It's much more stable than pycord and edpy , bet.
Y'all know that ot channels exist, right?
¯_(ツ)_/¯
I just used a emoji 🙂
@slate swan someone saying Hello to you 👀
Gentleman and ladies 🙂
What if I'm not gentle
¯_(ツ)_/¯
I get chills with hikari 😔
something which actually makes me to read the docs again and Again
not if they have a dark theme with codeblocks and a purple text theme
Still they are BOOORING
U should focus on content 
how can you not make docs boring?
It's not like you get a cookie per page you read
i have a question: how can i implement a purge command in my bot?
i have discord.py and dislash libraries, and so far i have written this code:
@slash.slash(
name = "purge",
description = "Purge a number of messages.",
guild_ids = [792452919159947315, 878358390131286036]
)
async def purge(ctx:SlashContext):
but after this i have no idea as to how to continue.. i should add an option which stands for the number of messages to be purged i think, but i am not sure how to also because i don't know anything about option types and i haven't found info anywhere (probably just me incapable of searching)
either way, i'd be grateful if someone told me what option types are or where to find info about them, along with a continuation to my code please
That's why I prefer asking people weird and useless questions instead of reading docs
(the guildIDs are test servers so i didn't hide)
well, if it's make you feel better, you're surely not the only one
Never used slash commands, sorry!
If it's about content I'd say it's great too :)
oh don't worry, thanks for the attention anyway
you shouldn't hide it anyways, it's not like it's private lol
What's the library?
yes yes but you can know what servers i'm in, just for that
dislash
The only thing(s) u should hide is/are:
-> Bot Tokens
-> User Tokens
-> Weird Bot Object Names
User tokens ? 
Yea
oh no no it's discord slash (with underscore but broken keyboard xd)
Same as bot tokens, but for a user account
Ah , I never used this library sorry
i am gonna read that either way, thank you
@slate swan please use a fork instead, like pycord or disnake
you suggest that huh? because they're more common?
No
Because they are easy to maintain 
Because they are updated with the latest API features
they are a lot better than using a 3rd party'library
discord.ext.commands.errors.MissingRequiredArgument: number is a required argument that is missing. How do i fix these kinds of errors
you need to invoke the command with a number in the arguments aswell, do you not know your own code lmao
alternatively set it to not required sir
How can i do that
could anyone here help me with creating warn system? I'm using postgresql, I dont know how to connect it to my file nor how to use it. I tried watching some tutorials but I just cant understand all the things they do
create_option(
name = "user",
description = "Whom to kick",
required = True,
option_type = 6
),
you see this code? required = True
you should have it similar, set it to False (capital F is important)
what's the file extension?
I'm not using extensions
you mean your python bot file?
yes
yes
use asyncpg
asyncpg yes
it's an async wrapper of postgresql
asyncpg
can I connect to it without using a function?
why would you not want a function?
false
do you not use cogs
do you know python basics?
no
and no you dont
^
pretty much yh
can i make a captcha solver and use it for discord bots?
well, when should you use self then?
But I didnt do it the smart way, I'm a self learner and I learnt before I did something each time
everything's possible
but idk how to take img from bot's message
well since I've never actually used self, i dont know
what's your goal?
async def create_db_pool():
db = await asyncpg.create_pool(database = "mydatabase", user = "myuser", password = "mypass")```
this would work right?
learn a bit about OOP, it'll speak for itself
correct, looks clean
How to get a user's avatar by id
So I probably need to call the function now
bot.get_user(id), then you have the user object, check the docs for more
my goal is when bot send a picture, my bot will take that picture and send text from img
well, you're wayy too many steps ahead of yourself
you need to learn how to solve captcha from a picture first THEN implement it in a bot
So you're trying to bypass a captcha verification system?
yes
Lmao
to set the type of the column
ik how to solve but idk how to take img
such as int, string, etc\
Not sure if it's against tos but it is extremely inappropriate
you should know that if you knmow python basics @rocky trench
there are different datatypes, char, varchar, bigint, int. They each have different things they store
well i pretty much explained myself on that... I only learnt what I needed
should be bigint, (big)int, and varchar then I think
and you need datatypes
why not , lol we're doing everything....
message.attachments
Can you please not help him?
He's trying to bypass a captcha verification system
Damn
won't work anyways lol
hmm... is this against to TOS?
Probably
If it's not it's certainly inappropriate
CAPTCHA is there for a reason and we shouldn't try to by pass it
whats the difference between bigint and bigint[]
bigint[] is a list i believe
but there is captcha solvers as chrome extentions
They are doing wrong things 
also I cant find varchar
I dont see your point
Just because people rob banks it doesn't mean it's okay for you to do it
ah actually yes
I think these are right?
My example is very dark lol 🙂
@potent spear (sorry for ping)
second is also bigint*
what DB is this?
postgres
also, this is pretty much #databases
How to send an Asset object?
all I know is that
ID -> int
warns -> int
reasons -> list(str)
just convert that to whatever datatypes postgresql uses
Send it's url maybe?
I see
there's also a small flaw
if your warns is basically a count of reasons, then it's too much
!d discord.Asset.url
property url: str```
Returns the underlying URL of the asset.
what decoration permission does this have?
i use disnake
i cant spell
!d disnake.Member.timeout
await timeout(*, duration=..., until=..., reason=None)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Times out the member from the guild; until then, the member will not be able to interact with the guild.
Exactly one of `duration` or `until` must be provided. To remove a timeout, set one of the parameters to `None`.
You must have the [`Permissions.moderate_members`](https://docs.disnake.dev/en/latest/api.html#disnake.Permissions.moderate_members "disnake.Permissions.moderate_members") permission to do this.
New in version 2.3.
that
thanks bud
Is it possible for a user to change id?
In any way?
No
a user id cant be changed
The id is impossible to change
Never
So that means if bot.get_user() returns a NoneType
The user has been deleted???????
It's the discriminator
multiple options, the user could also not be in scope of the bot anymore
Wdym
like, if the user isn't in any guilds the bot is in, it would return None too
Hmmmm
Or if you provided a string
mmh
Ooohhh
How can i mention the everyone role
Thank God that exist
hi, im working on my bot and have given it many commands. how do i make it give you an input where u can fill in details?
guild.default_role
!d discord.ext.commands.Bot.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.9)"). 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.9)") 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.9)") containing those arguments is returned instead. Please check the [documentation](https://discordpy.readthedocs.io/en/master/api.html#discord-api-events) for a list of events and their parameters.
This function returns the **first event that meets the requirements**...
I do @ everyone without the space
hardcoded be like
@slash.slash(
name="private",
description="Manage a private voice.",
guild_ids=[798251886951399487],
options=[
create_option(
name="create",
description="Create a private voice.",
option_type=1,
required=False
),
create_option(
name="remove",
description="Remove a member.",
option_type=1,
required=False
),
create_option(
name="add",
description="Add a member.",
option_type=1,
required=False,
options=[
create_option(
name="member",
description="Choose the member you want to add.",
option_type=6,
required=True
)
]
),
create_option(
name="transfer",
description="Transfer private voice leadership.",
option_type=1,
required=False
),
create_option(
name="list",
description="List added members.",
option_type=1,
required=False
)
]
)```
Can anyone help? I'm receiving back: ``create_option() got an unexpected keyword argument 'options'``. I'm using discord-slash-commands and want to add options which only apply to my subcommand.
check the third create_option
I guess you don't have an options kwarg in the create_option method
How would nest into the sub command then?
f"<@&{guild.id}>"
the smile is creepy

yeah
lmao, I was just remembering you 5 mins ago ||dont get me wrong||

woah cool
we normie little bot owners
hahah me too. I tend to prefer making small community bots
High standard people

Wait wait wait
Hello, I have been trying to do a function witha python bot, which gets the input of the discord user and takes a specifc character out of it, and sends it in the title of an embed
One question
but it sends like <!324324443243> ths kinda thing
Bro, just make a ban command which is a message command
provide more context
^
okay ill show picture
!d discord.ext.commands.Bot.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.9)"). 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.9)") 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.9)") containing those arguments is returned instead. Please check the [documentation](https://discordpy.readthedocs.io/en/master/api.html#discord-api-events) for a list of events and their parameters.
This function returns the **first event that meets the requirements**...
How did my bot get your avatar then?
!d discord.Member.avatar
property avatar```
Equivalent to [`User.avatar`](https://discordpy.readthedocs.io/en/master/api.html#discord.User.avatar "discord.User.avatar")
I told u tho
You followed the freecodecamp tutorial, didn't you?
How to get avatar using id
nvm I guess get_user works even tho the bot isn't in your guild
!d discord.Client.get_user
get_user(id, /)```
Returns a user with the given ID.
Man, I'm so confused
it's not hard
And if this returns None, then
freecodecamp hot
!d discord.Client.fetch_user
await fetch_user(user_id, /)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Retrieves a [`User`](https://discordpy.readthedocs.io/en/master/api.html#discord.User "discord.User") based on their ID. You do not have to share any guilds with the user to get this information, however many operations do require that you do.
Note
This method is an API call. If you have [`discord.Intents.members`](https://discordpy.readthedocs.io/en/master/api.html#discord.Intents.members "discord.Intents.members") and member cache enabled, consider [`get_user()`](https://discordpy.readthedocs.io/en/master/api.html#discord.Client.get_user "discord.Client.get_user") instead.

User is deleted?
why ?
!d disnake.Client.getch_user if u r using disnake
await getch_user(user_id, *, strict=False)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Tries to get the user from the cache. If fails, it tries to fetch the user from the API.
Hmmmm
@restive tide I'd re-write your bot after following this tutorial as a framework: https://tutorial.vcokltfre.dev/
okay
Try writing python
Please stop sending that without any reason
uhuh
Have you put on the checkmark "Add Python to PATH" on python setup?
Once or twice is okay, but u sending it repeatedly is just cluttering the chat
get_user() check the bot's user cache, which is stored in memory, for a user object. If a user object is not found in there, it returns None. fetch_user() makes an actual call to the Discord API, and will almost always return a user object unless they don't exist.
from datetime import datetime, timedelta
AttributeError: type object 'datetime.datetime' has no attribute 'timedelta'
@vale wing :warning: Your eval job has completed with return code 0.
[No output]
Had that happen to me before, I'm guessing it's because of the package and the class name being similar
Show your usage of it, I don't think the error would be on that line
Show the imports above
also, not really the right channel
ah it was not the import that was wrong
Fetch user gets id as arg?
No, your social security number
Ok lemme try that
U have imported datetime in the former lines
Ah gotcha
Still wouldn't be an issue https://static.themilkyway.tech/file/the-void/screenshots/pythonw_MtT7M40oqj.png
ah, that's why wasn't doing as intended
It returns a coroutine object
i don't how to work with
making a timeout command, duration: Optional[Union[float, timedelta]] it works great with just give seconds but how i give like 2022-01-23 18:19:00
Strftime or whatever
no like !timeout @vale wing 2022-01-23 18:19:00
that took it as i passed none to duration and that went as reason instead
Calculate the ending time and strftime it
async def timeout(self, ctx, member: Member, duration: Optional[Union[float, timedelta]], *, reason="No reason was given.") -> None:
"""Timeout a member."""
print("Timeout member.")
await ctx.guild.timeout(member, duration=duration, reason=reason)```
You want to convert the time?
!d datetime.datetime.strptime
classmethod datetime.strptime(date_string, format)```
Return a [`datetime`](https://docs.python.org/3/library/datetime.html#datetime.datetime "datetime.datetime") corresponding to *date\_string*, parsed according to *format*.
This is equivalent to:
```py
datetime(*(time.strptime(date_string, format)[0:6]))
``` [`ValueError`](https://docs.python.org/3/library/exceptions.html#ValueError "ValueError") is raised if the date\_string and format can’t be parsed by [`time.strptime()`](https://docs.python.org/3/library/time.html#time.strptime "time.strptime") or if it returns a value which isn’t a time tuple. For a complete list of formatting directives, see [strftime() and strptime() Behavior](https://docs.python.org/3/library/datetime.html#strftime-strptime-behavior).
Then there's this thing ^
!pypi dateparser
theres also this
!pypi humanize also exists
it's a class , so .Guild
!d discord.Guild
class discord.Guild```
Represents a Discord guild.
This is referred to as a “server” in the official Discord UI.
x == y Checks if two guilds are equal.
x != y Checks if two guilds are not equal.
hash(x) Returns the guild’s hash.
str(x) Returns the guild’s name.
i decided to use pycord
i'm gonna go read and rewrite the few commands that were there now
thanks for the suggestion
on_member_join not working, what could be the problem?
If you need a code, I'll send it
!intents
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 the Members and Presences intents, which are needed for events such as on_member 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.
send the code sir yes
Simply enable the members intent and you're good to go.
hey could the problem have to do with the invite link?
i remember that unless specified when creating the invite link the bot couldn't do some things
and write intents in the main file or in cogs, the code is in cogs?
@slate swan
The message above says all
Okay
You need to give it when your instantiate the bot class.
So when you do
bot = ...
is there an event for when timeout is released/cancled
how would i make a bot that tells me who just pinged me? 🤔
!d discord.Member.mentioned_in
mentioned_in(message)```
Checks if the member is mentioned in the specified message.
!d discord.Message.mentions
A list of Member that were mentioned. If the message is in a private message then the list will be of User instead. For messages that are not of type MessageType.default, this array can be used to aid in system messages. For more information, see system_content.
Warning
The order of the mentions list is not in any particular order so you should not rely on it. This is a Discord limitation, not one with the library.
There are a few ways to do so in on_message
Aaaaaaahhhhhhhhhh, I'm sooo stupid
.
Figured out the code and then closed the dm
Lol
my bot just raised a missing access error for fetching a channel, i dont get it, anyone know why?
what did you do
Bot.fetch_user()
did you await it
@tardy lagoon did it raise NotFound or HTTPException?
yea unknown user error comes with discord.errors.NotFound
yea thats prob it
it is ```py
raise NotFound(response, data)
disnake.errors.NotFound: 404 Not Found (error code: 10013): Unknown User
similar error , right mr nickname?
Traceback (most recent call last):
File "/home/container/.local/lib/python3.10/site-packages/jishaku/features/python.py", line 145, in jsk_python
async for send, result in AsyncSender(executor):
File "/home/container/.local/lib/python3.10/site-packages/jishaku/functools.py", line 109, in _internal
value = await base.asend(self.send_value)
File "/home/container/.local/lib/python3.10/site-packages/jishaku/repl/compilation.py", line 140, in traverse
async for send, result in AsyncSender(func(*self.args)):
File "/home/container/.local/lib/python3.10/site-packages/jishaku/functools.py", line 109, in _internal
value = await base.asend(self.send_value)
File "<repl>", line 1, in _repl_coroutine
await _ctx.send(await _bot.fetch_user(897147305042538506))
File "/home/container/.local/lib/python3.10/site-packages/discord/client.py", line 1384, in fetch_user
data = await self.http.get_user(user_id)
File "/home/container/.local/lib/python3.10/site-packages/discord/http.py", line 250, in request
raise NotFound(r, data)
discord.errors.NotFound: 404 Not Found (error code: 10013): Unknown User
Sooooo, deleted?
ye, the user with that id does not exist
It used to
Aw man
Well, he's gone
What's the best library to use for slash commands?
If I put my command description in a doc-string can I loop over the functions in a cog and create a custom help command?
hikari, pycord, nextcord and disnake are a few
!d discord.ext.commands.Command.description
hikari shill
!d discord.ext.commands.Command.help
!d discord.ext.commands.Command.short_doc does that @forest beacon
property short_doc: str```
Gets the “short” documentation of a command.
By default, this is the [`brief`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.Command.brief "discord.ext.commands.Command.brief") attribute. If that lookup leads to an empty string then the first line of the [`help`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.Command.help "discord.ext.commands.Command.help") attribute is used instead.
I wish the documentation had more examples.
Wym
It’s in the command section. Meaning the commands decorator right?
very nice, got the steamapi working now
@bot.command(
short_doc="abc",
description="abcabc",
aliases=['a', 'b', 'c'],
)```
I host using vultr for 2.50. Half a gig of ram and 10gb ssd with 1 vCore. The bot is in less than 15 servers so it’s good enough.
!d discord
To work with the library and the Discord API in general, we must first create a Discord Bot account.
Creating a Bot account is a pretty straightforward process.

No documentation found for the requested symbol.
how many servers ur in?
How would I access that in a custom help command?
- The other is 11 and it’s on the same plan. So 5 bucks a month for 2 bots.
Actually 7. I forgot I went for the IPv4 and IPv6 so it’s 3.50 a piece.
oh so its not bad if im paying 3$ im gonna use it on like 1 server
I got u a better VPS for free as long as u have a CC
I have my bots listed on the bot website. Whatever it is lol. Should definitely be fine with the 2.50 plan. Maybe even a pi zero 2 lol.
Cc?
Use vultr vps
Credit Card
!d disnake.ext.commands.Bot.get_command || py command = bot.get_command("command") print(command.short_doc)
get_command(name)```
Get a [`Command`](https://docs.disnake.dev/en/latest/ext/commands/api.html#disnake.ext.commands.Command "disnake.ext.commands.Command") from the internal list of commands.
This could also be used as a way to get aliases.
The name could be fully qualified (e.g. `'foo bar'`) will get the subcommand `bar` of the group command `foo`. If a subcommand is not found then `None` is returned just as usual.
That sounds like a scam.
shit bot @unkempt canyon
Oracle
2 AMD based Compute VMs with 1/8 OCPU and 1 GB memory each
4 Arm-based Ampere A1 cores and 24 GB of memory usable as one VM or up to 4 VMs
2 Block Volumes Storage, 200 GB total
10 GB Object Storage – Standard
10 GB Object Storage – Infrequent Access
10 GB Archive Storage
Resource Manager: managed Terraform
5 OCI Bastions
A friend of mine just got one, a few days back
Alright. Now I have to figure out how to access the help commands lol. I want ..help to display the modules and ..help fun list all the commands in the fun cog for example.
Thanks.
!d discord.ext.commands.HelpCommand
class discord.ext.commands.HelpCommand(*args, **kwargs)```
The base implementation for help command formatting.
Note
Internally instances of this class are deep copied every time the command itself is invoked to prevent a race condition mentioned in [GH-2123](https://github.com/Rapptz/discord.py/issues/2123).
This means that relying on the state of this class to be the same between command invocations would not work as expected.
U using this?
I currently don’t even have a help command. I disabled the default one and have been physically looking at my code to use the commands lol.
!d discord.ext.commands.HelpCommand
class discord.ext.commands.HelpCommand(*args, **kwargs)```
The base implementation for help command formatting.
Note
Internally instances of this class are deep copied every time the command itself is invoked to prevent a race condition mentioned in [GH-2123](https://github.com/Rapptz/discord.py/issues/2123).
This means that relying on the state of this class to be the same between command invocations would not work as expected.
how do i convert a disnake.Attachment object to a python file?
f = io.StringIO(await attachment.read())
i got this error Ignoring exception in on_message Traceback (most recent call last): File "C:\Users\shake\AppData\Local\Programs\Python\Python310\Lib\site-packages\disnake\client.py", line 515, in _run_event await coro(*args, **kwargs) File "C:\Users\shake\AppData\Local\Programs\Python\bot.py", line 390, in on_message saved_file = io.StringIO(await file.read()) TypeError: initial_value must be str or None, not bytes
btw the file variable is an attachment
https://github.com/FrancescaLEGIT/Agumarine i uploaded my bot code without the token cuz idk why
!d discord.Attachment.to_file
await to_file(*, use_cached=False, spoiler=False)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Converts the attachment into a [`File`](https://discordpy.readthedocs.io/en/master/api.html#discord.File "discord.File") suitable for sending via [`abc.Messageable.send()`](https://discordpy.readthedocs.io/en/master/api.html#discord.abc.Messageable.send "discord.abc.Messageable.send").
New in version 1.3.
why do you want a python file object?
bc i need to scan the file through a phishing API to check for threats
didn't know this was a thing...
ye ik
i think
file = open(io.StringIO(str(await attachment.read())))```
something like that
!d discord.Attachment.save
await save(fp, *, seek_begin=True, use_cached=False)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Saves this attachment into a file-like object.
that saves it
this doesnt create a new file
been there done that
attachment.save() keeps giving me perm errors
idk why tho
Your python program doesn't have permissions to save files ig
but opening it is an extra step
You're opening in your example to though, save does the same thing as your example, you just need to open the file
!d disnake.Attachment
class disnake.Attachment```
Represents an attachment from Discord.
str(x) Returns the URL of the attachment.
x == y Checks if the attachment is equal to another attachment.
x != y Checks if the attachment is not equal to another attachment.
hash(x) Returns the hash of the attachment.
Changed in version 1.7: Attachment can now be casted to [`str`](https://docs.python.org/3/library/stdtypes.html#str "(in Python v3.10)") and is hashable.
when you use os.remove('text_file.txt'), can you pass a file path?
Yes you can
nice
otherwise could you pass a file object?
Only a path can be passed in as far as I remember, check the docs
Hello , [ !calce apr apy ] I want to do that but i can't
@client.command()
async def calce(ctx, *args):
if "apr" in args:
await ctx.send("hey")
What are you trying to do?
Gib context
why is everybody telling me to stop using discord.py bc its gonna be canncelled?
is like disnake okay or?
just install disnake
Okay great I did and using it
good
Is it just me or Ashley has changed pfp
what is this
whos ashely
👀
Is there any way to timeout members with discord.py?
No
Yeah, thats me, you can make fun in any ot channel, ping me
oh hey ashley....
Alr, guess I gotta make muted role
Henlo
Who said am making fun of u tho
Lmao, no one, just a suggestion
Nah, imma pass that one ¯_(ツ)_/¯
Give more explanation of what you're trying to do
smiles creepily
It isn't connected
AttributeError: 'NoneType' object has no attribute 'stop'
Or it isnt playing anything
example !bot (1.command) (2.command) (3.command) , i don't speak enough english to tell you my problem , i am sorry 😦
!d discord.ext.commands.Context.voice_client
property voice_client: Optional[VoiceProtocol]```
A shortcut to [`Guild.voice_client`](https://discordpy.readthedocs.io/en/master/api.html#discord.Guild.voice_client "discord.Guild.voice_client"), if applicable.
yeah it isn;t
!d discord.VoiceProtocol
class discord.VoiceProtocol(client, channel)```
A class that represents the Discord voice protocol.
This is an abstract class. The library provides a concrete implementation under [`VoiceClient`](https://discordpy.readthedocs.io/en/master/api.html#discord.VoiceClient "discord.VoiceClient").
This class allows you to implement a protocol to allow for an external method of sending voice, such as [Lavalink](https://github.com/freyacodes/Lavalink) or a native library implementation.
These classes are passed to [`abc.Connectable.connect`](https://discordpy.readthedocs.io/en/master/api.html#discord.VoiceChannel.connect "discord.VoiceChannel.connect").
but I wanna make sure it stops playing before it plays another
how do I check for that
We cant help you like that-
Try except? Idk



