#discord-bots

1 messages · Page 893 of 1

nimble plume
#

i cant upload to heroku

#

error: src refspec master does not match any

#

git push heroku master

maiden fable
#

Why even use heroku lemon_pensive

nimble plume
#

pls suggest

#

i want a good hosting + free

nimble plume
maiden fable
#

Well, if u r okay with yr bot dying for 8-9 days every month, then go on

maiden fable
#

Who are u now lemon_pensive

#

Dyno's alt?

nimble plume
#

nvmd its fix

maiden fable
#

?

mental bison
nimble plume
nimble plume
maiden fable
#

Ah, I thought u were, since u came all of a sudden and was talking about Heroku, sorry

nimble plume
#

! [remote rejected] master -> master (pre-receive hook declined)

maiden fable
#

Idk, never used beroku

hazy oxide
#

does anyone know what is nextcord slash command text channel name? i use channel: nextcord.TextChannel in nextcord slash command, and i got error

nimble plume
#

beroku

placid skiff
#

Yo Hunter, Ash. Do you know how to create a custom event?

nimble plume
placid skiff
#

yeah it is driving me crazy

visual island
#

bot.dispatch()

nimble plume
#

lets google whats that

maiden fable
cosmic agate
#

guys my prob

placid skiff
maiden fable
#

internals

cosmic agate
#
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
maiden fable
#

@placid skiff

nimble plume
#

@maiden fable which host u use for ur bot

nimble plume
cosmic agate
#

wavelink?

maiden fable
placid skiff
cosmic agate
nimble plume
placid skiff
#

But why there is nothing for dispatch in disnake docs? xD

queen linden
#

uhh help

nimble plume
maiden fable
regal cove
#

how do i make an interactive button message on my bot?

placid skiff
maiden fable
placid skiff
#

Dunno how it works, there is no doc xD

maiden fable
#

I mean, just use it literally like u use other events

#

iirc HunAI also uses that to dispatch Chat Message Events

placid skiff
#

now i can try to use it hahaha

maiden fable
#

Mind showing?

placid skiff
#
@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

modest plover
#

Hi, uhh

placid skiff
#

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

queen linden
#

hi uhh help

maiden fable
placid skiff
unkempt canyonBOT
#

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.
placid skiff
# maiden fable Hm?

which database do you suggest me? i need one that can have two or more instance opened

placid skiff
#

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

queen linden
placid skiff
placid skiff
queen linden
maiden fable
queen linden
#

idk if i did it correctly tho

placid skiff
placid skiff
maiden fable
maiden fable
placid skiff
#

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

maiden fable
#

Hahaha

placid skiff
# queen linden

The query is wrong, it is:

DELETE FROM table_name WHERE condition
regal cove
#

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

placid skiff
#

So more code to copy xD

placid skiff
#

You always need to ruin everything right? :L

queen linden
slate swan
queen linden
#

i did

DELETE user_id FROM servdata WHERE user_id = ?, (member.id,)

what did i do wrong

placid skiff
queen linden
#

im not well versed in making databases as im still a beginner 😭

placid skiff
#

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

queen linden
#

so uhh what do i do

placid skiff
#

What do you need to do?

honest shoal
#

is there any timeout_members: bool permission in disnanke?

maiden fable
placid skiff
queen linden
#

oh

placid skiff
#

😇

honest shoal
#

sad

maiden fable
#

!d disnake.Permissions.moderate_members

unkempt canyonBOT
slate swan
#

frog_sip hunter high

honest shoal
#

oh

placid skiff
dull terrace
#

would delete the row with the user id

honest shoal
maiden fable
dull terrace
#

make sure you remember the where condition

placid skiff
maiden fable
#

Gonna miss my doctor appointment then lemon_pensive

dull terrace
placid skiff
#

Bro i don't make questions, i solve problems
xD

queen linden
dull terrace
#

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?

queen linden
#

idk how to do that 😭

slate swan
dull terrace
#

