#discord-bots

1 messages Β· Page 586 of 1

slate swan
#

@mild token

supple thorn
#

@slate swan bot.event doesnt have ()

slate swan
#

okay same

mild token
slate swan
#

doesnt work

mild token
#

@slate swan can u show me more code

#

I mean show me full on_message code

#

And plz use

#

!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
#

@mild token

#

here is the full code

slate swan
mild token
#

Have u seen what I have tagged above?@slate swan

slate swan
mild token
#

U need process_command line

slate swan
midnight moat
#

so I'm trying to get my bot to join the voice chat I'm in when i run a command

here's what i have

@bot.command("join")
async def join(ctx):
    channel = ctx.author.voice.channel
    await channel.connect()```

but it just doesn't join, does anyone know what I'm doing wrong?
slate swan
slate swan
#

so why does it not work

slate swan
unkempt canyonBOT
#

Indentation

Indentation is leading whitespace (spaces and tabs) at the beginning of a line of code. In the case of Python, they are used to determine the grouping of statements.

Spaces should be preferred over tabs. To be clear, this is in reference to the character itself, not the keys on a keyboard. Your editor/IDE should be configured to insert spaces when the TAB key is pressed. The amount of spaces should be a multiple of 4, except optionally in the case of continuation lines.

Example

def foo():
    bar = 'baz'  # indented one level
    if bar == 'baz':
        print('ham')  # indented two levels
    return bar  # indented one level

The first line is not indented. The next two lines are indented to be inside of the function definition. They will only run when the function is called. The fourth line is indented to be inside the if statement, and will only run if the if statement evaluates to True. The fifth and last line is like the 2nd and 3rd and will always run when the function is called. It effectively closes the if statement above as no more lines can be inside the if statement below that line.

Indentation is used after:
1. Compound statements (eg. if, while, for, try, with, def, class, and their counterparts)
2. Continuation lines

More Info
1. Indentation style guide
2. Tabs or Spaces?
3. Official docs on indentation

slate swan
#

@slate swan delete it until the colon and just press enter

mild token
#

U need this line

slate swan
#

where?

mild token
#

Check the link

#

It has example

slate swan
#

oh okay

#

Hes giving you all the links you need if you dont follow we cant help you

slate swan
mild token
#

Try it and see

slate swan
mild token
#

@slate swan check how above on_message is used

#

Check both if

#

How it's written

slate swan
slate swan
slate swan
mild token
#

Indent once await process command line

#

@slate swan

#

And then try

gaunt herald
#
voiceChannel = discord.utils.get(ctx.guild.voice_channels, name='General')
mild token
#

Oo wait no

#

It should work@slate swan

slate swan
#

yeah but it doesnt sadly

mild token
#

Have u saved your file

slate swan
#

yess

mild token
#

Can I see your full code?

gaunt herald
mild token
#

!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.

mild token
#

Remove token then sebd

#

Send*

slate swan
#

!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.

slate swan
#

Like this

midnight moat
#
@bot.command("join")
async def join(ctx):
    channel = ctx.author.voice.channel
    await channel.connect()```

does anyone know why my bot isn't joining the VC I'm in when i run the command?
gaunt herald
#

I think this is outdated

mild token
slate swan
#

how can i check if a user is streaming/watching/viewing/listening to, ect

mild token
#

If yes then can u check what your discord.py version is

slate swan
gaunt herald
slate swan
#

now i removed both

mild token
midnight moat
gaunt herald
#

no

mild token
#

@slate swan frsh install and try then

slate swan
#

i re installed discord py

#

but now

slate swan
boreal ravine
#

!d discord.Intents you need a capital i

unkempt canyonBOT
#

