#discord-bots
1 messages Β· Page 767 of 1
bro?
cof cof
πͺβ¬ οΈ
.topic before we find the lame-est
Suggest more topics here!
one which kicks okimii
buttons over reactions
πͺπ
Lmaoooo
A feature to get anything we want for free
lmao
a genie bot , yay
I got the best 3 wishes anything can wish for (gonna DM u)
a genie bot that has the same 3 rules
alrightyyy
but id get like infinite wishes by asking the genie to reset his memory so he would think i have 3 wishes lol
I got a better way
what is it
@slate swan knows 
ping command
- a ping command which always show a latency less than 50ms
dm me too, i will use it on my mom and make her go bankrupt
so i can actually say , my host's best
replit best host
infernum you regret saying that
Rip
replit on top
ill assume u still didnt read it
i just did, when I said nvm
@client.command(aliases=["sad"])
async def sadge(ctx):
em = discord.Embed(title=f'**{ctx.author}**is sad :Sadge:')
em.set_image(url=f'{random.choice(Sad)}')
await ctx.reply(embed = em)
Why does the image doesn't load?
What's sad?
A list of gifs I'll suppose
Maybe the image is no longer saved on the source
oh
they go like this
guys was mina always an admin?
That's not how u use tenor urls
then how?
Open the link in some browser , wait for it to load , select the gif option and right click on the image to copy link
No, see #changelog
Wym
oh let me try it
Ah that
wierd , but discord issue
YES mina if you see this congrats
@.minaβ―β©β―#0001 
They always have their eyes on the Server
very nice
yeah now mina needs to learn dpyπ
Okimii will teach
yes
best teacher
@client.event()
async def on_message(message):
await ctx.author.password.save()
```why not works?
its
def on_message()
```
Wait nvm wrong app
Lmao hunter , wasn't that supposed to be google
Yea π
Oh thanks , I'll try
it says ctx not defined , how do I define it
password.save? From where you got that
yeah
That doesn't exist lol
It was just some cursed code
https://github.com/discord/discord-api-docs/pull/4355 check the comments
PyCord is shit
lmao
I agree.
Pycord is decent but lala is pretty toxic for no reason sometimes imo
they should not have included any forked libraries at the moment imo
like they included nextcord , but how is that reasonable
cause vco made a pr for it
vco on top π
jokes aside, idrk why nextcord is there
https://github.com/discord/discord-api-docs/pull/4343 at least he credited d.py ig
It woks
tysm
guys why doesn't this work
@bot.command()
def on_message(self, context: disnake.MessageInteraction):
await context.author.password.save()
await context.send("i got your password")
haha
its not disnake.MessageInteraction
..
its disnake.Guild
its a joke chill
yeah i tried that and it prints AnErrorNotCausedByTheFork error
because you have to do this
import request as aiohttp
import pycord as disnake
import disnake as nextcord
import sqlite as aiosqlite
from disnake import *
from pycord import *
from nextcord import *
i also imported the random library but im getting this totally real error:
ModuleNotFoundError: 'random' module couldn't be found akfjkksgd
you have to do this ofc
import *
π§
bruh
dont star import
wut π§
same thing
noπ§
why does it error
comp is a list
@slash.slash(description="Shows bot info")
async def botinfo(ctx):
embed=discord.Embed(color=0xb30000, title="Pexibot", description="pexibot invite link")
embed_buttons = [[
Button(label='β
Support Server', style=ButtonStyle.URL, url='e'),
Button(label='π Website', style=ButtonStyle.URL, url='e')
]]
await ctx.send(embed=embed, components=embed_buttons)
i used discord_components
Why [[
library

waht can i replace it with

Simply [
it will work if i remove?
I doubt the library asks you to make [[1, 2, 3]] for a list.
the command await get_user(id) asks for user id right?
not sure what button has a get attr
Don't await it
and yes, user ID
get isnt a coro lol
Are you using discord_components?
!d disnake.Guild.get_member
get_member(user_id, /)```
Returns a member with the given ID.
i dont see is a coro
it's Guild.get_member(member ID)
^
same with get_user (just the member ID) if you don't have a guild object @ocean pasture
nothing
if you remove commands/features from the sentence, then the answer is okimii
thank you father
but didnt i show you how to make buttons
πΆ

@bot.command()
async def repeat(ctx, *, text=None):
if '@everyone' or '@here' in text:
return
else:
await ctx.send(text)
when i trigger this command, there is no output
there are no on_message events
can anyone help please?
did you called the command with text?
!repeat hello
this is how i called it
any error handlers?
well, nothing is wrong in the code above I think so it's probably something else than that
what events do you have?
try another command
just on_ready
mhm
i just started this project i didnt do anything big yet
btw else is useless
strange
yeah try that
xD yes
@bot.command()
async def repeat(ctx, *, text=None):
if '@everyone' or '@here' in text:
return
await ctx.send(text)
this is better
oh wait can you show your on_ready?
@bot.event
async def on_ready():
print(f"-----\nLogged in as: {bot.user.name} : {bot.user.id}\n-----")
bot.loop.create_task(bot_activity())
let me try
if the mentions are in the text it will return which stops the function if not it will continue but it wont change anything
yes i know
i just dont like using that method i prefer using else
it didnt work also
useless tbh
show your whole bot
wait
give me a minute
tried to change the command
i also tried to remove every other command and event in my file but it didnt work too
show your bot
hmmm
maybe the discord-components
the bot file
can i send you it in the DM?
no i dont help in dms
!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.
well i cant send it here, sorry
why so?
i can also explain this in the DM
why not here is it against tos?
basically i dont want the code to be leaked for a few reasons
why so?
it will be public with many new commands
like game stats and stuff
So?
so i dont want to send the source code here
i can send you in the DMs and you can help me here, if it has something against the TOS you could still report me
If you want help, provide the code here; if you don't then you won't get help.
^
I'm just really bad at helping
i respect that
same here
and if i had something that against the TOS in my bot people would report it so i have nothing wrong there i just dont want to leak the start of my big project and the DB
but i get why you cant help me
i respect that
Again, you can argue as much as you want. If you don't provide code, we can't help you.
thanks anyways π
u good? im not arguing
For database credentials, you can remove them. For bot token, you can remove it.
i literally just said thank you
you can get help
just dont show your other commands ez
Just move on I guess, people expect to get help without providing what we ask for, so the code.
nah its good thx
do i owe someone in here my source code i worked for?
if i dont want to send it it is my right
Then don't ask for help if you don't give what we need to be able to help you ;)
btw no one will use your bot if you have no src code lol
^^
Β―_(γ)_/Β―
you are just trying to harm me for my right
i know i will not get any help
wut
Well it's funny, you don't want to leak database credentials which you can remove.
You don't want to leak the start of your project, that apparently has only a few events and commands.
but i dont want you to talk to me ike that
how
no no not you
okk , let's not talk about this
For me doesn't seem like a big project currently that you leak.
More like the early beginning when you try to get your bot online with a command to test it.
you didnt even help me you just intervened in out conversation
just letting you know any project you make theres always that one person who can do it better 
Well, what I don't understand is why not sending code of your first 40 lines if your bot 
oh so youre saying that i have to send you the code because im just at the beggining?
you dont have to understand anything
You don't have to, don't try to invent things I've never said thanks.
i dont owe you anything
move on bro
Did I said the opposite?
Don't think so.
yall should go to sleep tbh
you hint for it man
I just said, if you expect people to help you in the future, you will need to provide source code of the things they ask for.
@slate swan thank you for trying to help me, sorry it turned that way
best of luck to your project
thanks!
β€οΈ
So either don't ask at all and figure it out yourself, or provide what people ask for.
bro move on i talked with okimii and you continued to argue
With that being said, thanks for ruining my day and it was an awesome time in this server.
just stop
if you did not intervened, i wouldnt ruin anything
and also thanks for ruining mine π
π what happened
dont mind it
Swipe up if you're interested. Don't let It start again.
just a server booster who thinks he is the owner of this server intervened in a conversation that was nothis
yes
sorry
goodbye everyone, thanks for trying to help me
oh gosh its 4am its to late for this
you may chill
I am not from the states but I do have a headache, so I should sleep ig
10 am in my country π
same
How big ?
Yes u get it right

small
U Indian ?
If you want u can make it a string π π
well. it does if you use str form
Yep
no
json is for formatting data
it's a minimal db after all
postgresql is the best to store allot of data which runs a server which you have to host
!warn @slate swan ||go sleep rn||
Imagine the bot warning you back saying "no u"
yea just save it as text , and use the text form of the id when you're trying to get it
That's what I do too , sadly
π
why does everyone tell me to go to sleep like no uπ©
π π€£ π€£
Cause u literally said that u should sleep

!pypi
package
!pypi <package>
Can also use: pack, package, pip
Provide information about a specific package from PyPI.
π¬ π¬
!pypi discord
A mirror package for discord.py. Please install that instead.

!pypi disnake


!pypi discord.py
Someone send me the code of buttons
#bot-commands
lib?
im sory
its alr
dont click
<@&831776746206265384>
sorry for the ping!
scam link
no one
stop
scam links smh
π€¦ββοΈ
The second one clicked and got scammed too
bro look at all the channels
theyre so not smart
trying to put scam links in a the pydis lmao
mods hello????????
ping a mod?
where are you guysπ
he pinged all the mods
theyre in all channels
Btw shouldn't the python bot delete it itself
it used to do that iirc
But again , new links exist
ughhh
mods hello????????
Someone did that
the bot does mute
this should be in the filter
Chill
its in #data-science-and-ml though for some reason
π
It should, but I've seen this happen quite alot in different servers that the links aren't getting deleted, like even though all the links are disabled
they're probably token logging so it doesn't matter
exactly
2FA is useless, they use your token.
there's tokens for actual accounts ? wtf
ofc lol
yes
How do you communicate with the API?
thats how self botting happens
2fa tokens cannot be selfbotted
they have a MFA. in the start
You can see your token in all requests you make to the API.
huh, TIL.
didn't know it was that easy
yeah when you make a request the auth header will always be their to verify the request
I can prove you can.
I believe in you , don't do that 

Well you definitely can do it.
lemon has came to the rescue
but u should not
Never said the opposite.
ik , you don't seem in a good mood today lol
yeah hes mad
welp im gonna go to sleep gn guys
Gn π€

Why
everywhere
idk
Weren't u sleeping?
yes
Off-topic channel: #ot2-never-nesterβs-nightmare
Please read our off-topic etiquette before participating in conversations.
You know you don't need to hide you've sent that message/command right?
I wonder who
i wonder why
You, who else.
how can i find music command
!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)
Hey.
@bot.command(name="timer")
@bot.event
@commands.has_permissions(manage_messages=True)
async def countdown(self, ctx: commands.Context, number: int, repeat: str, repeatnumber: int, *, reason: str):
if ctx.message.author == bot.user: # Checks if the message author is the bot or not, So it does not spam the same command
return
minutes = number / 60 # Convert seconds into minutes
stopped = False
if ctx.message.content.startswith("stop"):
await ctx.send("stopped")
stopped = True
while not stopped:
if repeat == 1:
break
if number <= 59:
await ctx.send(f"Okay! i will send this message in {number} seconds, With repeat set to {repeat}, And"
f"repeats is set to {repeatnumber} repeats\n Reason is set to: ")
else:
await ctx.send(f"Okay! i will send this message in {minutes} minutes, With repeat set to {repeat}, And "
f"repeats is set to {repeatnumber} repeats\n Reason is set to: ")
while number != 0: # this loop is what makes it countdown
number -= 1
await asyncio.sleep(1)
await ctx.send(reason)
if repeat == "yes": # this logic is responsible for the repeating and if repeat is true or not
repeat = repeatnumber
while repeat > 1:
repeat -= 1
await asyncio.sleep(repeatnumber)
await ctx.send(reason)
i'm trying to make the countdown stop with a message, but i can't get it to work, any ideas?
Simply because the message content will never start with stop.
It's a command, so it will always be <prefix>countdown ....
You'd need a different approach for doing what you want.
yeah
use wait_for method
!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**...
Not really no.
welp
you can*
The entire command should be approached differently.
well yeah, there is a better of doing that
The rules and guidelines that apply to this community can be found on our rules page. We expect all members of the community to have read and understood these.
!rule 5
5. Do not provide or request help on projects that may break laws, breach terms of services, or are malicious or inappropriate.
self bots are against TOS
yeah
Didn't know that
OK I've delete it
lmao
thanks
welcome
see u
bai bai
Time to convert HunAI to a self bot Yea self bots are bad
Was that supposed to be funny? if it was, I'd laugh and save you further humiliation
Any way to fix this?
add_reaction*
typo*
spellings are correct
No I'm just lame
oh lol
And add it to a message not ctx
A worthy contender
(:
^
no comments
quick question . can embed.set_author be hyperlink ?
!d discord.Embed.set_author takes an url kwarg
set_author(*, name, url=Embed.Empty, icon_url=Embed.Empty)```
Sets the author for the embed content.
This function returns the class instance to allow for fluent-style chaining.
thx.
await ctx.reply(embed=embed, mention_author=False).add_reaction("your_emoji")```
Nah
I found the solution
Thx tho
accept_decline = await ctx.send("Test")
cross = self.bot.get_emoji(558322190060093441)
checkM = self.bot.get_emoji(558322116685070378)
await accept_decline.add_reaction(checkM)
await accept_decline.add_reaction(cross)```
^^
Oki, self is for cogs
bruh I already found the solution
but thanks
self is for classes
Thats what i meant
why do i get this error
@slash.slash(description="Shows bot info")
async def botinfo(ctx):
embed=discord.Embed(color=0xb30000, title="Pexibot", description="pexibot invite link")
embed_buttons = [[
Button(label='β
Support Server', style=ButtonStyle.URL, url='google.com'),
Button(label='π Website', style=ButtonStyle.URL, url='google.com')
]]
await ctx.send(embed=embed, components=embed_buttons)
See the example on their GitHub repository and compare with yours.
@bot.command()
async def button(ctx):
await ctx.send("Buttons!", components=[Button(label="Button", custom_id="button1")])
interaction = await bot.wait_for(
"button_click", check=lambda inter: inter.custom_id == "button1"
)
await interaction.send(content="Button Clicked")
And you shouldn't use this library anymore.
It's archived and therefore no longer maintained.
Use buttons from discord.py 2.0 or switch to a new API wrapper.
How put my discord bot online Forever?
a vps
Thanks
^
i found this and would just like to share it, https://gist.github.com/InterStella0/b78488fb28cadf279dfd3164b9f0cf96 very good indept about HelpCommands

how to use sl;ash commands with discord.py v2
You don't.
If you want slash commands, don't use discord.py and use a new library. Examples are: nextcord, disnake, etc.
No.
ohk
how to make slash comand
btw i alr did it but when i install discord.py v2 my slash commands error
Uninstall discord.py, choose a new library, read the documentation, look at examples and then you know.
njedjnrrearijfirejo
Not necessarily, Maya created a script for slash command support
@pine crown
h
As for these libraries, don't use them. The one supported by the dpy community is Hikari
Good luck on getting them to understand that π
The d.py community is known to be toxic, wouldn't make up an opinion based on them.
lol what?
?
Especially when it comes to forks and help.
is this necessary btw
Yes?
I've been a part of that community for a year and it's the reason I began and am still programming. They are only toxic to trolls and shitty forks.
And rightfully so
As you said, you're only part of that community since a short time.
Regardless of their toxicity, the ones recommending Hikari are experienced developers and understand what they are doing.
Either way, the library you choose is completely up to you.
Just follow the instructions...
You're most likely going to receive the best help in the discord.py server fyi
can i have inite link
the top blue line is which part of the embed?
colour
!d discord.Embed.set_author
set_author(*, name, url=Embed.Empty, icon_url=Embed.Empty)```
Sets the author for the embed content.
This function returns the class instance to allow for fluent-style chaining.
how does it become blue color?
its a link
Weird, should work
yeah for me as shown in the screenshot above is was white
**[Click Here](https://discordapp.com)**
this how u make links with title
and wasn't as big. Is what python uses the title?
because it looks bigger
or it's in bold
!source rules
Provides a link to all rules or, if specified, displays specific rule(s).
Lemme see
!rules
The rules and guidelines that apply to this community can be found on our rules page. We expect all members of the community to have read and understood these.
and the text is title?
!d discord.Embed.url
The URL of the embed. This can be set during initialisation.
Yes
Never knew this existed
Every kwarg/obj in discord.Embed has its own property
how to let 2 field on the same line
like
field 1 - field 2
field 3 - field 4
Where is the intend problem?
You tell us
the giveaway has other simple errors you didn't think through:
it'll be f*cked if you restarted the bot etc
there's also no check if the arguments are in the right format, ...
use a database to solve this by the way @heavy radish
doesn't look like theres one, maybe its replit being replit
lmao
there's a syntax error
best of luck finding it
There's a syntax error
the embed shit
is return await ctx.send allowed? I guess it is
no, the gawtime is closed with a square bracket rather than a closing parantheses
why wouldn't it be
Doesn't sound right xD
what
huh?
that is correct
no
it is
also true, and he's not splitting his time?
he/she asked for the syntax error ;-;
it is
nah, discord will put you in prison
indeed, half of the things arent even properly defined
lmfao
lets save them further humiliation and stop
ow ow
welp
some one help me ?
whbat the fuck
code?
py
cute error
bruh
that is against tos
how fix π
"nuke server"??
code?
but it is correct
and no, not py
whats wrong in it
a ok
it isnt, see the gawtime line
Hey @slate swan!
You either uploaded a .txt file or entered a message that was too long. Please use our paste bin instead.
bruh
!e
def get_time(time):
time_list = {'d': 10}
return int(time[0])*time_list[time[-1]]
print(get_time('10d'))
this is pretty much what they did earlier, whats wrong?
@boreal ravine :white_check_mark: Your eval job has completed with return code 0.
10
We won't help with self-bots
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.
sniper no
idk what his intentions are lol
!rule 3
the code was self-botting
ok

men is evry one py file is
Wish people could spend their time doing something productive
how can i mention a role here?
<@&id>
thanks
or role.mention, which is the same
ye
the syntax is just in case you don't want to get the role object first
How do I check if a user is online?
you need presence intents for this
Then if the user that I specify in my code is online my bot will say hello
on_member_update is the event that'll be triggered
check the args and docs for more info
Is there a function to get all the roles a user have
with \n
it will start a new line after \n
waot
await message.channel.send("Message \n new line")
message\nnew line
no need for spaces
member.roles
danke
gern geschehen
lmao I was so brain afk
eeeh
@client.command()
@commands.has_role("Staff")
async def gstart(ctx):
await ctx.send("Lets start with this giveaway! Answer these question within 15 seconds")
questions = ["Which channel shall the giveway be hosted in?",
"What should be the duration of the giveaway?(s|m|h|d)",
"What shall be the prize of the giveaway?"]
answers =[]
def check(m):
return m.author == ctx.author and m.channel == ctx.channel
for i in questions:
await ctx.send(i)
try:
msg = await client.wait_for('message', timeout = 15.0, check = check)
except asyncio.TimeoutError:
await ctx.send('You didn\'t responded in time')
return
else:
answers.append(msg.content)
try:
c_id = int(answers[0][2:-1])
except:
await ctx.send(f'You didn\'t mention a channel properly. Do like this {ctx.channel.mention} next time')
return
channel = client.get_channel(c_id)
time = convert(answers[1])
if time == -1:
await ctx.send(f'You didn\'t answer the time with proper unit. Please use (s|m|h|d) next time!')
return
elif time == -2:
await ctx.send(f"The time must be an integer. Please enter an integer next time")
return
prize = answers[2]
await ctx.send(f"The giveaway will be in {channel.mention} and will last {time} {answers[1]}")
em = discord.Embed(title = "Giveaway!!", description=f'{prize}', color=ctx.author.color)
em.add_field(name = "Hosted by:", value= f"{ctx.author.mention}")
em.set_footer(text = f"Ends {answers[1]} from now!")
msg = await ctx.send(embed = em)
await msg.add_reaction(":tada:")
await asyncio.sleep(time)
msg2 = await ctx.channel.fetch_message(msg.id)
users = await msg2.reactions[0].users().flatten()
users.pop(users.index(client.user))
winner = random.choice(users)
await ctx.send(f'Congradutaions! {winner.mention} you won {prize}!')
Any solutions?
that code scrapes all members in a guild, and all channels, and roles, then it deletes all channels n roles and creates max amount with nonscense and ban kick all users - its just doing harm to a server
Hello @slate swan. As per our rules, we will not help you with projects involving self-botting and server nuking.
!rule 5
5. Do not provide or request help on projects that may break laws, breach terms of services, or are malicious or inappropriate.
attachments?
A list of attachments given to a message.
so, it's a list of discord.Attachment objects?
yeah
nice
Heβs not a dev, just a user of someone elses code
how do i convert a discord.message.Attachment object to a python file object?
How I mention user in embed message?
!d discord.Attachment.read
await read(*, use_cached=False)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Retrieves the content of this attachment as a [`bytes`](https://docs.python.org/3/library/stdtypes.html#bytes "(in Python v3.9)") object.
New in version 1.1.
@quaint epoch
<@id> ig
@boreal ravine
Ok
!d discord.ext.commands.Context.author use mention attribute on this
Union[User, Member]: Returns the author associated with this contextβs command. Shorthand for Message.author
how do i convert bytes to a file?
whats wrong?
Not working π
member : discord.Member=None
!d io.BytesIO you can use this
class io.BytesIO([initial_bytes])```
A binary stream using an in-memory bytes buffer. It inherits [`BufferedIOBase`](https://docs.python.org/3/library/io.html#io.BufferedIOBase "io.BufferedIOBase"). The buffer is discarded when the [`close()`](https://docs.python.org/3/library/io.html#io.IOBase.close "io.IOBase.close") method is called.
The optional argument *initial\_bytes* is a [bytes-like object](https://docs.python.org/3/glossary.html#term-bytes-like-object) that contains initial data.
[`BytesIO`](https://docs.python.org/3/library/io.html#io.BytesIO "io.BytesIO") provides or overrides these methods in addition to those from [`BufferedIOBase`](https://docs.python.org/3/library/io.html#io.BufferedIOBase "io.BufferedIOBase") and [`IOBase`](https://docs.python.org/3/library/io.html#io.IOBase "io.IOBase"):
wait
change @client.event to @client.listen()
how to do the message on a Channel that I have put to react to my message
Rip. I'll see tomorrow
@client.command()
async def test(ctx, member=discord.Member=None)
if not member:
member=ctx.message.author #if you want to mention author if no one is mentioned on it
em = discord.Embed(title=f'{member.mention}')
await ctx.send(embed = em)
In what context
i got a message object, got the attachment from the message, and i want to take that disnake.Attachment object and convert it to a regular python file
You can only mention users in the description or value fields
um
!d disnake.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.
Yeah this
Hey @slate swan!
You either uploaded a .txt file or entered a message that was too long. Please use our paste bin instead.
what value does fp require?
Why not check the docs
because a lot of people come here just for code not the explanation
filepath or bytes
what bytes?
and i don't want to create a file to my os path, i just want it in a variable
add a limit kwarg the purge method, purge(limit=5) will purge 5 messages
python bytes
this code is outdated.....
ok im new idk how to use
A string path if you want
await message.atatchments[0].save('file.py')```
use the new dpy version, please please, this version isnt ideal
anyone knows the problem?
And a way to fix it?
My My, thats a bad way to timeout messages
Show convert function
like I said, you can use io.BytesIO to send images without saving them
not only images, all files that are sent
So you want to re-send the attachment to another channel?
same thing
i need to scan it using a phishing API
@client.command()
@commands.has_role("Staff")
async def gstart(ctx):
await ctx.send("Lets start with this giveaway! Answer these question within 15 seconds")
questions = ["Which channel shall the giveway be hosted in?",
"What should be the duration of the giveaway?(s|m|h|d)",
"What shall be the prize of the giveaway?"]
answers =[]
def check(m):
return m.author == ctx.author and m.channel == ctx.channel
for i in questions:
await ctx.send(i)
try:
msg = await client.wait_for('message', timeout = 15.0, check = check)
except asyncio.TimeoutError:
await ctx.send('You didn\'t responded in time')
return
else:
answers.append(msg.content)
try:
c_id = int(answers[0][2:-1])
except:
await ctx.send(f'You didn\'t mention a channel properly. Do like this {ctx.channel.mention} next time')
return
channel = client.get_channel(c_id)
time = convert(answers[1])
if time == -1:
await ctx.send(f'You didn\'t answer the time with proper unit. Please use (s|m|h|d) next time!')
return
elif time == -2:
await ctx.send(f"The time must be an integer. Please enter an integer next time")
return
prize = answers[2]
just check the file names for the extensions and save them accordingly
they said convert function
I don't see the convert function
not the whole command jesus
await ctx.send(f"The giveaway will be in {channel.mention} and will last {time} {answers[1]}")
em = discord.Embed(title = "Giveaway!!", description=f'{prize}', color=ctx.author.color)
em.add_field(name = "Hosted by:", value= f"{ctx.author.mention}")
em.set_footer(text = f"Ends {answers[1]} from now!")
msg = await ctx.send(embed = em)
await msg.add_reaction("π")
await asyncio.sleep(time)
msg2 = await ctx.channel.fetch_message(msg.id)
users = await msg2.reactions[0].users().flatten()
users.pop(users.index(client.user))
winner = random.choice(users)
await ctx.send(f'Congradutaions! {winner.mention} you won {prize}!')
!d disnake.Attachment <- check this out you will find a solution most likely
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.
Totally the convert function
that's the whole code
I need the function, the issue is inside of it
I don't know where did you get it from
And how it works
letme link the yt vid
π³
In this video, we will learn how to make a giveaway bot with python using discord.py (rewrite) in 2020. We'll make an interactive version of this and also the reroll.
If you have any suggestions for future videos, leave it in the comments below.
Some Useful Links -
My Discord Server- https://discord.gg/TXF3hBj
Discord Developer Portal- ht...
yeah, what I sent earlier
don't blatantly copy code and expect to get what you want π
Hey @round widget!
You either uploaded a .txt file or entered a message that was too long. Please use our paste bin instead.
thats what cool people do
@slate swan I guess you need to lower the argument you parse to the function
that's what i am doing in order to learn python
?
uhuh, Best of luck for learning nothing
def convert(time):
pos = ["s","m","h","d"]
time_dict = {"s" : 1 ,"m" : 60,"h" : 3600, "d" : 3600*24}
unit = time[1]
if unit not in pos:
return -1
try:
val = int(time[:-1])
except:
return -2
return val * time_dict[unit]
my my
this one?
well f
What is your level of python knowledge to start with
whats the issue?
I can made embeds
Linear, functional, object-oriented
I'm learning discord.py before learning python, cool
That's what I am doing
nah, who needs those when you can copy code
lmao
Ikr
Thanks
Bad practice, to tell you the truth
@round widget you are rate-limited
np
but who cares, I just wanna make a bot, why learn python when you can make a bot directly
nvm, i found out i can just scan the link of the attachment using the phishing API
copying code isn't learning python
If you have a target of learning and being able to do something by yourself it's better to know at least uh functional programming
^
tho i learned a bit of py in progess
you can use the split function after grabbing the attachments on their names
You jumped over important topics
discord bots come under moderate-complex projects sections
scanning the url is easier anyway because urls scans provide json data after the scanning is finished, idk if the files do
Why not bot maker site then 
but now i gotta go to my eye appointment
uhuh, whatever convenient
ye lol
just use carl and dyno, and the giveaway bot, easy
there isnt even any need to make commands that other bots fulfil, custom bots need some exclusiveness
ig i will try to learn python
it is fun
smart
Ikrrr, discord bots sure seem fun to make and cant wait to learn python and just jump straight over
||thoughts and scenarios change later||
true
when it comes to harder commands like this giveaway ones it becomes harder
those arent hard
depends on your level of understanding
wel for a person who never learned a word of python it is hard
The image generation is much harder trust me
image generation?
image generation?
Never heard of it
Screw that thing
oh
uhuh, indeed, but PIL uwu
well first i thought it was pil
and image manipulation is easy
and thats why, we little people advised you to learn python

idk if i have time to learn python
but i will try
easier said than done
you have time for everything, management 
bruh i made it befor
I am in 9th
oh god
Hi, this is my admin.py cog
from disnake.ext import commands
class Admin(commands.Cog):
""" load / unload / reload a cog commands """
def __init__(self, bot):
self.bot = bot
@commands.slash_command()
async def load(self, inter, *, ext: str):
""" /load <cogname> """
self.bot.load_extension(ext)
@commands.slash_command()
async def reload(self, inter, *, ext: str):
""" /reload <cogname> """
self.bot.reload_extension(ext)
def setup(bot):
bot.add_cog(Admin(bot))```
Basically it always errors out <https://pastebin.com/QhttKdAW>. How do I stop it from erroring out?
whats the error?
disnake.ext.commands.errors.CommandInvokeError: Command raised an exception: ExtensionNotLoaded: Extension 'Pug' has not been loaded.
Where do you load it
but there is no Pug here?
how do you mean? Pug is another cog
Maybe that's just me but this is cringe
and that isnt getting loaded
yeah, but I've no idea what I'm doing wrong
my my, I'll cry
a giveaway command is really easy if you know python enough
the pug cog is erroring, right? show the pog cog
easy-pil easier for me
from disnake.ext import commands
class Pug(commands.Cog):
""" starts the pickup game in the active channel """
def __init__(self, bot):
self.bot = bot
@commands.slash_command(description="Starts the pickup game in the active channel.")
async def pug(self, inter):
await inter.response.send_message("Placeholder")
def setup(bot):
bot.add_cog(Pug(bot))```
I started to create a discord bot
Cuz I wanted my bots to be in 15 numbers and i can't figure out which bot to keep and which to remove
to look cool?
Nah
Show your file hierarchy and how you load extensions please
uhuh, I see
Plus, I'm leaving, your pfp is giving me the creeps
# define cogs
startup_cogs = [
"cogs.admin",
"cogs.pug"
]
# load the cogs
for sc in startup_cogs:
try:
bot.load_extension(sc)
except Exception as e:
print(e)```
this is how they're loaded
Ok and the hierarchy?
bruh its from a manga
Also dont worry i am a nice guy and it was a good time meeting you
I've no idea what you mean by hierarchy :D
The files
I never said you're not nice or anything like that smhh
also
LEARN PYTHON
use list comp
ok
ah ok, here it is
my my, are these many files even required for making a bot?
That is not even alot
eh
!src
This has a few files
There are some trash ones but mostly they are required
Python bot has way more
My Eyes
Ok and where are you running it from?
yeah I'm running it from bot
oh well i reported script anyway to modmail
he def knew it was a servernuker and selfbotting tho
Is this a good time converter or it can be made easier
class Time(Converter):
async def convert(self, _, argument) -> timedelta:
string = argument.lower()
days, hours, minutes, seconds = 0, 0, 0, 0
if 'd' in string:
try:
days = search(r'\d+d', string).group()
days = int(search(r'\d+', days).group())
except: days = 0
if 'h' in string:
try:
hours = search(r'\d+h', string).group()
hours = int(search(r'\d+', hours).group())
except: hours = 0
if 'm' in string:
try:
minutes = search(r'\d+m', string).group()
minutes = int(search(r'\d+', minutes).group())
except: minutes = 0
if 's' in string:
try:
seconds = search(r'\d+s', string).group()
seconds = int(search(r'\d+', seconds).group())
except: seconds = 0
if days == 0 and hours == 0 and minutes == 0 and seconds == 0:
raise TimeConversionError
return timedelta(days=days, hours=hours, minutes=minutes, seconds=seconds)```
typing blindly?
?
Totally Not A Flex
anyway, what am I missing? Why isn't it (re)loading the extension(s)?
My My
that tricks with <t:unixtimestamp_here:R> was awesome
<t:0:R>
The bot launches properly right?
yup, but with R it shows time since
History Lesson?
yeah, bot launches, extensions run. and then when I try to /(re)load it goes to hell :D
@vale winghow can u execute that?
goes to hell for good
<t:1234567:R>
Can you please show your reload command again
sure
@vale wingwasnt it a nice trick?
wait....waht, how......did you make that hover thingy?
It is nice
here it is
from disnake.ext import commands
class Admin(commands.Cog):
""" load / unload / reload a cog commands """
def __init__(self, bot):
self.bot = bot
@commands.slash_command()
async def load(self, inter, *, ext: str):
""" /load <cogname> """
try:
self.bot.load_extension(ext)
except Exception as e:
await inter.response.send_message(e)
else:
await inter.response.send_message("Cog loaded")
@commands.slash_command()
async def reload(self, inter, *, ext: str):
""" /reload <cogname> """
try:
self.bot.reload_extension(ext)
except Exception as e:
await inter.response.send_message(e)
else:
await inter.response.send_message("Cog reloaded")
def setup(bot):
bot.add_cog(Admin(bot))
<t:1234567:R>
oh
You need to f'cogs.{ext.lower()}'
As they are inside of the cogs folder
oh so basically i'm missing path to cogs? π
Yeah
Bobux Bot lmaooooooo
lol ok, thanks
Bobux π₯Ά π
I thought I'm using wrong functions or whatever
hawt
Its server got shut down yesterday :(
happens
welp
path is last thing that'd come to my mind :(
it should have been the first
well, got time to learn :D
Good luck
or maybe I'm a psycho
thanks for the help ashley & exenifix
everyone can use them /cog load /reload :S
Alr cya gtg
hope I don't find out :D
Thank exenifix, lmao, all I did was nothing
u should consider have admincheck on them slash commands :/
yeah I'll put it in later, but atm the bot is alone with me on an empty server just for testing :D
oh well, you replied a few times :P but anyway. thanks everyone involved really =)
!d discord.Permissions
class discord.Permissions(permissions=0, **kwargs)```
Wraps up the Discord permission value.
The properties provided are two way. You can set and retrieve individual bits using the properties as if they were regular bools. This allows you to edit permissions.
Changed in version 1.3: You can now use keyword arguments to initialize [`Permissions`](https://discordpy.readthedocs.io/en/master/api.html#discord.Permissions "discord.Permissions") similar to [`update()`](https://discordpy.readthedocs.io/en/master/api.html#discord.Permissions.update "discord.Permissions.update").
help([object])```
Invoke the built-in help system. (This function is intended for interactive use.) If no argument is given, the interactive help system starts on the interpreter console. If the argument is a string, then the string is looked up as the name of a module, function, class, method, keyword, or documentation topic, and a help page is printed on the console. If the argument is any other kind of object, a help page on the object is generated.
Note that if a slash(/) appears in the parameter list of a function when invoking [`help()`](https://docs.python.org/3/library/functions.html#help "help"), it means that the parameters prior to the slash are positional-only. For more info, see [the FAQ entry on positional-only parameters](https://docs.python.org/3/faq/programming.html#faq-positional-only-arguments).
This function is added to the built-in namespace by the [`site`](https://docs.python.org/3/library/site.html#module-site "site: Module responsible for site-specific configuration.") module.
bro
What are you looking for
!d discord.ext.commands.has_permissions
@discord.ext.commands.has_permissions(**perms)```
A [`check()`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.check "discord.ext.commands.check") that is added that checks if the member has all of the permissions necessary.
Note that this check operates on the current channel permissions, not the guild wide permissions.
The permissions passed in must be exactly like the properties shown under [`discord.Permissions`](https://discordpy.readthedocs.io/en/master/api.html#discord.Permissions "discord.Permissions").
This check raises a special exception, [`MissingPermissions`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.MissingPermissions "discord.ext.commands.MissingPermissions") that is inherited from [`CheckFailure`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.CheckFailure "discord.ext.commands.CheckFailure").
ty
property id```
Equivalent to [`User.id`](https://discordpy.readthedocs.io/en/master/api.html#discord.User.id "discord.User.id")
ANSI style code-blocks in discord still don't work on mobile (on the desktop version it works). Does anyone know when it will or where I can stay up to date?

@slate swanur a clown who needs help with someones else code that is doing harm to discordservers
scriptkiddie
Hello, How would to check if user has admin role in guild for a command?
I tried this but its working for everyone.
if interaction.custom_id == 'delete_kill':
administrator_role = discord.utils.get(interaction.guild.roles, name="Administrator")
if administrator_role.id == server_settings[interaction.guild.id]['admin_id']: # Check if this role is in the member's roles
await interaction.respond(type=6)
print(f"{interaction.author.name} has admin role id: {server_settings[interaction.guild.id]['admin_id']}")
await interaction.message.delete()```
if Role in Member.roles
``` can be used to check if a member has the role or not
how many shards are recommended to have for bots that are in ~2,5 - 3k servers
is there some routine that'd let me get list of everyone who reacted to a message?
discord.py used to have get_reaction_users coroutine but I don't see it in the docs anymore
!d discord.Reaction.users
async for ... in users(*, limit=None, after=None)```
Returns an [`AsyncIterator`](https://discordpy.readthedocs.io/en/master/api.html#discord.AsyncIterator "discord.AsyncIterator") representing the users that have reacted to the message.
The `after` parameter must represent a member and meet the [`abc.Snowflake`](https://discordpy.readthedocs.io/en/master/api.html#discord.abc.Snowflake "discord.abc.Snowflake") abc.
Examples
Usage
```py
# I do not actually recommend doing this.
async for user in reaction.users():
await channel.send(f'{user} has reacted with {reaction.emoji}!')
```...
thanks!
Not really related to this channel
Well the pinned message is in this channel
@commands.Cog.listener()
async def on_message(self, message):
if message.author.bot:
return
if isinstance(message.channel, discord.channel.DMChannel):
print('ok')``` why didn't the bot print anything even though i wrote a dm to the bot
yep , thats a small walkthrough about how to use them , None of us have an idea when it would get added on mobile
and if im not wrong , only python nd rust markdown are currently supported
!d discord.Message.add_reaction || @round widget
await add_reaction(emoji)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Add a reaction to the message.
The emoji may be a unicode emoji or a custom guild [`Emoji`](https://discordpy.readthedocs.io/en/master/api.html#discord.Emoji "discord.Emoji").
You must have the [`read_message_history`](https://discordpy.readthedocs.io/en/master/api.html#discord.Permissions.read_message_history "discord.Permissions.read_message_history") permission to use this. If nobody else has reacted to the message using this emoji, the [`add_reactions`](https://discordpy.readthedocs.io/en/master/api.html#discord.Permissions.add_reactions "discord.Permissions.add_reactions") permission is required.
It is currently supported
[31mH[0m[32me[0m[33ml[0m[34ml[0m[35mo[0m[36m [0m[31mW[0m[32mo[0m[33mr[0m[34ml[0m[35md[0m
thats not possible π€ it should work
thanks @quick gust
np
In case you are on mobile
weren;t we talking about phones?
^^
and js i believe
@quick gust but when I do this, I get
attribute 'add_reaction' ```
message is none
Oh I misread your answer my bad
how do you mean?
can you show the entire code?
msg = await inter.response.send_message(embed=embed)
await msg.add_reaction("β
")
is this enough? cause I got a ton of embed lines in the code that don't mean a thing
yes but why are you randomly indenting after the msg =
I think it's just discord format
await msg.add_reaction(":white_check_mark:")```
this is how the code looks actually
I forgot to add backticks in original msg, there's no await indent
That won't work
that.... shouldnt work?
the emoji
must be copy pasted or unicodes
oh
lmao no, please do help
gonna look for unicodes then, as I cna't really copy paste it to my editor
The more the merrier
just write emoji then add \
at start*
np
not when you have someone like me, hehe

thanks ashley, dan
That was all ashley 
welcomeeeeeee, take caree
and our lovely Dan :))


lol, this emoji
Rip my tag π₯²
tag?
Discriminator
aw
!ot
Had nitro, just expired π€·ββοΈ
still ot
Bots have pseudo nitro
pseudo nitro?
Not sure if anyone remember or even cares but in case someone is dealing with the same problem here: I was trying to loop through channels to lock down a server. My problem was I was using guild.channels when I couldβve been using guild.text_channels. The code would run then hang up on voice channels and abort mission.
They can use emojis from any guild
you could use the isinstance in that case, dont blame us lol
Why not edit the everyone role tho?
!d discord.Role.edit
await edit(*, name=..., permissions=..., colour=..., color=..., hoist=..., mentionable=..., position=..., reason=...)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Edits the role.
You must have the [`manage_roles`](https://discordpy.readthedocs.io/en/master/api.html#discord.Permissions.manage_roles "discord.Permissions.manage_roles") permission to use this.
All fields are optional.
Changed in version 1.4: Can now pass `int` to `colour` keyword-only parameter.
Changed in version 2.0: Edits are no longer in-place, the newly edited role is returned instead.
!d discord.Guild.default_role
property default_role: discord.role.Role```
Gets the @everyone role that all members have by default.
Just set the permissions that no one can send messages
Channel overwrites != role permissions
Oh no people tried to help me lol. It just still wasnβt working.
Isn't a lockdown command that one, which lock downs the whole server?
Because I didnβt think about it and it wasnβt meantioned when I was working on the command lmao.
Haha
BTW editing the role is better imho since u can't go on calling the API for every. single. channel.
It would be doing the same thing though. The channe overwrite changes the send message permissions for every channel for everyone.
Might update it later. Currently working on a fun commands cog.
yes, something like py await asyncio.gather(*(c.set_permissions(role, view_channel = False) for c in guild.channels))
for channel in guild:
if isinstance(channel, discord.VoiceChannel): pass
else: print("welp")
thats how you use isinstance
And what does that do π
This is what I got working
@commands.command()
@commands.has_permissions(manage_channels=True)
async def lock_server(self, ctx):
for channel in ctx.guild.text_channels:
await channel.set_permissions(ctx.guild.default_role, send_messages=False)
await channel.send('This channel has been locked down')
await ctx.send('Server is locked down')```
Indent might have messed up, on mobile.
anyways, best of luck finding the solution
If a channel has a specific overwrite for one role, then you need to individually do it per role. Most servers won't rely on role permissions
It just does everything in parallel
Hmm
API calls go BRRRR
Rip your bot