i

placid skiff
queen linden
#

bc it just returns as a 'None' object

slate swan
#

discord-bots frog_sip

placid skiff
dull terrace
unkempt canyonBOT
#

7. Keep discussions relevant to the channel topic. Each channel's description tells you the topic.

placid skiff
slate swan
dull terrace
slate swan
slate swan
#

Mini-modding unnecessarily, this is well within the channel topic

dull terrace
slate swan
#

If anything, that degenerate frog emoji is more off topic.

dull terrace
#

approaches for making dbs for discord bots are slightly different

slate swan
boreal ravine
queen linden
boreal ravine
#

and why is your account so new sus_eyes

boreal ravine
queen linden
#

the member object

boreal ravine
#

how are you using the member object?

queen linden
#

uhh putting their @ 's on the embed description for the leaderboard command

boreal ravine
#

using .mention?

queen linden
#

yes

boreal ravine
#

do you get/fetch the user/member?

queen linden
#

wait what

#

oh um yes

maiden fable
boreal ravine
placid skiff
#

When a member leaves a guild you can't mention him anymore

queen linden
boreal ravine
# queen linden 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

queen linden
#

OHH icic ill try it !

placid skiff
placid skiff
#

to mention someone he needs to be in the guild, you can't mention someone external the guild even by mentioning him like that

boreal ravine
#

you can

placid skiff
#

Why everyone doubts me today

modest plover
#

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"
					)
boreal ravine
placid skiff
#

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?

boreal ravine
boreal ravine
slate swan
#

Why are you using bulletpoints lmao

regal cove
#

i need help

slate swan
#

You can start by telling us what you need help with

regal cove
#

is anyone here familiar with sqlite files?

slate swan
potent spear
quick gust
regal cove
#

imma go to that channel too tho

potent spear
#

first, learn CRUD operations via SQL

#

then try to implement your db in the bot

#

preferably, an async wrapper of the db

placid skiff
queen linden
regal cove
potent spear
# regal cove ok

in your case, you could use asqlite or aiosqlite or whatever, those are async wrappers of sqlite

boreal ravine
potent spear
# boreal ravine 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>

boreal ravine
regal cove
modest plover
boreal ravine
#

you mean the space above the embed right?

modest plover
#

No, the space between the two hyperlinks

boreal ravine
#

oh-

modest plover
#

Lmao

boreal ravine
#