class discord.Intents(**kwargs)```
Wraps up a Discord gateway intent flag.

Similar to [`Permissions`](https://discordpy.readthedocs.io/en/master/api.html#discord.Permissions "discord.Permissions"), the properties provided are two way. You can set and retrieve individual bits using the properties as if they were regular bools.

To construct an object you can pass keyword arguments denoting the flags to enable or disable.

This is used to disable certain gateway features that are unnecessary to run your bot. To make use of this, it is passed to the `intents` keyword argument of [`Client`](https://discordpy.readthedocs.io/en/master/api.html#discord.Client "discord.Client").

New in version 1.5...
slate swan
#

Dont know then

boreal ravine
slate swan
slate swan
boreal ravine
#

what else am I talking about then

slate swan
#

how do i check

boreal ravine
#

!d discord.version

unkempt canyonBOT
#

discord.__version__```
A string representation of the version. e.g. `'1.0.0rc1'`. This is based off of [**PEP 440**](https://www.python.org/dev/peps/pep-0440).
boreal ravine
#

Print that

slate swan
#

Did you imported intents?

boreal ravine
#

you dont need to import it

#

thats just optional

slate swan
#

Alr

#

Never knew

slate swan
boreal ravine
supple thorn
slate swan
#

I always import it tho

#

error

#

AttributeError: module 'discord' has no attribute 'version'

lethal heart
#

How to make button disabled in nextcord?

slate swan
supple thorn
#

Try that

boreal ravine
boreal ravine
supple thorn
slate swan
boreal ravine
#

wtf

slate swan
#

rip

supple thorn
#

What in tarnation

slate swan
#

how do i install discord py

#

πŸ₯²

boreal ravine
lethal heart
slate swan
#

now why does it not tell me version

boreal ravine
slate swan
#

yes

#

i think so

boreal ravine
#

can you show me the discord.__version__ part

slate swan
#

yes it is

boreal ravine
#

what does it print

slate swan
#

error

boreal ravine
#

hm

boreal ravine
gaunt herald
#

voiceChannel = discord.utils.get(ctx.guild.voice_channels, name='General') how to change this to if member in voice channel join it

slate swan
robust ridge
#

hi i need help with an embed sayin user has been banned

#

and user replaced with the user that has been banneed

boreal ravine
robust ridge
#

in one line

boreal ravine
slate swan
#

same with pip3

final iron
robust ridge
#

ye but like

mild token
robust ridge
#

the code with description

robust ridge
boreal ravine
mild token
robust ridge
#

just in one line cus ive tried

final iron
#

Why would you want it all on 1 line?

boreal ravine
unkempt canyonBOT
#

class discord.Member```
Represents a Discord member to a [`Guild`](https://discordpy.readthedocs.io/en/master/api.html#discord.Guild "discord.Guild").

This implements a lot of the functionality of [`User`](https://discordpy.readthedocs.io/en/master/api.html#discord.User "discord.User").

x == y Checks if two members are equal. Note that this works with [`User`](https://discordpy.readthedocs.io/en/master/api.html#discord.User "discord.User") instances too.

x != y Checks if two members are not equal. Note that this works with [`User`](https://discordpy.readthedocs.io/en/master/api.html#discord.User "discord.User") instances too.

hash(x) Returns the member’s hash.

str(x) Returns the member’s name with the discriminator.
robust ridge
#

i made it on 2 different lines

mild token
#

!d discord.Embed

unkempt canyonBOT
#

class discord.Embed(*, colour=Embed.Empty, color=Embed.Empty, title=Embed.Empty, type='rich', url=Embed.Empty, description=Embed.Empty, timestamp=None)```
Represents a Discord embed.

len(x) Returns the total size of the embed. Useful for checking if it’s within the 6000 character limit.

bool(b) Returns whether the embed has any data set.

New in version 2.0.

Certain properties return an `EmbedProxy`, a type that acts similar to a regular [`dict`](https://docs.python.org/3/library/stdtypes.html#dict "(in Python v3.9)") except using dotted access, e.g. `embed.author.icon_url`. If the attribute is invalid or empty, then a special sentinel value is returned, [`Embed.Empty`](https://discordpy.readthedocs.io/en/master/api.html#discord.Embed.Empty "discord.Embed.Empty").

For ease of use, all parameters that expect a [`str`](https://docs.python.org/3/library/stdtypes.html#str "(in Python v3.9)") are implicitly casted to [`str`](https://docs.python.org/3/library/stdtypes.html#str "(in Python v3.9)") for you.
slate swan
robust ridge
#

or i just want the tag and the sentence

slate swan
#

okay i think it worked?

#

the command i mean

mild token
# slate swan

How many python version u have in your system mate?

slate swan
#

not the code sadly

mild token
slate swan
#

code still give me error

mild token
#

With full traceback

slate swan
boreal ravine
robust ridge
#

example?

slate swan
#

😭

mild token
#

@slate swan remove and in console do pip show discord.py

robust ridge
#

member.?

mild token
boreal ravine
slate swan
#

i found the version!

boreal ravine
#

hm

slate swan
#

πŸ₯²

robust ridge
boreal ravine
robust ridge
#

like what do i add between them

slate swan
robust ridge
#

ok ok calm down lol

boreal ravine
mild token
#

@slate swan now try the code and remove that print statement

mild token
slate swan
robust ridge
#

user tag

slate swan
#

Or a users name

robust ridge
#

mention i dont mind

boreal ravine
slate swan
robust ridge
#

lol ik that

#

its just that idk how to like add it

boreal ravine
unkempt canyonBOT
robust ridge
#

when i add a new field or just on the same line as embed= etc

boreal ravine
robust ridge
#

like the name and description

robust ridge
slate swan
boreal ravine
robust ridge
#

nonono

#

ok so how do i add it in one line without getting error

#

cus it will be in different lines

#

if i use description and name

#

or title etc

boreal ravine
#

What do you wanna add?

robust ridge
#

just to make it in one line...

mild token
boreal ravine
#

Oh

mild token
#

Try this

slate swan
#

If iirc(f"{member.mention}")

robust ridge
#

TY

boreal ravine
slate swan
#

now i get this

boreal ravine
slate swan
#

how

robust ridge
#

ye but lemme try what @slate swan gave me

mild token
robust ridge
#

o

boreal ravine
mild token
unkempt canyonBOT
#

Please provide the full traceback for your exception in order to help us identify your issue.

A full traceback could look like:

Traceback (most recent call last):
    File "tiny", line 3, in
        do_something()
    File "tiny", line 2, in do_something
        a = 6 / b
ZeroDivisionError: division by zero

The best way to read your traceback is bottom to top.

β€’ Identify the exception raised (in this case ZeroDivisionError)
β€’ Make note of the line number (in this case 2), and navigate there in your program.
β€’ Try to understand why the error occurred (in this case because b is 0).

To read more about exceptions and errors, please refer to the PyDis Wiki or the official Python tutorial.

slate swan
#

I dont really know what he wants but im glad to help

boreal ravine
slate swan
#

there is no 2.0?

boreal ravine
mild token
slate swan
#

where?

boreal ravine
slate swan
#

can u link

boreal ravine
boreal ravine
#

google exists for a reason

slate swan
#

before installing it

boreal ravine
#

I guess idrk

slate swan
#

it is a rabbit hole now

#

😞

boreal ravine
#

wait nvm

slate swan
slate swan
warm bane
spiral frigate
#

I do not know why it is not added outputs an error I will attach an image of the base

Ignoring exception in on_member_join
Traceback (most recent call last):
  File "C:\Users\Baraban4ik\AppData\Local\Programs\Python\Python310\lib\site-packages\disnake\client.py", line 505, in _run_event
    await coro(*args, **kwargs)
  File "O:\Suzuki\cogs\settings.py", line 186, in on_member_join
    await member.add_roles(auto_role)
  File "C:\Users\Baraban4ik\AppData\Local\Programs\Python\Python310\lib\site-packages\disnake\member.py", line 898, in add_roles
    await req(guild_id, user_id, role.id, reason=reason)
AttributeError: 'Int64' object has no attribute 'id'

code

    @commands.Cog.listener()
    async def on_member_join(self, member):
        auto_role = self.collection.find_one({"_id": _id})["auto_role"]

        if auto_role == None:
            pass
        else:
            await member.add_roles(auto_role) 
slate swan
#

@spiral frigate You have to get it

#

!d discord.Guild.get_role

unkempt canyonBOT
warm bane
#

if I wanted to convert this to the format you would use for cogs, then what would it look like in the cog?

class Dropdown(discord.ui.Select):

I keep getting errors using the fields in the Select struct and not sure how to properly call it. I have the source code up for Select and verified i have the variable names correctly spelled. Still a noob here and kinda lost.

spiral frigate
#

so

            auto_role =  guild.get_role(auto_role)
            await member.add_roles(auto_role) 
slate swan
#

mhm

ornate lichen
#
Traceback (most recent call last):
  File "/Users/aarav/Library/Python/3.8/lib/python/site-packages/discord/ext/commands/core.py", line 85, in wrapped
    ret = await coro(*args, **kwargs)
  File "/Users/aarav/Documents/GitHub/awaffle_bot/main.py", line 104, in help
    embed = discord.embed(
AttributeError: module 'discord' has no attribute 'embed'

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/Users/aarav/Library/Python/3.8/lib/python/site-packages/discord/ext/commands/bot.py", line 939, in invoke
    await ctx.command.invoke(ctx)
  File "/Users/aarav/Library/Python/3.8/lib/python/site-packages/discord/ext/commands/core.py", line 863, in invoke
    await injected(*ctx.args, **ctx.kwargs)
  File "/Users/aarav/Library/Python/3.8/lib/python/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: AttributeError: module 'discord' has no attribute 'embed'```
slate swan
#

discord.Embed ^^

lethal heart
#

.

ornate lichen
#

oh lol

#

tysm

warm bane
#
import discord
from discord.ext import commands

class Menu(commands.Cog):  # Category type is the class
  def __init__(self, bot): # using self bc using class
    self.bot = bot

  @commands.command(brief="Provides a menu of all Bot commands")
  async def menu(self, ctx):
    
    await ctx.send(
      content = 'Select an option:', 
      #discord.placeholder('Please select an option.'),
      options = [
                  discord.SelectOption(label='Option 1', description='This is option 1', value='1'),
                  discord.SelectOption(label='Option 2', value='2'),
                  discord.SelectOption(label='Option 3', value='3'),
                  discord.SelectOption(label='Cancel', value='Cancel'),
                ],
      custom_id='MainMenu'
    )
    interaction = await self.bot.wait_for('select_option', check=lambda inter: inter.custom_id == 'MainMenu' and inter.user == ctx.author)
    res=interaction.values[0]

    if res == 'Cancel':
      await interaction.send('You have canceled your select option')
    else:
      await interaction.send('You have selected %s option' % (res.label))


def setup(bot):
  bot.add_cog(Menu(bot))

slate swan
#

commands.Cog or command.Cog idk which one

boreal ravine
#

Cog is from the commands extension

warm bane
#

the error gets stuck with placeholder and options

slate swan
#

so commands.Cog

#

I dont think that content="" is needed

midnight moat
#
@bot.command("join_v")
async def join_v(ctx):
    connected = ctx.author.voice
    if connected:
        await connected.channel.connect()```

does anyone know why my bot won't join the voice channel
warm bane
#

the current code compiles. when i run it, i get this error: Command raised an exception: TypeError: send() got an unexpected keyword argument 'options'

slate swan
#

@bot.command(name="join_v")

warm bane
#

i tried discord.options, discord.ui.Select.options

midnight moat
warm bane
#

neither worked. self.options didn't work either

slate swan
#

aka jishaku

#

bot.load_extension("jishaku")

#

<prefix>jsk dbg <command>

lethal heart
#

.

midnight moat
#

It gave me an error

#

NameError: name 'bot' is not defined
not sure what i did lolll

slate swan
#

put it under your
bot = commands.Bot

midnight moat
#

discord.ext.commands.errors.ExtensionNotFound: Extension 'jishaku' could not be loaded

simple kettle
visual island
#

?

visual island
ornate lichen
#
def get_dog():
 url = " https://api.thedogapi.com/v1/images/search"

 querystring = {"min":"10","max":"20","fragment":"true","json":"true"}

 headers = {
    'x-api-key': "------"
    }

 response = requests.request("GET", url, headers=headers, params=querystring)
 json_data=json.loads(response.text)
 return(dog)

@client.command()
async def dog(ctx):  
  dog=get_dog()
  await ctx.channel.send(dog)
#

i want it to return an image

#

but its giving back the word 'dog'

midnight moat
boreal ravine
boreal ravine
ivory sluice
#

Anyone knows how to setup lavalink/wavelink in heroku?

boreal ravine
#

Bruh

boreal ravine
#

return(dog)

slate swan
#

oops, i had my phone ontop of my keyboard

ornate lichen
boreal ravine
midnight moat
boreal ravine
#

so outdated

midnight moat
#

i forgot about the bot for a while

boreal ravine
#

Well

#

wont work on earlier versions on dpy

heavy folio
#

is mongodb safe

boreal ravine
heavy folio
#

people say its easy to hack :/

slate swan
#

so i figured out variable shadowing is causing this issue with my bot

#

and yes i installed 2.0

#

but which one do i rename /remove now

#

πŸ₯²

dapper cobalt
midnight moat
#

wait im using the most recent version of discord.py i think so idk why jsk is giving error

heavy folio
#

i use the "generate a secure password" thing

#

so its random letters (but ofc i do note it donw)

slate swan
#

hello people

#

@boreal ravine hello again!

#

im here rdy to learn another challenge that ive set myself against

#

how can i check if a user has rich presence

#

for example, playing, streaming, watching, listening to, ect

boreal ravine
#

!d discord.Member.activity

unkempt canyonBOT
#

property activity: Optional[Union[discord.activity.Activity, discord.activity.Game, discord.activity.CustomActivity, discord.activity.Streaming, discord.activity.Spotify]]```
Returns the primary activity the user is currently doing. Could be `None` if no activity is being done.

Note

Due to a Discord API limitation, this may be `None` if the user is listening to a song on Spotify with a title longer than 128 characters. See [GH-1738](https://github.com/Rapptz/discord.py/issues/1738) for more information.

Note

A user may have multiple activities, these can be accessed under [`activities`](https://discordpy.readthedocs.io/en/master/api.html#discord.Member.activities "discord.Member.activities").
slate swan
#

ty

boreal ravine
#

I don't think its recommended to do things like this

slate swan
#

how do i fix variable shadowing??

#

that just filled my whole screen

torpid dew
#

sorry

slate swan
#

mhm for trying to sell my own vanity again

slate swan
slate swan
#

@slate swan

#

damn, had a good tag too

#

ik

#

i once got termed and my tag was 0097

boreal ravine
torpid dew
slate swan
#

||switch statements||

boreal ravine
torpid dew
slate swan
#

lol

boreal ravine
slate swan
#

no.

torpid dew
#

?

slate swan
#

i had a 0015 tag and got termed which made me so mad cuz 1 and 5 are my fav numbs

#

i am sure he is not

torpid dew
#

im using 3.8.2

slate swan
slate swan
#

@slate swan @slate swan @slate swan

#

rip all my accounts </3

#

i honestly only get termed for tryna sell my own vanitys but

#

its like my boost badge gets set back a month each term

boreal ravine
slate swan
#

ToS

boreal ravine
#

just dont break tos its that easy

slate swan
#

haha

#

not for them

slate swan
dapper cobalt
# torpid dew wdym

He means this.

let variable = "value"
switch (variable) {
    case 'value':
        console.log("variable is equal to value!")
    case 'notValue':
        console.log("variable is not equal to value!")
}
slate swan
#

the systems bias to me peace

slate swan
#

I had no clue selling a vanity i worked for was against ToS to sell

slate swan
boreal ravine
slate swan
#

you cant sell servers accounts or vanitys

dapper cobalt
#

Not a thing in Python. I know that it's in only JavaScript.

boreal ravine
#

it is

boreal ravine
#

its in 3.10

dapper cobalt
torpid dew
dapper cobalt
boreal ravine
#

yeah

slate swan
#

😭 can someone please help me with fixing variable shadowing

dapper cobalt
#
match subject:
    case <pattern_1>:
        <action_1>
    case <pattern_2>:
        <action_2>
    case <pattern_3>:
        <action_3>
    case _:
        <action_wildcard>
slate swan
#

its just a swtich statement in scooby doo mask

boreal ravine
ornate lichen
#

any suggestions on free web hosting services to host my code

maiden fable
slate swan
#

I need help creating options in slash commands of a Discord bot.

@slash.slash(name="optionTest", description="Test options", guild_ids=[GUILD ID])
async def _optionTest(ctx:SlashContext, message):
  if len(message) > 1:
    ctx.send(message)
  else:
    ctx.send("Hello world!")

I want to know how to create optional options, option descriptions.
Please give me a code snippet of how to do this. Thanks~

maiden fable
#

Which library

loud goblet
#

hi

#
We have logged in as None
[youtube] gdZLi9oWNZg: Downloading webpage
[youtube] Downloading just video gdZLi9oWNZg because of --no-playlist

Ignoring exception in command play:
Traceback (most recent call last):
  File "C:\Users\91976\AppData\Local\Programs\Python\Python39\lib\site-packages\discord\ext\commands\core.py", line 85, in wrapped
    ret = await coro(*args, **kwargs)
  File "C:\Users\91976\PycharmProjects\Beatz\main.py", line 42, in play
    voice.play(FFmpegPCMAudio(URL, **FFMPEG_OPTIONS))
  File "C:\Users\91976\AppData\Local\Programs\Python\Python39\lib\site-packages\discord\player.py", line 225, in __init__
    super().__init__(source, executable=executable, args=args, **subprocess_kwargs)
  File "C:\Users\91976\AppData\Local\Programs\Python\Python39\lib\site-packages\discord\player.py", line 138, in __init__
    self._process = self._spawn_process(args, **kwargs)
  File "C:\Users\91976\AppData\Local\Programs\Python\Python39\lib\site-packages\discord\player.py", line 147, in _spawn_process
    raise ClientException(executable + ' was not found.') from None
discord.errors.ClientException: ffmpeg was not found.

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "C:\Users\91976\AppData\Local\Programs\Python\Python39\lib\site-packages\discord\ext\commands\bot.py", line 939, in invoke
    await ctx.command.invoke(ctx)
  File "C:\Users\91976\AppData\Local\Programs\Python\Python39\lib\site-packages\discord\ext\commands\core.py", line 863, in invoke
    await injected(*ctx.args, **ctx.kwargs)
  File "C:\Users\91976\AppData\Local\Programs\Python\Python39\lib\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: 
ClientException: ffmpeg was not found.```
#

This is the error I get when try to play a song

#

I've installed ffmpeg using py pip install ffmpeg

#

what am I doing wrong here

#
@client.command()
async def play(ctx, url):
    YDL_OPTIONS = {'format': 'bestaudio', 'noplaylist': 'True'}
    FFMPEG_OPTIONS = {
        'before_options': '-reconnect 1 -reconnect_streamed 1 -reconnect_delay_max 5', 'options': '-vn'}
    voice = get(client.voice_clients, guild=ctx.guild)

    if not voice.is_playing():
        with YoutubeDL(YDL_OPTIONS) as ydl:
            info = ydl.extract_info(url, download=False)
        URL = info['url']
        print(URL)
        voice.play(FFmpegPCMAudio(URL, **FFMPEG_OPTIONS))
        voice.is_playing()
        await ctx.send('Bot is playing')```
elder meteor
#

i need a code on how the bot deletes a message(even if its from the bot itself) if the message mentions a word or sentence, the thing is i want it to work only in one specific server,

boreal ravine
boreal ravine
loud goblet
elder meteor
boreal ravine
#

what IDE are you using

supple thorn
loud goblet
loud goblet
#

I've posted my error above @boreal ravine

loud goblet
boreal ravine
#

well the error says ClientException: ffmpeg was not found. it means you didnt install ffmpeg yet

#

Also we dont help with ytdl

#

!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)
loud goblet
#

the thing is that I have installed it

#

tried uninstalling it

supple thorn
#

If so

torpid dew
#

how to see if channel name is a channel in server

#

how do i do that

supple thorn
#

!d discord.Message.delete

unkempt canyonBOT
#

await delete(*, delay=None)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).

Deletes the message.

Your own messages could be deleted without any proper permissions. However to delete other people’s messages, you need the [`manage_messages`](https://discordpy.readthedocs.io/en/master/api.html#discord.Permissions.manage_messages "discord.Permissions.manage_messages") permission.

Changed in version 1.1: Added the new `delay` keyword-only parameter.
torpid dew
#

?

supple thorn
#

Talking to someone else

torpid dew
#

oh

#

how to see if channel name is a channel in server
how do i do that

shy schooner
#
if channel.name in [channel.name for channel in some_guild]:
      # stuff
haughty sedge
#
members = len(member.guild.members)
print(members)
bots = len([m for m in member.guild.members if m.bot==True])```
im getting no error but why the data is always so same
#

does it takes time to update???

#

is there an event for whenever the member count is updated ????

shy schooner
haughty sedge
#

but i want to fetch the server count on it and many times the server count is same why so

shy schooner
#

how do u count the number of members

haughty sedge
#

len(member.guild.members) works probably

shy schooner
#

where did you define member

haughty sedge
#

its a parameter of on_member_join

#

on_member_join(member)

#

so can anyone tell me does it takes time to update member count because its nearly almost always same, if it takes time then how much???

slate swan
#

How could I block 1 person completely from using my bot

loud junco
#

can someone send the link? that i can paste code inside

#

cuz idk its my luck or its not working

boreal ravine
#

!pate

unkempt canyonBOT
#
Did you mean ...

pathlib
windows-path
relative-path

boreal ravine
#

!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.

loud junco
#

thanks

#

the 25% of getting pogchop from pig and angrypig is very rare

#

is it bug?

haughty sedge
#
async def sometask():
  await client.wait_until_ready()
  print('task executed')
  await asyncio.sleep(5)
client.loop.create_task(sometask())

#

it only runs the task once why so????

#

its not a loop

#

i want it to run every 5 seconds

#

is this channel dead or wut 😩 i used to get instant replies here

maiden fable
#

What happened

#

Just use ext.tasks

#

!d discord.ext.tasks.Loop

unkempt canyonBOT
#

class discord.ext.tasks.Loop```
A background task helper that abstracts the loop and reconnection logic for you.

The main interface to create this is through [`loop()`](https://discordpy.readthedocs.io/en/master/ext/tasks/index.html#discord.ext.tasks.loop "discord.ext.tasks.loop").
haughty sedge
#

i think thats what im doing, im creating the task

maiden fable
#

Then just do sometask.start()

#

!d discord.ext.tasks.Loop.start

unkempt canyonBOT
haughty sedge
#

oh

#

if i edit same channel every 30 seconds will my bot get rate limited ?

boreal ravine
#

I guess but a bot can only change a channel name once everyone 5 minutes

haughty sedge
#

what ?

boreal ravine
#

Β―_(ツ)_/Β―

haughty sedge
#

is it ok to change bot's status every 10 seconds ???

#

IS ANYONE HERE

loud junco
#

what is the function to get user id

haughty sedge
#

after every how many seconds

#

30 ?

#

is 45 ok?

#

WHY is rate limits so less

tawdry perch
#

why would you need to change it so fast anyways

haughty sedge
#

60 seconds? πŸ₯Ί

haughty sedge
#

changing status every 60 seconds is ok right? πŸ₯Ί

tawdry perch
#

I don't know

haughty sedge
#

uhh

tawdry perch
#

Maybe discord API docs have smth

haughty sedge
#

k

#

status changing rate limit is not there

manic wing
#

just use common sense for most things

manic wing
slate swan
#

Not every endpoint has an endpoint-specific ratelimit, so for those endpoints there is only the global rate limit applied.

Global Rate Limit
All bots can make up to 50 requests per second to our API. This is independent of any individual rate limit on a route. If your bot gets big enough, based on its functionality, it may be impossible to stay below 50 requests per second during normal operations.

loud junco
#

someone pls answer my question ;-;

#

what is the function to get user id

loud junco
maiden fable
#

No

slate swan
maiden fable
#

It's a property

loud junco
#

oo ok

maiden fable
#

Not a function/method

loud junco
#

ok

#

im stuck with the id thing

#

with my discord bot ;-;

slate swan
#

And? What's the problem?

#

Sadly we can't guess your errors

boreal ravine
unkempt canyonBOT
tawdry perch
#

some of my code raises CheckFailure, how can I handle them in global error handlers?

maiden fable
#

Just like u handle other errors?

sweet geyser
#

!e

print("```s```")
unkempt canyonBOT
#

@sweet geyser :x: Your eval job has completed with return code 1.

001 |   File "<string>", line 1
002 |     print("
003 |           ^
004 | SyntaxError: unterminated string literal (detected at line 1)
maiden fable
#

Uhhhh?

slate swan
sweet geyser
#

it tried to break the code block

#

```s```

#

by making it print this

slate swan
#

Then go in #bot-commands for random commands

maiden fable
#

#bot-commands

#

Yea

sweet geyser
#

oh no my bad

maiden fable
#

BTW

#

Use """ if u want mutliline strings

boreal ravine
#

we knew that already

maiden fable
#

That person used "

boreal ravine
#

why is markdown for about me different for mobile and pc

maiden fable
#

Is it? Idk

boreal ravine
maiden fable
#

Idk

#

Anyways, its ot

slate swan
#

Because it's Discord

#

What did you expect kek

manic wing
#

he says while having nitro and badges

slate swan
#

?

boreal ravine
#

Β―_(ツ)_/Β―

slate swan
#

hello (β•―Β°β–‘Β°οΌ‰β•―οΈ΅ ┻━┻

tawdry perch
# maiden fable Just like u handle other errors?

it might be smth like this, but how do I make it send the message or what checkfailure happened? ```py
elif isinstance(error, commands.CheckFailure):
await ctx.send(f"CheckFailure on {commands.CheckFailure}")

reef shell
#

{error}

#

error contains the error message

tawdry perch
#

oo I'll try that

maiden fable
robust ridge
#

quick help with embed

#

i just want 1 line saying

#

(mentionsuser) has been unbanned

#

all ik is

#
embed = discord.Embed(dont know the rest)
boreal ravine
#

!d discord.Member.mention

unkempt canyonBOT
robust ridge
#

lmao hi again

#

OH

#

THATS WHAT U MEAN

#

OMG LEMME TRY

#

but how do i add it in a code

#

is it like this?

#
      embed = discord.Embed(discord.Member.mention "has been unbanned")

tawdry perch
#

!d discord.Embed

unkempt canyonBOT
#

class discord.Embed(*, colour=Embed.Empty, color=Embed.Empty, title=Embed.Empty, type='rich', url=Embed.Empty, description=Embed.Empty, timestamp=None)```
Represents a Discord embed.

len(x) Returns the total size of the embed. Useful for checking if it’s within the 6000 character limit.

bool(b) Returns whether the embed has any data set.

New in version 2.0.

Certain properties return an `EmbedProxy`, a type that acts similar to a regular [`dict`](https://docs.python.org/3/library/stdtypes.html#dict "(in Python v3.9)") except using dotted access, e.g. `embed.author.icon_url`. If the attribute is invalid or empty, then a special sentinel value is returned, [`Embed.Empty`](https://discordpy.readthedocs.io/en/master/api.html#discord.Embed.Empty "discord.Embed.Empty").

For ease of use, all parameters that expect a [`str`](https://docs.python.org/3/library/stdtypes.html#str "(in Python v3.9)") are implicitly casted to [`str`](https://docs.python.org/3/library/stdtypes.html#str "(in Python v3.9)") for you.
boreal ravine
#

get the member object > pass a mention attr to it

robust ridge
#

example pls?

tawdry perch
# reef shell {error}

It gave me this ```
CheckFailure on <class 'discord.ext.commands.errors.CheckFailure'>

reef shell
#

did you try what i said

mild token
tawdry perch
#

Yep I used {error}

robust ridge
#

OH F STRING

#

TY

mild token
# robust ridge TY

Np plz turn off caps,it looks like u r yellingπŸ˜… even if you are not

robust ridge
#

oh uh ty

mild token
#

πŸ™‚

reef shell
#

i don't know what you are missing there, try error.original

mild token
mild token
reef shell
mild token
#

πŸ‘

#

Oo wait wrong ping

boreal ravine
reef shell
boreal ravine
#

the member object in this case was user so all he had to do was add a mention attr to it

mild token
#

People don't read sometimes or notices what we have written πŸ˜…

reef shell
steady cliff
reef shell
boreal ravine
reef shell
steady cliff
#

what do you prefer among them

tawdry perch
#

oh wait now I noticed what you mean for me to look from there πŸ˜…

boreal ravine
#

😎

reef shell
#

easiest rewrite

boreal ravine
#

does edpy have slash commands

reef shell
#

Yes

boreal ravine
#

hm

#

edpy cringe

reef shell
#

why

boreal ravine
#

a developer of edpy stole another forks' vanity url

reef shell
#

I don’t think so,
that doesn’t make the whole edpy cringe

boreal ravine
#

the lib kinda dead imo

reef shell
#

it was not alive in the first place

boreal ravine
#

hm

tawdry perch
boreal ravine
tawdry perch
boreal ravine
#

hm

reef shell
#

wdym lol
All of the errors there are subclasses of commands.CheckFailure

#

πŸ’€

tawdry perch
#

But the message is not there

#

I would give example if I had one

reef shell
#

I use my error handler this way

#

No issues i got so far

tawdry perch
#
raise CheckFailure('The check functions for command {0.qualified_name} failed.'.format(self))

discord.ext.commands.errors.CheckFailure: The check functions for command mute failed.
``` I'm looking for that message
reef shell
#

show the code of your error handler

tawdry perch
#
elif isinstance(error, commands.CheckFailure):
    await ctx.send(f"CheckFailure on ({error})")
reef shell
#

2 linesrooMonkaS

tawdry perch
#

you mean the whole?

reef shell
#

Yes

slate swan
#

import discord
from discord.ext import commands
import os
import asyncio
import datetime

client = commands.Bot(command_prefix = "? ")

@client.event
async def on_ready():
print("{0.user} is ready!".format(client))

snipe_message_content = None
snipe_message_author = None
snipe_message_discriminator = None
snipe_message_avatar = None

@client.event
async def on_message_delete(message):

global snipe_message_content
global snipe_message_author
global snipe_message_discriminator
global snipe_message_avatar

snipe_message_content = message.content
snipe_message_author = message.author.id
snipe_message_discriminator = message.author.discriminator
snipe_message_avatar = message.author.avatar_url
await asyncio.sleep(60.0)
snipe_message_author = None
snipe_message_content = None
snipe_message_discriminator = None
snipe_message_avatar = None

@client.command()
async def snipe(message):
if snipe_message_content==None:
await message.channel.send("There's nothing to snipe!")
else:
embed = discord.Embed(description=f'{snipe_message_content}', timestamp= datetime.datetime.utcnow(), color= discord.Colour.from_rgb(205, 30, 112))
embed.set_author(name=f"{snipe_message_author}#{snipe_message_discriminator}", icon_url= snipe_message_avatar)
await message.channel.send(embed=embed)
return

@client.event
async def on_message_delete(message):

print(f"{message.author.name} deleted a message: '{message.content}'")

client.run('token')

im trying to make a snipe command but it's always saying "there's nothing to snipe" idk what i did wrong

tawdry perch
reef shell
#

error = getattr(error, 'original', error)

torpid dew
#

how do i check if channel is in server

tawdry perch
#

I'll try that

reef shell
torpid dew
slate swan
torpid dew
reef shell
torpid dew
#

if there is a channel called {x} in server

reef shell
#

!d discord.abc.GuildChannel

unkempt canyonBOT
#

class discord.abc.GuildChannel```
An ABC that details the common operations on a Discord guild channel.

The following implement this ABC...
torpid dew
#

how about server

reef shell
torpid dew
#

in server

reef shell
torpid dew
reef shell
#

Bruh

reef shell
#

What do you want actually

tawdry perch
reef shell
#

pleasure

torpid dew
#

if it is, it sends something

#

else sends smthing else

reef shell
torpid dew
#

well bot is only in 1, private bot

torpid dew
#

in, if there is a channel name called that in the server

reef shell
#

You are confusing me rooMonkaS

torpid dew
#

if and else not in server

reef shell
#

Can u tell me in brief what are you trying to do?
explicitly

torpid dew
#

it checks if a specific channel name is in the server

reef shell
#

and from where the channel name comes?

#

a command arg?

torpid dew
reef shell
#

Then use discord.utils.get

#

!d discord.utils.get

unkempt canyonBOT
#

discord.utils.get(iterable, **attrs)```
A helper that returns the first element in the iterable that meets all the traits passed in `attrs`. This is an alternative for [`find()`](https://discordpy.readthedocs.io/en/master/api.html#discord.utils.find "discord.utils.find").

When multiple attributes are specified, they are checked using logical AND, not logical OR. Meaning they have to meet every attribute passed in and not one of them.

To have a nested attribute search (i.e. search by `x.y`) then pass in `x__y` as the keyword argument.

If nothing is found that matches the attributes passed, then `None` is returned.

Examples

Basic usage...
torpid dew
#

what do u do with it

#

channel, server

reef shell
#

Iterate through your guild channels

dry pelican
#

ctx.guild.channels?

reef shell
#

If a channel with that name exists then It'll return the channels

#

Or None if no channels were found with that name

reef shell
#

!d discord.Guild.channels

unkempt canyonBOT
dry pelican
reef shell
reef shell
#

channel= discord.utils.get(ctx.guild.channels, name="ch_name")

dry pelican
#

yea you can do that, ig.

#
if channel:
 # Channel Found
else: 
 # No Channel
torpid dew
#

?

torpid dew
#

where do u put server

reef shell
#

What do you not understand in that line

torpid dew
#

where do i put server

#

server id

#

channel name/id

reef shell
torpid dew
#

but i dont get it, im new

torpid dew
#

server id

dry pelican
#

ctx.guild

reef shell
#

guild=server ffs

dry pelican
#

will give the server of the message of the command

#

where it was written

#

and .channels is the list of its channels

torpid dew
#

ill try

loud junco
#

im thinking how to build inventory system

#

im done with the printing part

torpid dew
# reef shell ...
if channel1:
    await ctx.send(f'The note has been added to \n<#{channel_id}>')
 # Channel Found
  else: 
    await ctx.send('Error, class not found or subject not found.')
 # No Channel
#

doesnt work, keeps giving else

reef shell
#

Show full code snippet, we are not some magician who can see your code magically and help you debug

torpid dew
# reef shell Show full code snippet, we are not some magician who can see your code magicall...
@client.command()
async def note(ctx, message=None):
  await ctx.send('msg')
  msg1 = await client.wait_for("message")
  msg2 = msg1.content
  msg5 = msg2.lower()
  await ctx.send("msg")

  msg = await client.wait_for("message")
  msg3 = msg.content
  msg4 = msg3.lower()
  channel = discord.utils.get(client.get_all_channels(), name=f"{msg5}-{msg4}-notes")
  await channel.send(message)
  channel_id = channel.id

  channel1= discord.utils.get(ctx.guild.channels, name=channel) 
  if channel1:
    await ctx.send(f'The note has been added to \n<#{channel_id}>')
 # Channel Found
  else: 
    await ctx.send('Error')
 # No Channel
supple thorn
loud junco
#

can u ping me after u solved ur problem @torpid dew

#

cuz i also need help

reef shell
reef shell
torpid dew
#

?

torpid dew
#

channel = discord.utils.get(client.get_all_channels(), name=f"{msg5}-{msg4}-notes")

reef shell
#

What is this

torpid dew
#

just i need message to say it works

reef shell
#

How is that supoosed to be a channel name

torpid dew
#

it works

reef shell
#

also you are not checking the message in wait for

reef shell
#

πŸ‘

torpid dew
#

message

#

if not sent then error msg

reef shell
#

We said to use ctx.guild.channels

loud junco
#

not sure if this help

#

;-;

reef shell
#

store the message obj in a variable then edit it

#

!d discord.Message.edit

unkempt canyonBOT
#

await edit(content=..., embed=..., embeds=..., attachments=..., suppress=..., delete_after=None, allowed_mentions=..., view=...)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).

Edits the message.

The content must be able to be transformed into a string via `str(content)`.

Changed in version 1.3: The `suppress` keyword-only parameter was added.
loud junco
#

oo thats js

#

didnt realise that

#

im noob

#

oo

#
@bot.event
async def on_message(message):
  if message.content == 'test':
    await message.channel.send('Hello World!')
    await message.edit(content='testtest')
tawdry perch
#

how do I get a mesage? It was smth like fetch but I don't remember it

visual island
#

but it's an api call

tawdry perch
#

hmm

visual island
#

!d discord.abc.Messageable.fetch_message

unkempt canyonBOT
#

await fetch_message(id, /)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).

Retrieves a single [`Message`](https://discordpy.readthedocs.io/en/master/api.html#discord.Message "discord.Message") from the destination.
loud junco
#

this is the power of stackoverflow

#

🀣

tawdry perch
visual island
loud junco
#

wait idk

#

@bot.event
async def on_message(message):
if message.content == 'test':
await message.channel.send('Hello World!')
await message.edit(content='testtest')

visual island
tawdry perch
loud junco
#

lemme google

visual island
loud junco
#
from discord import Embed

...

first_embed = Embed(title='embed 1')
new_embed = Embed(title='embed 2')

# send a first message with an embed
msg = await ctx.send(embed=first_embed)

# edit the embed of the message
await msg.edit(embed=new_embed)
```will this work? @slate swan
tawdry perch
#

not a problem

visual island
#

if you want to get the attribute(s) of the message you can use Bot._connection._get_message(id)

tawdry perch
visual island
tawdry perch
#

hmm

loud junco
#

ok

visual island
loud junco
#

me helping people to stackoverflow things that i dont understand =.=

tawdry perch
visual island
tawdry perch
visual island
#

!d discord.ext.commands.MessageConverter you can use MessageConverter for that

unkempt canyonBOT
#

class discord.ext.commands.MessageConverter(*args, **kwargs)```
Converts to a [`discord.Message`](https://discordpy.readthedocs.io/en/master/api.html#discord.Message "discord.Message").

New in version 1.1.

The lookup strategy is as follows (in order)...
tawdry perch
#

hm I c

#

I'll look about that in docs

loud junco
#
item = {
  'mobdrop': {
    'pogchop' : 0,
    'eye_of_ender' : 0
  },
    
  'misc':{
    'cobble' : 0,
    'coal' : 0,
    'wood' : 0,
    'bed' : 0
  },
    
  'illegal': {
    'bedrock' : 0,
    'bedrock_trophy' : 0,
    'pogchamp' : 0
  }
}
#######################################################
async def show_inv(message):
  res = '__items__\n'
  for name, val in item['mobdrop'].items():
    res += f"{name}: {val}\n"

  res += '__misc__\n'
  for name, val in item['misc'].items():
    res += f"{name}: {val}\n"

  res += '__illegal__\n'
  for name, val in item['illegal'].items():
    res += f"{name}: {val}\n"
  await message.channel.send(res)
#######################################################
    if message.content.startswith('rpm i'):
      await show_inv(message)
```can someone help me
#

idk how to make one inv for every user

tawdry perch
#

use database?

loud junco
#

but idk how to start

#

;-;

#

db["key"] = ' '

#

something like this?

visual island
#

no, that's not a db

#

!d sqlite3

unkempt canyonBOT
#

Source code: Lib/sqlite3/

SQLite is a C library that provides a lightweight disk-based database that doesn’t require a separate server process and allows accessing the database using a nonstandard variant of the SQL query language. Some applications can use SQLite for internal data storage. It’s also possible to prototype an application using SQLite and then port the code to a larger database such as PostgreSQL or Oracle.

The sqlite3 module was written by Gerhard HΓ€ring. It provides a SQL interface compliant with the DB-API 2.0 specification described by PEP 249, and requires SQLite 3.7.15 or newer.

visual island
#

that's a db

loud junco
#

but im using replit

visual island
#

oh

loud junco
#

thats why

#

its working?

#

hmmmm

#

i can solve ur problem

#

but i cant solve mine 🀣

visual island
#

and give another nested dict for another user

loud junco
#

can i kinda like my id is 757508305256972338

#

in database my inv is store as 757508305256972338inv

#

something like that

#

757508305256972338wool = blah blah blah

visual island
#

sure?

#

you give the keyname anything you like

loud junco
#

wdym keyname

#

u can just set it

tawdry perch
#

like a column name

loud junco
#

i will modify it later

ivory sluice
#

Hello I am getting this error on heroku

aiohttp.client_exceptions.ClientConnectorError: Cannot connect to host lavalink:2333 ssl:default [Name or service not known]

Anyone knows how to solve this?

visual island
#

{"key": "value"}

tawdry perch
loud junco
#

what do you want to put in value

ivory sluice
boreal ravine
loud junco
#

=.=

maiden fable
#

Oh u again haha

tawdry perch
loud junco
#

then put any key u wan

loud junco
ivory sluice
maiden fable
#

Right? Nyon Nyom

tawdry perch
#

to oversimplify this, it's because of rule 5

maiden fable
#

Yups

ivory sluice
visual island
maiden fable
#

I am sure IPayForWinrar also remembers that thing

loud junco
ivory sluice
#

Its against tos? I mean hosting.

maiden fable
boreal ravine
visual island
loud junco
#

looks like there is a few master here

boreal ravine
#

πŸ˜”

maiden fable
maiden fable
loud junco
#

wow

tawdry perch
loud junco
#

tons of pro

ivory sluice
#

πŸ₯² ok then

loud junco
maiden fable
#

Yups

tawdry perch
#

groovy was taken down, right?

#

Or what bot was it

visual island
boreal ravine
#

yes

maiden fable
#

Yup

maiden fable
tawdry perch
#

They got sued or discord took action?

visual island
loud junco
ivory sluice
#

This chat be weird

boreal ravine
loud junco
#

i dont know coding then

#

idk what does

print('Hello World!')
``` means >:)
tawdry perch
maiden fable
visual island
loud junco
maiden fable
#

Anyways, let's get on topic again

#

@loud junco what u need help with?

loud junco
#

maybe he can write 1000 lines code without testing

loud junco
#

lemme reply the message

maiden fable
#

Oh hmm

#

!d discord.Guild.invites

unkempt canyonBOT
#

await invites()```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).

Returns a list of all active instant invites from the guild.

You must have the [`manage_guild`](https://discordpy.readthedocs.io/en/master/api.html#discord.Permissions.manage_guild "discord.Permissions.manage_guild") permission to get this information.
loud junco
#

here

visual island
#

inventory*

#

not invite

boreal ravine
loud junco
visual island
loud junco
#

i use replit

#

replit has a database

visual island
#

you can't actually use a local db on replit

boreal ravine
boreal ravine
loud junco
#

=.=

#

i thought its very good

#

thats why i choose replit

ivory sluice
reef shell
loud junco
#

why not

#

=.=

boreal ravine
loud junco
#

ya

#

i just need a small one

boreal ravine
#

well

loud junco
#

i dont need 1000000TB database

tawdry perch
#

replit in first place is not a best choice to host bot on

visual island
#

is not a good choice*

loud junco
#

i made it 247

#

so its ok for me

boreal ravine
#

unrelated

loud junco
#

btw

#

someone pls help

ivory sluice
loud junco
#

idk how to get user id with bot

visual island
unkempt canyonBOT
boreal ravine
#

@tawdry perch you need to type in the full class name

tawdry perch
#

I don't know it so I just put smth that I remember

boreal ravine
#

doesn't work like other bots sadly

loud junco
visual island
#

get ?

loud junco
loud junco
boreal ravine
visual island
#

you need a User instance

boreal ravine
#

thats gonna save the class

#

what icy said

loud junco
#

im thinking to save things in database like (id)wool = blahblah

boreal ravine
#

it isnt that simple

loud junco
#

;-;

reef shell
#

Use a real db, replit db is a joke

loud junco
#

NOT the best place to build your apps 🀣

#

heroku is better?

reef shell
#

yes

loud junco
#

but i need to download stuff to use heroku?

reef shell
#

No

loud junco
#

or isit like replit

#

but better

reef shell
#

You need to setup some stuffs

loud junco
#

alright

#

time to watch some tutorial

#

is heroku 247? or no

solemn grove
#
@bot.event
async def on_member_remove(member):
  channel = bot.get_channel(802458136006885386)
  await channel.send(f"Bye {member.username}\n\n\n{member.username} just left the server.")

Why this isn't working?

tawdry perch
#

@loud junco this has smth for setup

loud junco
#

thanks

reef shell
tawdry perch
loud junco
reef shell
#

Heroku ain't no bot

loud junco
#

can i run the bot 247?

tawdry perch
#

for half a month without credit card

loud junco
#

=.=

reef shell
#

Yes but It has limited dyno hours

loud junco
#

will the keep_alive thing help?

tawdry perch
#

no

#

or have 2 accounts, can't share database if you use smth like sqlite. You need to use server based db

reef shell
#

you don't need keep alive

loud junco
#

oo

#

then how

loud junco
#

2 accounts?

loud junco
#

i dun und

tawdry perch
#

1 account = half a moth. Second account = half a month

reef shell
#

at least deploy your bot for the first time, you’ll know by urself later

loud junco
#

but nvm lemme switch my code to heroku first

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.

tawdry perch
#

I spend half a month to improve my bot and second half to run it hosted in heroku

visual island
#

you need to have a stored db to host on heroku

#

like postgres, mongo, etc

boreal ravine
#

theres no function for that

visual island
#

!d discord.ClientUser.avatar

unkempt canyonBOT
#

property avatar: Optional[discord.asset.Asset]```
Returns an [`Asset`](https://discordpy.readthedocs.io/en/master/api.html#discord.Asset "discord.Asset") for the avatar the user has.

If the user does not have a traditional avatar, `None` is returned. If you want the avatar that a user has displayed, consider [`display_avatar`](https://discordpy.readthedocs.io/en/master/api.html#discord.ClientUser.display_avatar "discord.ClientUser.display_avatar").
boreal ravine
#

its a property fyi

tawdry perch
solemn grove
visual island
#

oh wait

#

2 accounts

#

idk

tawdry perch
#

Is it correct? ```py
msgs = await self.bot.fetch_message(message)

boreal ravine
#

!d discord.TextChannel.fetch_message

unkempt canyonBOT
#

await fetch_message(id, /)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).

Retrieves a single [`Message`](https://discordpy.readthedocs.io/en/master/api.html#discord.Message "discord.Message") from the destination.
boreal ravine
#

@tawdry perch

tawdry perch
#

I thought it needed bot there as well :/

boreal ravine
#

y the class

maiden fable
#

Wrong if u r using 2.0

loud junco
#

how to do this -> step 1: make a git repo with all of your bot files

maiden fable
#

U using heroku?

loud junco
#

im trying to switch my code to heroku

maiden fable
#

Ah

loud junco
#

cuz u say heroku is better

maiden fable
#

Well, best of luck then hehe. Lemme tell u the steps

loud junco
#

or can i just skip step 1

maiden fable
#
-> step 1: make a git repo with all of your bot files

-> step 2: go to your heroku account, create a new app (located in US, will get your average bot latency to under 30ms 100% of the time)

-> step 3: go to settings and add python buildpack, then click "Reveal Config Vars" and add your bot token, along with whatever you have in your .env there

-> step 4: go to deploy, select Github, connect your github account, then select your bot's repo

-> step 5: make sure your bot has a `Procfile` which has "worker: python main.py" (or whatever the file that runs your bot is) and a requirements.txt where you have your requirements listed in newlines

-> step 6: go to overview, click Configure Dynos and then click that pencil icon and toggle the button then click Confirm

-> step 7: make sure you have 2 heroku accounts and switch between them at the end of each month (when you get an email from heroku saying that you're running out of dynos, they refresh at the start of each month)

-> step 8: done
#

And git repo means u gotta use git

loud junco
#

lol

maiden fable
#

Do u know whTs git?

loud junco
#

git and github?

maiden fable
loud junco
#

but idk how to repo