#discord-bots
1 messages · Page 893 of 1
Why even use heroku 
people say its good
Well, if u r okay with yr bot dying for 8-9 days every month, then go on
Me with two accounts

nvmd its fix
hu?
?
No idea who Dyno is
no

@nimble plume
Ah, I thought u were, since u came all of a sudden and was talking about Heroku, sorry
! [remote rejected] master -> master (pre-receive hook declined)
what i use for free
Idk, never used beroku
does anyone know what is nextcord slash command text channel name? i use channel: nextcord.TextChannel in nextcord slash command, and i got error
beroku
Yo Hunter, Ash. Do you know how to create a custom event?
custom event?
yeah it is driving me crazy
bot.dispatch()
lets google whats that
@placid skiff ^^^
guys my prob
what is this?
internals
class queueView(View):
@nextcord.ui.button(label="Skip", style=nextcord.ButtonStyle.green)
async def button_callback(self, button, interaction):
await interaction.guild.voice_client.stop()
await interaction.response.send_message(embed=nextcord.Embed(title= "Skip", description="Skipped!", color=nextcord.Colour.random()))
@nextcord.ui.button(label="Pause", style=nextcord.ButtonStyle.green)
async def button_callback(self, button, interaction):
await interaction.guild.voice_client.pause()
await interaction.response.send_message(embed=nextcord.Embed(title= "Pause", description="Music has been paused!", color=nextcord.Colour.random()))
@nextcord.ui.button(label="Resume", style=nextcord.ButtonStyle.green)
async def button_callback(self, button, interaction):
await interaction.guild.voice_client.resume()
await interaction.response.send_message(embed=nextcord.Embed(title= "Resume", description="Music has resumed!", color=nextcord.Colour.random()))
``` and this
@placid skiff
@maiden fable which host u use for ur bot
which music api pls tell??
wavelink?
A friend is hosting for me
Good
@maiden fable can you help?
bruh
But why there is nothing for dispatch in disnake docs? xD
uhh help
@cosmic agate
Sorry, I am half asleep rn, can't read any code properly
how do i make an interactive button message on my bot?
I think i will need some help for this lol
Sure
Dunno how it works, there is no doc xD
Cz that isn't meant to be used by the end user haha
I mean, just use it literally like u use other events
iirc HunAI also uses that to dispatch Chat Message Events
Well i found something usefull on the internet
now i can try to use it hahaha
Mind showing?
@bot.event
async def on_message(message):
for i in badwords: # Go through the list of bad words;
if i in message.content:
await message.delete()
await message.channel.send(f"{message.author.mention} Don't use that word!")
bot.dispatch('profanity', message, i)
return # So that it doesn't try to delete the message again, which will cause an error.
await bot.process_commands(message)
i thought that it would need a coroutine as the name of the event lol
Hi, uhh
btw now i know that events are not called automatically so in the end I will need a loop that calls that event if the conditions are met
hi uhh help
Hm?
!d discord.on_member_remove
discord.on_member_join(member)``````py
discord.on_member_remove(member)```
Called when a [`Member`](https://discordpy.readthedocs.io/en/master/api.html#discord.Member "discord.Member") leaves or joins a [`Guild`](https://discordpy.readthedocs.io/en/master/api.html#discord.Guild "discord.Guild").
This requires [`Intents.members`](https://discordpy.readthedocs.io/en/master/api.html#discord.Intents.members "discord.Intents.members") to be enabled.
which database do you suggest me? i need one that can have two or more instance opened
Database for?
I want to connect a Minecraft Server (using a plugin that i will create) with discord
so it needs to store both data of discord user and minecraft player
and they will need some relations through them
uh no i meant the database thing
yeah when this event is called you delete the row of the user with using his ID
SQL or NoSQL?
Never used a NoSQL
thats what im asking, how?- i did that and it gives an error
Just like Mongo
idk if i did it correctly tho
Yeah, never used
send the code and tell us the error
NoSQL means it uses JSON like format to store data
Look into https://deta.sh or if u wanna use SQL (relational db), then look into postgresql
I know what they are hahaha
but i never used them so it will require me some time to study them, so if you really think that a NoSQL will be helpful for this project I will use it
Yeah never used this too xD
Hahaha
The query is wrong, it is:
DELETE FROM table_name WHERE condition
how do i use sqlite for my economy bot?
i used json before but there was too much lag so im trying to switch to sqlite
I think i will use MongoDB, there is more on the internet used with python
So more code to copy xD
storage issue though 
You always need to ruin everything right? :L
but i want it to delete the user_id from the uhh database
I'm cruel in everybody's eyes 
i did
DELETE user_id FROM servdata WHERE user_id = ?, (member.id,)
what did i do wrong
You can't delete a single camp, you can only delete a row (Using the DELETE query of course, but there is a way to do what you want, think of it and you will find a way :D)
im not well versed in making databases as im still a beginner 😭
Just think, you can't delete because delete can only delete a whole row
So you need to remove one single data from a row
so uhh what do i do
What do you need to do?
is there any timeout_members: bool permission in disnanke?
She's just biased towards deta since it gives u the same mongodb experience but with more storage 👀
what does the UPDATE query do?
oh
😇
no there isnt
sad
!d disnake.Permissions.moderate_members
Returns True if a user can perform limited moderation actions (timeout).
New in version 2.3.
hunter high
oh
Timeouts are considered as moderation
DELETE FROM servdata WHERE user_id = ?, (member.id,)
would delete the row with the user id
thanks
I always get confused between the two, and yea, I'm also half sleepy, soooo
make sure you remember the where condition
he wants only to delete the ID (dunno why but until he is happy i have done my work lol)
sleep is a thing
Gonna miss my doctor appointment then 
why would he only wanna delete an id
Bro i don't make questions, i solve problems
xD
bc when i do the leaderboard command and like someone on the leaderboard leaves the server it wont send it
if it's an opt out leadboard but you wanna keep their data, it would make more sense to have a list of people to skip when making the leaderboard right?
idk how to do that 😭

i
You need to use the update query... and that's two...
no i mean how to make it show the leaderboard if someone leaves
bc it just returns as a 'None' object
discord-bots 
WTF.. code
wait, if you delete their user id how do you expect to find data for the rest of the code for that person?
!rule 7 
7. Keep discussions relevant to the channel topic. Each channel's description tells you the topic.
bruh

is clearly about a discord bot
?
its about a db 
Mini-modding unnecessarily, this is well within the channel topic
a db for a discord bot
oh sure ||
||
If anything, that degenerate frog emoji is more off topic.
approaches for making dbs for discord bots are slightly different

ah yes disnanke
why won't it?
it becomes 'None'
and why is your account so new 
what becomes none?
the member object
how are you using the member object?
uhh putting their @ 's on the embed description for the leaderboard command
using .mention?
yes
do you get/fetch the user/member?
no its in the uhh on_member_leave event
wait what
oh um yes
U mean on_member_remove?
are you only using the member object to mention it?
yes
When a member leaves a guild you can't mention him anymore
and yes
you can simply do <@ID> then, theres no reason for you to get/fetch the user/member it will appear as an ID/invalid-user though if the user/member isn't cached
OHH icic ill try it !
it will print the id of the user, will not mention it anyways
it will
to mention someone he needs to be in the guild, you can't mention someone external the guild even by mentioning him like that
you can
Why everyone doubts me today
Internet cut out, sorry
How do I remove the space there?
"""Gets the info of this bot."""
me = inter.me
joinedAt = int(me.joined_at.timestamp())
uptimeStart = datetime.now()
infoEmbed = disnake.Embed(
title = me.name,
colour = disnake.Colour(0x1abc9c),
description = """:Discord: : [Support Server]()
\n:invite: : [Invite Me!]()
"""
).add_field(
name = "ID",
value = me.id
).add_field(
name = "Uptime",
value = f"{uptimeStart - datetime.now()}"
).add_field(
name = "Join Date",
value = f"<t:{joinedAt}:R>"
).add_field(
name = "Highest Role",
value = me.top_role.mention
).set_footer(
text = "Made by Player1041 with <3",
icon_url = "https://media.discordapp.net/attachments/948022693096194098/948022718547263509/pfp.jpg"
)
like I said..
the mention will appear as in ID or an
invalid-userif the user/member isn't cached
Yeah, but he wants the MENTION of the member, it is a leaderboard, what do you think he will use an invalid user mention for?
Show the code where you send the embed
- it still mentions
- idk but the command will run with no exceptions getting raised
Why are you using bulletpoints lmao
i need help
You can start by telling us what you need help with
is anyone here familiar with sqlite files?

you most likely have an error handler
#databases if your problem is largely related to sqlite
i need the sqlite storage for my discord bot thats why im here
imma go to that channel too tho
first, learn CRUD operations via SQL
then try to implement your db in the bot
preferably, an async wrapper of the db
or he can workaround like doing this:
async def on_member_remove(member: Member):
leaderboard_player_list = #list of player in leaderboard, assume that them all are already member object
await ctx.send(f"{player.mention+'\n' if player.mention is not None else player.name'\n' for player in leaderboard_player_list}")
i actually fixed it thank you so much
ok
in your case, you could use asqlite or aiosqlite or whatever, those are async wrappers of sqlite
not me
yeah, it should "error" tho, since the "invalid-user" is None, and none has no .mention attribute
unless he hardcodes the mention like <@id>
makes my messages more easier to read
i dont know what those things is but i will google them
await inter.response.send_message(embed = infoEmbed)
weird
you mean the space above the embed right?
No, the space between the two hyperlinks
oh-
Lmao
try (or just use a normal string with newlines)```py
infoEmbed = disnake.Embed(
title = me.name,
colour = disnake.Colour(0x1abc9c))
infoEmbed.description = """
:emoji:
:emoji:
"""

Actually add another line between the two
How to send a message
Type in the text box, click enter on your keyboard.
Thanks kayle
How about on mobile
It's misaligned
~~happens when you use docstrings ~~

🗿
Use newlines?
lmao
ok thx,
I wanna actually ask a question to people who has tried discord python libraries
which one is better
I mean there is nextcord, pycord and discord py are the one I know
-1 day? 😄
how the
Just restartes the bot lmao
I can't remember how to reload the commands lmao
!d discord.ext.commands.Bot.reload_extension ?
reload_extension(name, *, package=None)```
Atomically reloads an extension.
This replaces the extension with the same extension, only refreshed. This is equivalent to a [`unload_extension()`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.Bot.unload_extension "discord.ext.commands.Bot.unload_extension") followed by a [`load_extension()`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.Bot.load_extension "discord.ext.commands.Bot.load_extension") except done in an atomic way. That is, if an operation fails mid-reload then the bot will roll-back to the prior working state.
ah ye ^ but i use the two others unload n load ^^
that unloads and loads lol not sure why you would
lol
is discord.py going to stop working?
That adds a gap between the lines which I don't want lmao
no
I should have read farther
If there isn't a stable release by April 30th.
Because the API version it's on (7) is being decommissioned on the 30th April, meaning it won't work.
yay thx
confused
it probably will if its not ready by the time Danny wouldve missed his whole point as he wanted dpy to be useable after the api update
no, it's for anything related to discord bots (read channel description)
he is aparently back n taking on the project again
Yeha, that's what I meant lmao
ok thx, but which one is more comfortable to work with?
disnake <- is up to date atleast
It's all down to personal preference
I recommend trying out various libraries and see which works best for tou
using a fork when the original library is maintained 
Barely maintained.
but its behind
It's 3 API versions behind and has no stable support for anything the forks have
still usable
All the interaction shit (slash commands, timeouts, modals, etc) has no stable support
and still lacking functions
such as?
uh
they already have all the functions/methods for those
i would honestly just go with hikari at this point 1. you dont know if the situation will happen again with dpy 2. forks are now different compared to main.
I tried discord.py, nextcord and found that discord.py has more tutorials to learn from
it sounds like they just wanna catch up with the api then park it again
Disnake has a guide in the works too, plus most of the dpy shit can be adapted to forks
can you pls give me a link for disnake guide
true
It's not fully finished but it's got the basics
thank you
Np
How do you set footer icon again?
is it enough if I know the python basics to start with bot development?
icon_url = url @final shard
more examples, https://github.com/DisnakeDev/disnake/tree/master/examples
ok
thanks
Yeah I'd say you're fine to do bot dev
thanks
does pycord have case insensitive prefix?
What's the easiest way to convert User obj -> Member obj
member = guild.get_member(user.id) ?
iirc, nope
why would it matter if User is the parent class of member?
Because user doesn't have some of the attributes & methods of Member
depends on the situation tbh
so the only way is: ("a", "A") ?
Yea
a tuple in prefix yes
How so, a user is always a User object, and a member is always a Member object
They have differences in attributes
i ment depends on what attrs he wants to access
no, because you will be stuck on simple python errors and you will most likely not understand anything and copy code (what 90% of python beginners do when using d.py) 
If they want to convert a User to Member I'm pretty sure they want to access an attribute under members
yes
who knows
mostly attribute errors
Mostly Exception since every python exception inherits the Exception class 
loool
Except Exception inherits BaseException
So if you look at errors such as ValueError and TypeError you'd see BaseException in the MRO
How to reply to a message (This question is a ruse i need help with ebay)
!d discord.Message.reply
await reply(content=None, **kwargs)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
A shortcut method to [`abc.Messageable.send()`](https://discordpy.readthedocs.io/en/master/api.html#discord.abc.Messageable.send "discord.abc.Messageable.send") to reply to the [`Message`](https://discordpy.readthedocs.io/en/master/api.html#discord.Message "discord.Message").
New in version 1.6.
Changed in version 2.0: This function no-longer raises `InvalidArgument` instead raising [`ValueError`](https://docs.python.org/3/library/exceptions.html#ValueError "(in Python v3.10)") or [`TypeError`](https://docs.python.org/3/library/exceptions.html#TypeError "(in Python v3.10)") in various cases.
!d discord.ext.commands.Context.reply as well
await reply(content=None, **kwargs)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
A shortcut method to [`abc.Messageable.send()`](https://discordpy.readthedocs.io/en/master/api.html#discord.abc.Messageable.send "discord.abc.Messageable.send") to reply to the [`Message`](https://discordpy.readthedocs.io/en/master/api.html#discord.Message "discord.Message").
New in version 1.6.
Thankd but 🗿
🗿 🤝 🗿
OOP required that's for sure
Classes, objects and other stuff
I will start learning them thx
Gl
thanks
Hello @lament oarone
I am new to Python and I am going to build bot that can generate new discord account automatically with fully verification such as email verification and SMS verification.
Is it possible for me?
!rule 5
5. Do not provide or request help on projects that may break laws, breach terms of services, or are malicious or inappropriate.
Sorry
Hello, is there a method to use commands.has_permissions, commands.is_owner, etc on a slash command? Found answer on stackoverflow saying that it will work, tested right now and it not works.
we have to see some code ofc
you want to run 2 bots in parallel?
@bot.slash_command(
name="eval",
description="Выполнить переданный код",
guild_ids=Guilds._main_guild_list_
)
#@cord.is_owner() not works
async def eval(
interaction,
code=SlashOption(
name="code",
description="Код который желаете выполнить",
required=True
),
config=SlashOption(
name="config",
description="Конфигурация проекта, обычно требуется для языка Rust.",
required=False
)
):
...
cord is from discord.ext import commands as cord
Isnt this like bannable?
Probably cause of the slash command, wait a sec
most likely
have you checked out "command checks" in the docs?
Yes
have you tried any other command check BUT the is_owner one? like a specific role or whatever
Yes, checks from commands are not working for slash commands
So that's why I asked if there's an alternative method
you can do it INSIDE the slash command
I don't know why the command check doesn't function as intended tho
I've already tried that
Yeah, it's using a bot to make a user account, then use said account presumably. Even if it doesn't use it, it'd tos bannable
Yeah I know what it is
Its a token gen he's trying to make
Checks basically return boolean so there won't be any result
Checks don't work for slash commands is the response I got in dpy discord
(Not yet)
you can perfectly check it inside of the command
You can just asyncio.gather(bot.start(...), bot2.start(...)) I think
right
prolly not, he won't succeed anyways
Yeah if he doesn't even know how. We shouldn't fear
wyou dont
What?
nevermind
you dont do that
hey why this doesn't work? ```py
meme_channel = 852926176514670632
@bot.listen()
async def on_message(message):
if message.channel == meme_channel:
if "https://" in message.content:
await message.add_reaction('🔼')
await message.add_reaction('🔽')
@bot.listen()
async def on_message(message):
if message.channel == meme_channel:
if message.attachment:
await message.add_reaction('🔼')
await message.add_reaction('🔽')```
can i know what is the error
no error
sheesh
i think the error is on the add_Reaction
@heavy hound what are you trying to do
then message.channel.id?
it's d here
does anyone know what is nextcord slash command text channel name? i use channel: nextcord.TextChannel in nextcord slash command, and i got error
you got it
what am i trying to do
no idea actually
oh thanks for help
!d discord.Message.add_reaction
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.
Changed in version 2.0: `emoji` parameter is now positional-only.
Changed in version 2.0: This function no-longer raises `InvalidArgument` instead raising [`TypeError`](https://docs.python.org/3/library/exceptions.html#TypeError "(in Python v3.10)").
OH
you were searching this
yessir
Anyone else looking for some help?
Someone help pls
@rocky trench
nope
I don't know nextcord
Ouw
there's no reason to use nextcord
Discord.py is resumed
it is not
It is??
check news
and return to dpy once they finished developing the new stuff
I did it, its working fine for links but not for attachments
Dpy 2.0 is resumed then, I see it as dpy too
now wait a damn hungarian minute
Kinda lazy to migrating again
Might take time now, but it's gonna be easier
Yeah that's what I said
can anyone help me with this?
I don't know what you're trying to do
check for attachments
here
This doesn't tell me anything
if len(message.attachments) != 0, you can do the same thing
This is your code. I want to know what you expect it to do
Or if message.attachments
Thats shorter
I just want to react with those emojis if it is an attachment
not sure
if message.attachments:
#add reactions
Message.attachments returns a list. If it returns an item, it is true
that's what I did in the code earlier
if the list's empty, the statement is false?
It will return nothing, so yeah
Well yeah but it's false
will this work? if message.attachment in meme_channel:
and message.channel.id == int(meme_channel):
It won't work no
hm
if message.attachments and message.channel.id == int(meme_channel):
let me try this
working, thanks
no reason to tag the docs for me, I know dpy, I dunno python
but did you ever make a tictactoe bot?
i did
oh nice
or shud i say stack overflow did
under 1 hour with buttons
ey come play tictactoe with me it's cool
lol
LMAO
I thought u searched a tag for it
Off-topic channel: #ot2-never-nester’s-nightmare
Please read our off-topic etiquette before participating in conversations.
Excuse me, I want to ask, what's the difference between discord.Emoji and Discord.PartialEmoji classes?
are you using any fork?
fork means you copy other's code right?
or something else
yes something like that
no i done all of the code myself
No
Forks are wrappers
Like discord.py, u also got pycord
source code is taken from somewhere else in forks
No?
Pycord is a fork of discord.py no?
It is
it is
Mb, bad explanation of me then
But not all forks are API wrappers
^
I see, mb
pycord does not even say that its a fork, saying it API wrapper is misleading
I mean, they are a fork but they do not state it
"Pycord, a maintained fork of discord.py, is a python wrapper for the Discord API"

how to make your bot reacts to your message in a selected channel?
!d discord.Message.add_reaction
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.
Changed in version 2.0: `emoji` parameter is now positional-only.
Changed in version 2.0: This function no-longer raises `InvalidArgument` instead raising [`TypeError`](https://docs.python.org/3/library/exceptions.html#TypeError "(in Python v3.10)").
@client.command(name = "c")
async def command(ctx):
computer = random.randint(1, 10)
await ctx.send('Guess my number')
def check(msg):
return msg.author == ctx.author and msg.channel == ctx.channel and int(msg.content) in [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
msg = await client.wait_for("message", check=check)
if int(msg.content) == computer:
await ctx.send("Correct")
else:
await ctx.send(f"Nope it was {computer}")
``...
Huh
command name and function name must have the same name
@client.command(name = "c")
async def command(ctx):
computer = random.randint(1, 10)
await ctx.send('Guess my number')
def check(msg):
return msg.author == ctx.author and msg.channel == ctx.channel and int(msg.content) in [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
msg = await client.wait_for("message", check=check)
if int(msg.content) == computer:
await ctx.send("Correct")
else:
await ctx.send(f"Nope it was {computer}")
Nope
check isnt a command, c is a command 
That defeats the purpose of the name kwarg

Nvm, u already edited
restart your bot
probably didnt get registered 
Stop with the emoji spam @slate swan
uh....
still same thing is happening
Ask hunter 😔 me noob
Hmmm, have u defined 2 bots in the same file? @slate swan
not two bots
k now my bot working :D
an test
Great grammar!
i used half of the bot with bot and client
Ah there's the issue
U don't do that. Use either bot, or client
Change the decorator to bot.command
so i ran my bot on heroku, and i ran the content_check command (it's in a cog) but it says it doesn't exist?
hwat about the other code
What code?
@client.command(name = "c")
async def command(ctx):
computer = random.randint(1, 10)
await ctx.send('Guess my number')
def check(msg):
return msg.author == ctx.author and msg.channel == ctx.channel and int(msg.content) in [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
msg = await client.wait_for("message", check=check)
if int(msg.content) == computer:
await ctx.send("Correct")
else:
await ctx.send(f"Nope it was {computer}")
smh
both my content_check and spam_check commands in my cog aren't showing up for my bot, but other commands in the cog ARE
That's the signal to stop using Heroku
Pleasure is all yours to help them
nah, I'mma spectate while you help 
Just let the code be as it is, don't disturb it. Just change the decorator from @client.command to @bot.command
what are you teaching hunter
They have defined both bot and client in the same file and getting a command not found
The rest is understood
talking bout ()
Huh?

@bot.command()!
Mind sharing the code?
@maiden fable whole cpde?
i changed it
to bot. commad
Ah, okay

Ah
whats wrong
Are you new to python poofy?
Just, remember that never define two bots in a single file and u r gonna be fine
it works now
Cool!
will it work on othwr codes with the client thingy
nah turns out i forgot the decorator on my command
that's why
oooh yeah, context
How is this possible that the system can't find the path
for filename in os.listdir('./cogs'):
if filename.endswith('.py'):
client.load_extension(f'cogs.{filename[:-3]}')
./Bot/cogs/
no
huh
./cogs should work. its relative
his works too
whats the import thing for discordpy remake
add __init__.py file to your directories
this works too so its fine
thank you @slate swan
ok

.
import discord??
just that yeah?
just import discord
alr chrs
want my bot to generate quotes , i am coding in python
def get_quote():
response = requests.get("http://zenquotes.io/api/random")
json_data = json.loads(response.text)
quote = json_data[0]['q'] + "-" + json_data[0]['a']
return (quote)
#inspire
@client.command()
async def quote(ctx):
await ctx.reply(get_quote())
but this is showing error
!code
Here's how to format Python code on Discord:
```py
print('Hello world!')
```
These are backticks, not quotes. Check this out if you can't find the backtick key.
quotes like this?
response = requests.get("http://zenquotes.io/api/random%22")
if you don't consider using aiohttp since requests is blocking
and next time, send the error too
error where i am no python interpeter or am i?
@slate swan
File "main.py", line 70, in get_quote
response = requests.get("http://zenquotes.io/api/random"")
NameError: name 'requests' is not defined
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/home/runner/Discordbot/venv/lib/python3.8/site-packages/discord/ext/commands/bot.py", line 939, in invoke
await ctx.command.invoke(ctx)
File "/home/runner/Discordbot/venv/lib/python3.8/site-packages/discord/ext/commands/core.py", line 863, in invoke
await injected(*ctx.args, **ctx.kwargs)
File "/home/runner/Discordbot/venv/lib/python3.8/site-packages/discord/ext/commands/core.py", line 94, in wrapped
raise CommandInvokeError(exc) from exc
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: NameError: name 'requests' is not defined
import requests
i did what u said
seems like I sent another error
i dont think he will feel the block tbh not on just that n one command
god damnit dave
@slate swan did u even import requests
nope i am doing it rn
eeeh
I jsut sent the link he sent
with " at the end so there's no syntax error
@slate swan why u need a pencil to draw?
it seems pretty obvious that was a syntax error
but so you must take it
like import pen instead of import pencil
u need to import cus python is not importing all libs for u
from pencase import pencil
pencil.draw()
lol
still error, do i need to import anything for json
yes
yess
json
if pencil.status <= 10:
pencil.sharpen()
you must initialize all names
ya k?
lol yes just lil bored
I'm playing a competitive game under an open window where the sun is fucking me
while not pencil.broken:
pencil.draw()
if pencil.status <= 10:
pencil.sharpen()
I-lands problems
kek
i g it works but the website not showing quotes
do u have any suggestion?
similar websites?
check with ur browser if get any
why is there a %22 
he loves hexdecimals

when you guys getting married 
rn

why you not here?
who even likes me 😔
not me, you're not at my wedding
today is womens day but u ppl by default thing i am a man
today?

that was yesterday
yesterday's gone
....
no in my region
u dont need to ask ofc its a yes
that was yesterday tho
Read!
maybe next year @slate swan
but y u ppl by default thing i am man?
no i assumed u were a girl
mathematically there's more chance we're correct
yes but now we need to chng
looks fine here, maybe because your URL encoding is different
we need to what
change
change what
that, i dont dare answer
oh lmao
mentality
I'm gonna cut it off so there'll be less chance that you're right if you say someone's a man
? no i am not , i cant cz i dont know wht is manspigs, its not my frst language
man and pig
lol
nope i am just talking, calm down
@slate swan where u from?
guess
!ot
Off-topic channel: #ot2-never-nester’s-nightmare
Please read our off-topic etiquette before participating in conversations.
did u install the voice version?
install ffmpeg
am using repl cause im a peasant
yes i did
aperently u didnt
install discord.py[voice]
cus error sais that
and yes as i said u need voice verson of python discord
replit doesnt have ffmeg
ofc not
halp
um

my fav emoji
how to download it
im using replit ): im a peasant
idk replit
fuk
put that exe in replit
hm
what is better than vs code + github
pycharm
ik but i want free 24/7 hosting
im poor ass
I programmed a temporary voice bot, but sometimes it wont delete the channel
hm
@boreal ravine
!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)
pls help i am hopeless
What does it do

it's not only youtube rules
it works fine until you change the name of your channel 3 times with a command
Then the bot wont delete the channel and the messages
Sad
But with no errors
guys i switch to mac vscode and im getting error
ModuleNotFoundError: No module named 'nextcord'
heroku exists, but tbh its for testing purposes
yea pls halp 
and for music bots it needs a lot time to download
@honest shoal can you help ?
why not replit and keep alive?
do you have nextcord installed?
errors says it all
python3 -m pip install -U nextcord```
keep what live
the code?
cuz replit's shit
- also use uptimerobot
host on your pc
the best free way
ok
Or if u aren't low on budget, I suggest getting a raspberry pi
Its really usefull to run several bots on.
i LOVE raspberry pi
me too
but i am poor
Next to a ps4 controller
im a kid
lmfao
Yeah my sd card broke
buy poor thing a case
Its corrupt or sum, my raspberry can't be accessed anymore atm
ahh
Gotta fix sd card first😅
I had to buy a new one
help me pls
The thing is, I can't fix it since I don't use Linux anywhere
can someone tell me what is nextcord?
What with?
Its some kind of a fork of discord.py
it was unformattable for me
Mine got formatted instant on my pc
oof
and it was corrupt
bots can only edit channel names once every 5 minutes
I had to reinstall entire raspbian
And I can't do it again, my pc just doesn't recognize the sd card anymore
an updated fork of discord.py
exactly
That's the problem lmao
I got to get to someone with Linux or sum, or just buy a new micro sd
PLS
not even an sd card formatter could do it
replit doesn't have ffmpeg like I said
Might have to buy a new one
what is the problem dude?
how do i download
Who told ya this sh*t? lol
):
Source: trust me bro
experience so shoosh
wdym by fork 😅
this should be hidden behind your router, at least, I would xd
like a clone but a lil diff
ohhhh
discord docs
Its right next to my pc lol
no need to be close when you can ssh locally
Dunno d.py but disnake doesn't have this problem
Cable management pain
did replit stopped supporting ffmpeg?
idk ;-;
probably
I'm unable to find proper info on google
yeah, just hide it somewhere, wrap it up
but i cloned a coded music bot in replit which uses ffmpeg it worked
The sd card is Also the reason my public bot is offline. For like 3 weeks already
@potent spear it stopped working after I typed 'reboot' in the console
Not sudo blablabla reboot
yeah, you can have an SSH file in the root of your RPI (this enables ssh on boot), which tells it to check the config on boot and connect to your home wifi or whatever
Is this typing 'reboot' the problem that made it die?
so it doesnt matter learning both discord.py and nextcord because its just desame xd
Just learn dpy, a lot more support on it
ask linux, this is a python channel lol
Yeah XD
I already learned it xd, its been a year though xd
This is starting to become a #python-discussion
Lets just focus on helping people again now
Hey guys, what do you think is a proper implementation to avoid spamming using discord.py ( not the cooldown )
store messages with their creation times somewhere
avoid spamming what?
delete every message 10 seconds after
if there are 3 messages in those 10 seconds in that place
from the same author
he spamming
I'm spamming

6 seconds cooldown moment
Do i see an Arduino? 👀
I think you can make a CD for messages
CD?
Cooldown
The short form of "cooldown"
I was thinking more like, add a muted role disabling them to msg again for a while
Raspberry pi
Hmmm
How would I check a channel for messages, and if there are none in 30 minutes close it?
get channel.last_message
Smart
!d discord.Message.created_at
property created_at```
The message’s creation time in UTC.
But I would need to check this like every second no?
utcnow - this date
I wouldn't
CET
The message’s creation time in UTC.
Then how would I properly keep checking
Ah alr, mb
like every minute in a task
it doesn't really matter until it fits your memory, you aren't really making an API call
Oh mb
Yeah indeed
Is there a way to do that without cooldown?
thats the unpolite issue with SD cards so easily interuppted n broken
or should i say corrupted?
no
cause they dont want u spam it
probably no
That's the rate limit, so no
@sullen iris plz dont add randoms as friends cause u want help. Its better if u keep asking and aybe use properly channels like if its a DB related issue try #databases
Hey so how do I use an API with a discord bot?
as youre using it usually on python
you just have to change the output way
Ok, lemme rephrase this, how do I use an API in general?
what api
how you use the dpy api
deends on what api
Good question.
bruh
Lemme find it rq
A free Animal Crossing: New Horizons API for furniture, critters, fossils, art, music and villagers!
oh
I didn't know the link for it, I just knew it was an ACNH api
Documentation for ACNH API and description of the different endpoints that can be used. ACNH API is free and doesn't require any authentification.
its just json so you use it like any json call
Usage:
All the JSON data from this API is under CC BY 4.0 license, the images and music assets are the sole property of Nintendo.
The documentation for the API can be found here.
No authentification is required to make requests to any of the endpoints which can be accessed over HTTP or HTTPS. All the data from the API can be found in JSON format on the following repository.
Data in JSON format from https://acnhapi.com. Contribute to alexislours/ACNHAPI development by creating an account on GitHub.
you can use it through an http/s requests
just learn to grab json and pick elements from it print to discord
but you need to deal with the json format
🏃♂️ just use aiohttp to get a response from the website and use the .json() method to convert it into a json/dictionary
request a website -> they return JSON -> pick json grab the elements u want -> send to discord
(i ean request as general not the lib)
There's a lib called requests?
yes,
but its not good for discord cause discord is an asyncronized lib
yes
but since its blocking (sync) one must not use it in an async environment like discord.py
!pip aiohttp is what you would like using ( yea, discord.py uses this to make requests)
Do I need to do pip install?
yes
no. if you have discord.py
you already have this
aiohttp gets installed with dpy and its forks since the libraries use aiohttp to send requests to the dscapi
next time u can just try import the lib and it will tell u if it exists or not
Ah ok
😔 I am waiting for the time when libs start to use httpx which is gonna be never
or just try to install it 
ye dosnt matter
or just search it up on the web 
then i would try pip it 😛

Stop slapping 😔
Command raised an exception: AttributeError: 'Object' object has no attribute '_state'
any ideas on this error?
from what?
well ofc but many package imports and install names are different 😔
but u trying to grab x._state? lol
im not lol
imagine code 
where u get that error from?
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.
better
from where is that
first time ive gotten that error too
@slow foghis paste link the first one
what?
It doesn't download anything btw
oh
Yea
@slow foghttps://paste.iamgadget.co.uk/sekofakule.py
this url
Discord flagged it as a potential download because it isn't a typically visited site on discord most likely, idfk
sus
Either that or its be sure it ends in .py
async def on_member_join(member):
await bot.get_channel(950383739635114074).send(f"{member.name} has joined")``` why is it not working
!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.
bot.get_channel isnt asynchronous
oh yes enebled them
this it was
discord is so stupid it could flag any other serious exe file which is an actual dangerous files but no it doesnt and instead of that its blocking some random stupid file
didnt work
Lmao
.send is
cause it ended with .py it alerted
https://google.com/myhack.sh <- whitelisted tho
ig ill remove the extension from my links
https://iamgadget.co.uk/sus-file.py (better example)
suspect
sus-file 
even if were...idk what to do with them 😄