try (or just use a normal string with newlines)```py
infoEmbed = disnake.Embed(
title = me.name,
colour = disnake.Colour(0x1abc9c))
infoEmbed.description = """
:emoji:
:emoji:
"""

slate swan
maiden fable
supple thorn
#

How to send a message

boreal ravine
#

Type in the text box, click enter on your keyboard.

supple thorn
#

Thanks kayle

supple thorn
boreal ravine
#

~~happens when you use docstrings ~~

boreal ravine
supple thorn
supple thorn
honest vessel
vestal pine
#

wow I didnt know there is a channel for this

#

is this only for discord .py?

honest vessel
#

no

#

but mainly seems to be d.py and disnake

vestal pine
#

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

honest vessel
#

-1 day? 😄

vestal pine
#

wait what

honest vessel
#

how the

modest plover
#

I can't remember how to reload the commands lmao

honest vessel
#

reload cogs if u have that

#

no need to restart bot then

slate swan
unkempt canyonBOT
#

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.
honest vessel
#

ah ye ^ but i use the two others unload n load ^^

slate swan
#

that unloads and loads lol not sure why you would

honest vessel
#

i know but i didnt know about that one when made it

#

😛

slate swan
#

lol

vestal pine
modest plover
slate swan
supple thorn
modest plover
#

Because the API version it's on (7) is being decommissioned on the 30th April, meaning it won't work.

vestal pine
honest vessel
#

so it wont get killed

vestal pine
#

confused

slate swan
boreal ravine
honest vessel
#

he is aparently back n taking on the project again

modest plover
vestal pine
boreal ravine
honest vessel
#

disnake <- is up to date atleast

modest plover
#

It's all down to personal preference

#

I recommend trying out various libraries and see which works best for tou

boreal ravine
#

using a fork when the original library is maintained Bruhmoment

modest plover
#

Barely maintained.

modest plover
#

It's 3 API versions behind and has no stable support for anything the forks have

boreal ravine
#

still usable

modest plover
#

All the interaction shit (slash commands, timeouts, modals, etc) has no stable support

honest vessel
boreal ravine
honest vessel
#

why would u wanna downgrade

#

buttons timeout events etc etc

#

slash commands

quick gust
boreal ravine
#

they already have all the functions/methods for those

slate swan
#

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.

vestal pine
honest vessel
vestal pine
#

like Zenth

modest plover
vestal pine
modest plover
#

It's not fully finished but it's got the basics

vestal pine
modest plover
#

Np

final shard
#

How do you set footer icon again?

vestal pine
#

is it enough if I know the python basics to start with bot development?

modest plover
#

icon_url = url @final shard

honest vessel
final shard
#

ok

modest plover
#

Probably

#

What do you class as the basics?

vestal pine
#

if-else, functions, variables, some errors,

#

or math

modest plover
#

Yeah I'd say you're fine to do bot dev

vestal pine
#

thanks

dense swallow
#

does pycord have case insensitive prefix?

tidal hawk
#

What's the easiest way to convert User obj -> Member obj

#

member = guild.get_member(user.id) ?

supple thorn
#

What's 1+1?

maiden fable
slate swan
pliant gulch
#

Because user doesn't have some of the attributes & methods of Member

slate swan
dense swallow
maiden fable
#

Yea

slate swan
#

a tuple in prefix yes

pliant gulch
#

They have differences in attributes

slate swan
boreal ravine
pliant gulch
#

If they want to convert a User to Member I'm pretty sure they want to access an attribute under members

boreal ravine
boreal ravine
slate swan
#

loool

pliant gulch
#

Except Exception inherits BaseException

#

So if you look at errors such as ValueError and TypeError you'd see BaseException in the MRO

supple thorn
#

How to reply to a message (This question is a ruse i need help with ebay)

unkempt canyonBOT
#

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.
vale wing
#

!d discord.ext.commands.Context.reply as well

unkempt canyonBOT
#

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.
supple thorn
vale wing
#

🗿 🤝 🗿

vale wing
#

Classes, objects and other stuff

vestal pine
vale wing
#

Gl

vestal pine
#

thanks

arctic lily
#

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?

rocky trench
#

LMAO

#

@coral flicker

#

Any moderator here?

unkempt canyonBOT
#

5. Do not provide or request help on projects that may break laws, breach terms of services, or are malicious or inappropriate.

stray solar
#

Hello, how can i put two token with one code

#

And run at the same time

arctic lily
mellow barn
#

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.

potent spear
mellow barn
# potent spear we have to see some code ofc
@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
  )
):
  ...
mellow barn
rocky trench
honest vessel
rocky trench
potent spear
potent spear
potent spear
# mellow barn Yes

have you tried any other command check BUT the is_owner one? like a specific role or whatever

mellow barn
#

Yes, checks from commands are not working for slash commands

#

So that's why I asked if there's an alternative method

potent spear
#

you can do it INSIDE the slash command

#

I don't know why the command check doesn't function as intended tho

mellow barn
modest plover
rocky trench
#

Its a token gen he's trying to make

mellow barn
#

Checks basically return boolean so there won't be any result

rocky trench
#

(Not yet)

rocky trench
#

Check for admin

#

Or isn't that possible either? Till now I used slash_util

potent spear
vale wing
boreal ravine
cold sonnet
rocky trench
heavy hound
#

wyou dont

rocky trench
heavy hound
#

nevermind

heavy hound
hallow tangle
#

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('🔽')```

hallow tangle
#

no error

heavy hound
#

and why 2 bot listen and on message

#

that is illegal for me lmao

hallow tangle
#

sheesh

heavy hound
#

and why to if

#

two if*

#

nevermind its ok

hallow tangle
#

because its only for a meme channel

#

code is not working

heavy hound
#

i think the error is on the add_Reaction

cold sonnet
#

message.channel ain't no int

#

won't be equal to your int instance

low latch
#

@heavy hound what are you trying to do

hallow tangle
cold sonnet
#

it's d here

hazy oxide
#

does anyone know what is nextcord slash command text channel name? i use channel: nextcord.TextChannel in nextcord slash command, and i got error

cold sonnet
heavy hound
#

no idea actually

hallow tangle
#

oh thanks for help

cold sonnet
#

!d discord.Message.add_reaction

unkempt canyonBOT
#

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)").
heavy hound
#

OH

cold sonnet
#

you were searching this

heavy hound
#

yessir

rocky trench
#

Anyone else looking for some help?

heavy hound
#

nope

rocky trench
#

I don't know nextcord

hazy oxide
#

Ouw

cold sonnet
#

there's no reason to use nextcord

rocky trench
cold sonnet
#

it is not

rocky trench
#

It is??

cold sonnet
#

check news

rocky trench
cold sonnet
#

and return to dpy once they finished developing the new stuff

hallow tangle
rocky trench
#

Dpy 2.0 is resumed then, I see it as dpy too

cold sonnet
#

now wait a damn hungarian minute

hazy oxide
#

Kinda lazy to migrating again

cold sonnet
#

I missunderstood

#

broo

rocky trench
cold sonnet
#

it's not paused anymore

#

= resumed

rocky trench
#

Yeah that's what I said

hallow tangle
rocky trench
#

I don't know what you're trying to do

cold sonnet
rocky trench
#

This doesn't tell me anything

cold sonnet
#

if len(message.attachments) != 0, you can do the same thing

rocky trench
#

This is your code. I want to know what you expect it to do

rocky trench
#

Thats shorter

hallow tangle
#

I just want to react with those emojis if it is an attachment

cold sonnet
rocky trench
#

if message.attachments:
#add reactions

rocky trench
hallow tangle
cold sonnet
#

if the list's empty, the statement is false?

rocky trench
#

It will return nothing, so yeah

cold sonnet
#

not nothing

#

still a list

rocky trench
#

Well yeah but it's false

hallow tangle
#

will this work? if message.attachment in meme_channel:

rocky trench
rocky trench
#

It won't work no

gaunt ice
#

hm

rocky trench
hallow tangle
#

let me try this

hallow tangle
#

working, thanks

cold sonnet
#

wait that shouldn't be what I'm looking for

#

nah, it's good

cold sonnet
cold sonnet
#

but did you ever make a tictactoe bot?

gaunt ice
cold sonnet
#

oh nice

gaunt ice
#

or shud i say stack overflow did

cold sonnet
#

under 1 hour with buttons

gaunt ice
#

not buttons

#

i aint good with buttons

cold sonnet
#

ey come play tictactoe with me it's cool

cold sonnet
#

or will I get banned if I invite you

#

it's worth the risk

gaunt ice
#

lol

heavy hound
rocky trench
unkempt canyonBOT
heavy hound
#

buttons

#

how do i do buttons and timeouts

serene lynx
#

Excuse me, I want to ask, what's the difference between discord.Emoji and Discord.PartialEmoji classes?

honest shoal
heavy hound
#

or something else

honest shoal
heavy hound
honest shoal
#

I'm asking about the library

rocky trench
#

Forks are wrappers

honest shoal
#

source code is taken from somewhere else in forks

final iron
rocky trench
final iron
#

It is

honest shoal
rocky trench
#

Mb, bad explanation of me then

final iron
#

But not all forks are API wrappers

honest shoal
#

^

rocky trench
#

I see, mb

honest shoal
#

pycord does not even say that its a fork, saying it API wrapper is misleading

final iron
#

How?

#

Pycord is an API wrapper

honest shoal
#

I mean, they are a fork but they do not state it

final iron
#

"Pycord, a maintained fork of discord.py, is a python wrapper for the Discord API"

honest shoal
#

try to understand me this statement is too old

slate swan
#

how to make your bot reacts to your message in a selected channel?

placid skiff
#

!d discord.Message.add_reaction

unkempt canyonBOT
#

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)").
slate swan
#
@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}")
``...
maiden fable
#

Huh

placid skiff
slate swan
#
@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}")
slate swan
#

check isnt a command, c is a command frog_sip

maiden fable
#

That defeats the purpose of the name kwarg

slate swan
maiden fable
#

Nvm, u already edited

slate swan
#

probably didnt get registered frog_sip

maiden fable
#

Stop with the emoji spam @slate swan

slate swan
slate swan
maiden fable
#

Hmmm, have u defined 2 bots in the same file? @slate swan

slate swan
#

not two bots

slate swan
cold sonnet
#

an test

maiden fable
slate swan
#

i used half of the bot with bot and client

maiden fable
#

Ah there's the issue

#

U don't do that. Use either bot, or client

#

Change the decorator to bot.command

quaint epoch
#

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?

slate swan
#

hwat about the other code

maiden fable
#

What code?

slate swan
# maiden fable 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

quaint epoch
#

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

maiden fable
maiden fable
slate swan
maiden fable
cold sonnet
#

what are you teaching hunter

maiden fable
#

The rest is understood

cold sonnet
#

talking bout ()

maiden fable
#

Huh?

maiden fable
cold sonnet
#

@bot.command()!

maiden fable
#

Mind sharing the code?

slate swan
#

i changed it

#

to bot. commad

maiden fable
#

Ah, okay

slate swan
maiden fable
#

Ah

slate swan
#

whats wrong

maiden fable
#

Change it to bot.wait_for

#

:D

rocky trench
#

Are you new to python poofy?

slate swan
#

no

#

i used bot many times but this. client thing is tricky

maiden fable
#

Just, remember that never define two bots in a single file and u r gonna be fine

slate swan
#

it works now

maiden fable
#

Cool!

slate swan
maiden fable
#

Nope, use bot only

#

Also, no need to use client since Bot is a subclass of Client

quaint epoch
#

nah turns out i forgot the decorator on my command

#

that's why

#

oooh yeah, context

junior verge
#

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]}')
slim ibex
slate swan
#

huh

slim ibex
#

./cogs should work. its relative

junior verge
#

his works too

slate swan
#

whats the import thing for discordpy remake

slim ibex
#

add __init__.py file to your directories

junior verge
#

thank you @slate swan

slim ibex
#

ok

slate swan
slim ibex
#

but I would still add __init__.py files in every directory

#

its a good practice

cold sonnet
#

import discord??

slate swan
cold sonnet
#

just import discord

slate swan
#

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

slim ibex
#

!code

unkempt canyonBOT
#

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.

slim ibex
#

quotes like this?

cold sonnet
#

if you don't consider using aiohttp since requests is blocking

#

and next time, send the error too

honest vessel
cold sonnet
#

should be

#

I just sent it

honest vessel
#

@slate swan

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

buoyant quail
#

import requests

slate swan
cold sonnet
#

seems like I sent another error

honest vessel
cold sonnet
#

god damnit dave

honest vessel
#

@slate swan did u even import requests

slate swan
honest vessel
#

kek

#

@cold sonnet %22?

slate swan
#

i am a little confuse

#

can u explain why request needed to bw import

honest vessel
#

eeeh

cold sonnet
#

with " at the end so there's no syntax error

honest vessel
#

@slate swan why u need a pencil to draw?

cold sonnet
#

it seems pretty obvious that was a syntax error

buoyant quail
#

i don't need

slate swan
#

i can draw with pen as well

#

or mouse

buoyant quail
#

like import pen instead of import pencil

honest vessel
#

u need to import cus python is not importing all libs for u

#

from pencase import pencil

buoyant quail
#

pencil.draw()

honest vessel
#

lol

slate swan
#

still error, do i need to import anything for json

cold sonnet
#

yes

cold sonnet
#

json

honest vessel
#

if pencil.status <= 10:
pencil.sharpen()

buoyant quail
#

you must initialize all names

cold sonnet
honest vessel
cold sonnet
#

I'm playing a competitive game under an open window where the sun is fucking me

buoyant quail
#
while not pencil.broken:
    pencil.draw()
    if pencil.status <= 10:
        pencil.sharpen()
cold sonnet
#

while I'm losing my game

#

my brain is exploding

slate swan
#

i g it works but the website not showing quotes

#

do u have any suggestion?

#

similar websites?

honest vessel
#

check with ur browser if get any

honest vessel
#

he loves hexdecimals

slate swan
cold sonnet
#

I love f-strings

slate swan
cold sonnet
#

rn

slate swan
cold sonnet
#

why you not here?

slate swan
cold sonnet
#

not me, you're not at my wedding

slate swan
buoyant quail
#

today?

slate swan
cold sonnet
#

that was yesterday

slate swan
cold sonnet
#

....

slate swan
#

no in my region

buoyant quail
#

oof

#

i have 17:18

#

so where you fkin are xd

slate swan
#

14:18

honest vessel
honest vessel
cold sonnet
#

Read!

honest vessel
#

maybe next year @slate swan

slate swan
#

but y u ppl by default thing i am man?

honest vessel
#

no i assumed u were a girl

cold sonnet
#

mathematically there's more chance we're correct

slate swan
boreal ravine
cold sonnet
#

we need to what

honest vessel
#

change

cold sonnet
#

change what

honest vessel
#

that, i dont dare answer

cold sonnet
#

oh lmao

slate swan
#

mentality

cold sonnet
#

I'm gonna cut it off so there'll be less chance that you're right if you say someone's a man

honest vessel
#

@slate swan now u accusing us to be manspigs wth

#

u playing the gender cards rn :s

slate swan
#

? no i am not , i cant cz i dont know wht is manspigs, its not my frst language

cold sonnet
#

man and pig

honest vessel
#

lol

slate swan
honest vessel
#

@slate swan where u from?

slate swan
cold sonnet
#

!ot

unkempt canyonBOT
gaunt ice
#

its joining the vc but not playing it and showing error

honest vessel
#

did u install the voice version?

gaunt ice
#

how

honest vessel
#

install ffmpeg

gaunt ice
#

am using repl cause im a peasant

gaunt ice
honest vessel
#

aperently u didnt

cold sonnet
honest vessel
#

cus error sais that

gaunt ice
#

wait

honest vessel
#

and yes as i said u need voice verson of python discord

boreal ravine
#

replit doesnt have ffmeg

honest vessel
#

ofc not

gaunt ice
boreal ravine
gaunt ice
#

um

boreal ravine
gaunt ice
#

halp

maiden fable
honest shoal
# gaunt ice

lol, don't use that pypi one there's an exe file for that

gaunt ice
honest shoal
gaunt ice
#

im using replit ): im a peasant

honest shoal
#

idk replit

gaunt ice
#

fuk

buoyant quail
#

put that exe in replit

gaunt ice
#

hm

honest shoal
#

what is better than vs code + github

buoyant quail
#

pycharm

gaunt ice
#

im poor ass

distant pendant
#

I programmed a temporary voice bot, but sometimes it wont delete the channel

buoyant quail
#

!ytdl

unkempt canyonBOT
#

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)
gaunt ice
#

pls help i am hopeless

buoyant quail
#

only with ur music

copper gulch
buoyant quail
#

it's not only youtube rules

distant pendant
distant pendant
maiden fable
#

Sad

distant pendant
#

But with no errors

cosmic agate
#

guys i switch to mac vscode and im getting error
ModuleNotFoundError: No module named 'nextcord'

honest shoal
gaunt ice
honest shoal
#

and for music bots it needs a lot time to download

cosmic agate
honest shoal
#

errors says it all

cosmic agate
#

i cant

#

can you say how to download on mac

honest shoal
gaunt ice
cosmic agate
cold sonnet
cosmic agate
#
  • also use uptimerobot
cold sonnet
#

absolute offense

honest shoal
#

the best free way

gaunt ice
rocky trench
#

Or if u aren't low on budget, I suggest getting a raspberry pi

#

Its really usefull to run several bots on.

gaunt ice
cold sonnet
#

me too

gaunt ice
#

but i am poor

rocky trench
#

Next to a ps4 controller

gaunt ice
#

im a kid

gaunt ice
rocky trench
#

Yeah my sd card broke

cold sonnet
#

buy poor thing a case

rocky trench
#

Its corrupt or sum, my raspberry can't be accessed anymore atm

gaunt ice
#

ahh

rocky trench
cold sonnet
#

I had to buy a new one

gaunt ice
#

help me pls

rocky trench
#

The thing is, I can't fix it since I don't use Linux anywhere

copper gulch
#

can someone tell me what is nextcord?

rocky trench
gaunt ice
rocky trench
cold sonnet
rocky trench
gaunt ice
cold sonnet
#

and it was corrupt

boreal ravine
rocky trench
#

I had to reinstall entire raspbian

rocky trench
#

And I can't do it again, my pc just doesn't recognize the sd card anymore

honest shoal
rocky trench
#

I got to get to someone with Linux or sum, or just buy a new micro sd

gaunt ice
#

PLS

cold sonnet
#

not even an sd card formatter could do it

boreal ravine
rocky trench
#

Might have to buy a new one

honest shoal
gaunt ice
placid skiff
gaunt ice
#

):

rocky trench
gaunt ice
copper gulch
potent spear
gaunt ice
copper gulch
#

ohhhh

boreal ravine
rocky trench
#

Its right next to my pc lol

potent spear
#

no need to be close when you can ssh locally

placid skiff
rocky trench
#

Cable management pain

honest shoal
#

did replit stopped supporting ffmpeg?

gaunt ice
boreal ravine
honest shoal
#

I'm unable to find proper info on google

potent spear
#

yeah, just hide it somewhere, wrap it up

gaunt ice
#

but i cloned a coded music bot in replit which uses ffmpeg it worked

rocky trench
#

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

potent spear
rocky trench
copper gulch
#

so it doesnt matter learning both discord.py and nextcord because its just desame xd

rocky trench
potent spear
rocky trench
rocky trench
copper gulch
rocky trench
#

Lets just focus on helping people again now

untold oriole
#

Hey guys, what do you think is a proper implementation to avoid spamming using discord.py ( not the cooldown )

cold sonnet
#

store messages with their creation times somewhere

cold sonnet
#

delete every message 10 seconds after

#

if there are 3 messages in those 10 seconds in that place

#

from the same author

#

he spamming

boreal ravine
#

thats normal

#

you just sent three messages under 10 seconds

cold sonnet
#

I'm spamming

boreal ravine
cold sonnet
maiden fable
boreal ravine
#

I think you can make a CD for messages

untold oriole
#

CD?

maiden fable
#

Cooldown

boreal ravine
#

The short form of "cooldown"

untold oriole
#

I was thinking more like, add a muted role disabling them to msg again for a while

rocky trench
rocky trench
#

How would I check a channel for messages, and if there are none in 30 minutes close it?

cold sonnet
#

get channel.last_message

rocky trench
#

Smart

cold sonnet
#

!d discord.Message.created_at

unkempt canyonBOT
rocky trench
#

But I would need to check this like every second no?

cold sonnet
#

utcnow - this date

rocky trench
#

CET

cold sonnet
#

The message’s creation time in UTC.

rocky trench
rocky trench
cold sonnet
#

like every minute in a task

#

it doesn't really matter until it fits your memory, you aren't really making an API call

maiden fable
distant pendant
honest vessel
#

or should i say corrupted?

honest vessel
#

cause they dont want u spam it

boreal ravine
#

probably no

sick birch
honest vessel
#

@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

modest plover
#

Hey so how do I use an API with a discord bot?

slow fog
#

you just have to change the output way

modest plover
#

Ok, lemme rephrase this, how do I use an API in general?

slow fog
#

what api

cold sonnet
#

how you use the dpy api

honest vessel
#

deends on what api

modest plover
#

Good question.

slow fog
#

bruh

modest plover
#

Lemme find it rq

slow fog
#

oh

modest plover
#

I didn't know the link for it, I just knew it was an ACNH api

slow fog
#

you have to make sure that the api are supporting python

#

or if it has some sort of key

honest vessel
#
#

its just json so you use it like any json call

modest plover
#
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.
slow fog
#

you can use it through an http/s requests

honest vessel
#

just learn to grab json and pick elements from it print to discord

slow fog
#

but you need to deal with the json format

slate swan
#

🏃‍♂️ just use aiohttp to get a response from the website and use the .json() method to convert it into a json/dictionary

honest vessel
#

request a website -> they return JSON -> pick json grab the elements u want -> send to discord

#

(i ean request as general not the lib)

modest plover
#

There's a lib called requests?

slate swan
#

yes,

honest vessel
#

but its not good for discord cause discord is an asyncronized lib

slow fog
slate swan
#

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)

unkempt canyonBOT
honest vessel
#

^

#

what i use very simple and does its job

modest plover
#

Do I need to do pip install?

honest vessel
#

yes

slate swan
honest vessel
#

oh ye aybe its a requierment of d.py

slate swan
honest vessel
#

next time u can just try import the lib and it will tell u if it exists or not

modest plover
#

Ah ok

maiden fable
#

😔 I am waiting for the time when libs start to use httpx which is gonna be never

honest vessel
#

ye dosnt matter

slate swan
#

or just search it up on the web frog_sip

honest vessel
#

then i would try pip it 😛

maiden fable
#

Stop slapping 😔

slate swan
#

Command raised an exception: AttributeError: 'Object' object has no attribute '_state'
any ideas on this error?

honest vessel
#

from what?

slate swan
honest vessel
#

but u trying to grab x._state? lol

slate swan
honest vessel
#

where u get that error from?

slate swan
honest vessel
#

nvr seen this warning so i pass

slate swan
#

ffs

#

!paste

unkempt canyonBOT
#

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.

slate swan
honest vessel
#

better

slow fog
slate swan
honest vessel
#

@slow foghis paste link the first one

slow fog
#

what?

modest plover
#

It doesn't download anything btw

slow fog
#

oh

modest plover
#

Yea

honest vessel
#

@slow foghttps://paste.iamgadget.co.uk/sekofakule.py

#

this url

modest plover
#

Discord flagged it as a potential download because it isn't a typically visited site on discord most likely, idfk

slow fog
#

sus

modest plover
#

Either that or its be sure it ends in .py

candid pilot
#
async def on_member_join(member):
   await bot.get_channel(950383739635114074).send(f"{member.name} has joined")``` why is it not working
honest vessel
unkempt canyonBOT
#

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.

slate swan
candid pilot
honest vessel
slow fog
candid pilot
modest plover
#

Lmao

slate swan
honest vessel
#

cause it ended with .py it alerted

slate swan
#

ig ill remove the extension from my links

honest vessel
#

suspect

slate swan
#

sus-file frog_sip

honest vessel
#

still

#

same warning

#

@slate swanare u trying to fish IPs?

true salmon
#

is nextcord or pycord better?

#

im currently using nextcord

slate swan
honest vessel
#

lol

#

that feels safer then tho