#discord-bots

1 messages · Page 872 of 1

red sundial
maiden fable
#

It isn't open sourced, sorry (also I don't have a GitHub repo)

spring flax
#

I heard that but whats it for?

#

Oh okay

red sundial
#

what lib are you using

maiden fable
spring flax
#

Hunai is disnake right?

maiden fable
maiden fable
velvet tinsel
#

@maiden fable can you make hunai forgive me

red sundial
velvet tinsel
#

It hates me

red sundial
#

pycord already has voice support

velvet tinsel
spring flax
#

Does the bot have other features except chatbot?

maiden fable
maiden fable
maiden fable
red sundial
cloud dawn
#

@maiden fable this name.. my inner php brain is comming back

red sundial
#

php 😭

unkempt canyonBOT
maiden fable
velvet tinsel
#

@maiden fable you just lost a friend

cloud dawn
red sundial
velvet tinsel
maiden fable
maiden fable
velvet tinsel
#

That broke pandas heart

red sundial
#

which i high probability

maiden fable
maiden fable
#

I love 🐼||s||

red sundial
#

!ot :)

unkempt canyonBOT
cloud dawn
#

Petition to remove !ot as command

red sundial
#

that felt so good @maiden fable

#

i get why you do that so often

maiden fable
red sundial
maiden fable
red sundial
#

lol im kidding

maiden fable
#

Once is enough lol

red sundial
#

ok

velvet tinsel
cloud dawn
red sundial
#

damn

velvet tinsel
red sundial
#

intimidating

maiden fable
cloud dawn
#

You guys know that mina has been contributing to the python bot..?? So proud 🥲

maiden fable
#

Yea

cloud dawn
maiden fable
#

🤦

narrow sleet
#

Does anyone have a video tutorial on how to make a music bot?

maiden fable
#

Against ToS

spring flax
cloud dawn
#

!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)
spring flax
#

Yeah but a music bot doesn't have to be youtube and he never said he's using yt

cloud dawn
#

What else would he be using..?

slate swan
#

Lavalink which can play sound from SoundCloud

#

I'm not sure if They allow it or not

modern fiber
#

How can I get the channel where the command has been ran into?

narrow sleet
modern fiber
#

I think I got it

#

ctx.message.channel + pass_context=True

cloud dawn
cloud dawn
modern fiber
cloud dawn
#

Lol yeah not kidding the command you copied is 4 years or older.

narrow sleet
maiden fable
#

Lmao

cedar summit
#

Hi

maiden fable
#

Hi

steep estuary
#

how i can change a user to member ?

#

i want to change the nick after fetching the user

boreal ravine
steep estuary
#

and it is showing user object hsa no attribute edit

boreal ravine
steep estuary
#

then how i can fetch a user as a member ?

#

or is there any way by that i can get a user from string ?

cold sonnet
#

guild.fetch_user

boreal ravine
cold sonnet
#

guild.get_member_named

cold sonnet
maiden fable
#

No

cold sonnet
#

okay

boreal ravine
steep estuary
#

:/

maiden fable
unkempt canyonBOT
#
No way, José.

No documentation found for the requested symbol.

cold sonnet
#

fetch_member?

maiden fable
unkempt canyonBOT
#

property mutual_guilds: List[Guild]```
The guilds that the user shares with the client.

Note

This will only return mutual guilds within the client’s internal cache.

New in version 1.7.
steep estuary
#

what is it ?

boreal ravine
#

read the embed

steep estuary
#

i have a string "clear @steep estuary" how i can get user by that ?

cold sonnet
#

don't you use commands

boreal ravine
cold sonnet
#

just convert @steep estuary to an argument on the invoke

steep estuary
steep estuary
#

and their it is giving a error

cold sonnet
boreal ravine
#

use get_member then? why are you getting/fetching a user

steep estuary
cold sonnet
#

or typehint the first argument to Member....

boreal ravine
#

!d discord.Guild.fetch_member

unkempt canyonBOT
#

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

Retrieves a [`Member`](https://discordpy.readthedocs.io/en/master/api.html#discord.Member "discord.Member") from a guild ID, and a member ID.

Note

This method is an API call. If you have [`Intents.members`](https://discordpy.readthedocs.io/en/master/api.html#discord.Intents.members "discord.Intents.members") and member cache enabled, consider [`get_member()`](https://discordpy.readthedocs.io/en/master/api.html#discord.Guild.get_member "discord.Guild.get_member") instead.
steep estuary
#

i should use fetch_member instead of get_member ?

cloud dawn
#

@steep estuary Are you using disnake?

steep estuary
#

i tried printing the id it is correct

steep estuary
#

ohk

cloud dawn
steep estuary
#

ohh

#

ok i will try this

boreal ravine
#

no

#

just use what I sent earlier

cloud dawn
#

Would look something like this ```py
member = await self.getch_member(ctx.guild, 758941956600102943)

steep estuary
cold sonnet
#

update

steep estuary
jade garden
steep estuary
#

Tysm @boreal ravine@cold sonnet@cloud dawn

cold sonnet
#

pip install git+https://github.com/Rapptz/discord.py

cloud dawn
#

Disnake has a similar functionality but theirs is build into the lib.

jade garden
cold sonnet
#

dumb me

jade garden
#

Ghost ping?

cold sonnet
#

what's reactionmenu?

boreal ravine
jade garden
cold sonnet
#

and... why?

jade garden
cold sonnet
#

dpy has buttons though

jade garden
cold sonnet
#

you're using dislash, dpy and reactionmenu

jade garden
#

Yes

cold sonnet
#

accidental enter

#

I'd rather change to a single fork than use 3 libraries

jade garden
cold sonnet
#

everything's on github

jade garden
#

Or replit link

cold sonnet
#

no, not repl peepocry

boreal ravine
#

ah yes give your repl link and someone will eventually delete all of your bots code

cold sonnet
#

he gave it to me

#

and I wouldn't

#

matter of fact, I won't even look at it

#

either reactionmenu doesn't have buttons or he doesn't have the right version

#

and idk which one, I don't use reactionmenu (why could that be)

modest plover
#

For making a value dependent on who's mentioned in a slash command, do I use

if user = @hollow portal:
			gay_level = 100
```?
cold sonnet
#

try converting the mention to a discord.Member by typehinting and checking if that member's id is 715943793500749925

modest plover
#

I want it so if my friend runs the command, it says

{member.name} is {gay_level}% gay.

But if my friend runs it, gay_level is 100%

cold sonnet
cold sonnet
#

show me your function definition

modest plover
#

I haven't finished it yet but it's this

#
import disnake
from disnake.ext import commands
import random

class Gay(commands.Bot):
	"""How gay are you?"""
	
	def __init__(self, bot: commands.Bot):
		self.bot = bot
		
	@commands.slash_command
	async def gay_rater(self, inter, user: disnake.Member):
		"""How gay are you?
		
		Parameters
		----------
		user: User rated for gayness.
		"""
		gay_level = random.randint(0,100)
		if user = @hollow portal:
			gay_level = 100
cold sonnet
#

you see, user is already a disnake.Member

#

so you can just use user.id to get the id

cloud dawn
cold sonnet
cloud dawn
#

I was more commenting about user != member

cold sonnet
#

you can just check
if user.id == 715943793500749925

#

since you use double equation sign for comparisons yert

modest plover
#

So

if member.id == 715943793500749925:
    gay_level = 100%
#

Oh, user, ok

cold sonnet
#

yeah it's user in your code

cold sonnet
cloud dawn
#

Also it's @commands.slash_command() not @commands.slash_command

reef trail
#

i have a function to write everything that gets printed in my console to a text file, it works perfectly fine, however, whenever i reboot my bot, all the data in the txt file gets overwritten, heres my function

def log(text: str):
    """Log the given text to a file.
    Parameters
    ----------
    text : `str`
        The text to log.
    """
    with open(f"logs.txt", "a", encoding="utf-8") as log_file:
        log_file.write(f"[{date()}] {text}\n")
    # output the text to the console
    logger.info(text)``` i was under the impression that `a` meant append, so it wouldnt overwrite anything?
basically all im doing is making a historic log
slate swan
cold sonnet
#

you see now he's gone

reef trail
cloud dawn
cold sonnet
#

now I have to quote

spring flax
reef trail
cloud dawn
cold sonnet
#

his command wouldn't have run either

reef trail
cloud dawn
reef trail
reef trail
cloud dawn
reef trail
#

Anyway, how can i prevent my function from overwriting everything in my txt file after reboots

cloud dawn
#

logger module opens the file for you.

cold sonnet
#

/get file.readlines() and rewrite it and then the next stuff

cloud dawn
#

then adding the handler to the main logger logger.addHandler(file)

reef trail
#

Thats not how my logger works

#

Im not asking any questions about my logger, im just asking about the function

cloud dawn
# reef trail Thats not how my logger works

Here you can copy mine and play around with it. ```py
import logging
import coloredlogs

log_level = logging.DEBUG

Log format

log_format = '%(asctime)s [%(levelname)s] - [%(filename)s > %(funcName)s() > %(lineno)s]: %(message)s'
log_date_format = '%m/%d/%Y|%I:%M:%S %p'

Info color/format logger

fieldstyle = {
'asctime': {'color': 'green'},
'levelname': {
'bold': True,
'color': 'black'
},
'filename': {'color': 'cyan'},
'funcName': {'color': 'blue'}
}

Message color/format logger

levelstyles = {
'critical': {
'bold': True,
'color': 'red'
},
'debug': {'color': 'green'},
'error': {'color': 'red'},
'info': {'color': 'magenta'},
'warning': {'color': 'yellow'}
}

Creating logger

logger = logging.getLogger(name)
logger.setLevel(log_level)

File handler

file = logging.FileHandler("bot.log")
fileformat = logging.Formatter(log_format, datefmt=log_date_format)
file.setLevel(log_level)
file.setFormatter(fileformat)

Adding handlers to logger

logger.addHandler(file)

coloredlogs.install(
level=log_level,
logger=logger,
fmt=log_format,
datefmt=log_date_format,
field_styles=fieldstyle,
level_styles=levelstyles
)

Some demo codes

logger.debug("debug")

logger.info("info")

logger.warning("warn")

logger.critical("critical")

logging.exception(raise ValueError)

logger.error("error")

cold sonnet
reef trail
#

Jesus

#

mine is way smaller

cloud dawn
reef trail
#

this is my custom coloring

def formatColor(text, color: str = "reset"):
    grey = "\033[;90m"
    gray = "\033[;90m"
    yellow = "\033[;33m"
    red = "\033[1;31m"
    bold_red = "\033[;31m"
    green = "\033[;32m"
    reset = "\033[0;m"

    if color == "reset":
        return reset + str(text) + reset
    elif color == "grey":
        return grey + str(text) + reset
    elif color == "gray":
        return gray + str(text) + reset
    elif color == "yellow":
        return yellow + str(text) + reset
    elif color == "red":
        return red + str(text) + reset
    elif color == "bold_red":
        return bold_red + str(text) + reset
    elif color == "green":
        return green + str(text) + reset
    else:
        return "Invalid Color: Please use either:\n• grey/gray\n• yellow\n• red\n• bold_red\n• green\n• reset (resets color back to white)"
cloud dawn
crisp shoal
#
{embed}$v{description: desc}$v{color: #000000}
``` is it possible to use this for embed from dict?
reef trail
#

uSe a dIcT

cold sonnet
#

sure

cloud dawn
#
{"Use a dict": "yes"}
reef trail
crisp shoal
#

i saw a python bot use this embed code py {embed}$v{description: desc}$v{color: #000000}
and was able to send this as en embed

reef trail
#

or not python, ion know

cloud dawn
#

Could save a lot of time later on xD

crisp shoal
#

i know it's not python but how can i convert it into python lol

cold sonnet
#

but a dict ain't? thonk

reef trail
#

all i need to do is import 1 thing from a file then just log()

cloud dawn
reef trail
#

my logger isnt interfering with the function tho

cloud dawn
reef trail
#

oh, alright sweet, thank you

cloud dawn
#

I knew the answer i just wanted to know why you are torturing yourself.

reef trail
#

eh, it makes sense to me

cloud dawn
#

Lemme know if it works

reef trail
#

works perfectly

#

alrighty, give me like a minute

cloud dawn
reef trail
#

also, ping has been super low lately, pretty nice

cloud dawn
#

88 is pretty pog

modest plover
reef trail
#

it still overwrites

cloud dawn
#

mine is 101ms

modest plover
#

It worked, thanks :)

jade garden
#

Anyone fix my error I am stuck

modest plover
#

What's the error?

jade garden
#

Come dm ill share a replit link

reef trail
#

i suppose ill just create a new file with the date the file was made as the name

modest plover
#

!paste Just copy the code to this

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.

cloud dawn
# reef trail it still overwrites

hmm then i recommend just opening it in r+ mode and copying the contents then paste it back overwriting the whole file. Altough, can i ask why you want a logger?

jade garden
modest plover
#

I don't have an account and my internet sucks ass

reef trail
cloud dawn
reef trail
#

ratelimits

jade garden
#

Uff

cloud dawn
vocal snow
#

Processing log data is easier when in a text file

reef trail
jade garden
#

Fix me this

vocal snow
jade garden
reef trail
#

I wanna order subway cookies

#

im starving despair

vocal snow
#

subway cookies are awesome

cloud dawn
#

subway cookies are expensive

modest plover
#

How do I use emojis in the footer?

cloud dawn
modest plover
#

Seriously? I can't put a gay flag in the footer for the gaydar?

reef trail
vocal snow
#

in russia its 8 billion rubles a cookie

jade garden
#

Check dms

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.
cloud dawn
reef trail
#

nothing is open its 5am despair despair despair

cloud dawn
#

It's an url

slow fog
#

cuz the two == means is

#

and = is just equals

cloud dawn
#

== means datatype is the same as and equal to
= means you want to set a variable
is means is the same as

slow fog
#

oh nvm

boreal ravine
slow fog
cloud dawn
pliant gulch
maiden fable
#

Indeed

boreal ravine
modest plover
modest plover
vocal snow
#

why are you subclassing commands.Bot and taking a commands.Bot instance in the init?

boreal ravine
#

or use match cases if you're using 3.10 <

reef trail
slate swan
boreal ravine
#

lmfaooo probably a typo

#

@slate swan matching 😳

slate swan
#

😳oh, I just realised

drowsy thunder
modest plover
#

What library are you using @drowsy thunder? Just so I can look at the right docs lmao

modest plover
#

Ok, for a start I recommend changing libraries, dpy is pretty shit compared to others

drowsy thunder
#

In replit

#

Just show what to do

abstract dagger
#

best library for dsicord?

drowsy thunder
#

I need rich presence

abstract dagger
abstract dagger
boreal ravine
unkempt canyonBOT
#

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

Changes the client’s presence.

Example

```py
game = discord.Game("with the API")
await client.change_presence(status=discord.Status.idle, activity=game)
```   Changed in version 2.0: Removed the `afk` keyword-only parameter.
drowsy thunder
boreal ravine
abstract dagger
drowsy thunder
boreal ravine
#

theres one called disco but it's severely outdated

abstract dagger
drowsy thunder
abstract dagger
#

i trying to run nextcord on repl.it but it is not working

drowsy thunder
modest plover
vocal snow
#

lmaoo

drowsy thunder
#

!d import discord

unkempt canyonBOT
#

7.11. The import statement


import_stmt     ::=  "import" module ["as" identifier] ("," module ["as" identifier])*
                     | "from" relative_module "import" identifier ["as" identifier]
                     ("," identifier ["as" identifier])*
                     | "from" relative_module "import" "(" identifier ["as" identifier]
                     ("," identifier ["as" identifier])* [","] ")"
                     | "from" relative_module "import" "*"
module          ::=  (identifier ".")* identifier
relative_module ::=  "."* module | "."+
```...
drowsy thunder
#

Use import discord

boreal ravine
modest plover
#

Dpy has literally none of the new shit, so timeouts, slash commands, modals, none of em

#

Disnake, Nextcord or Hikari

boreal ravine
#

..

vocal snow
#

yes, because it isn't maintained

boreal ravine
#

disnake and nextcord are literally forks of d.py, how does that make d.py shit exactly

drowsy thunder
#

After installing discord.py package with
$install discord.py in the Shell
@abstract dagger

#

Dm me,I will help you for the start code

visual island
#

pip install discord.py not just install

abstract dagger
drowsy thunder
modest plover
#

How do I get an emoji to work in the footer in an embed?where :gay: is

slate swan
#

imagine saying dpy is shit

boreal ravine
#

ikr

slate swan
#

\:emoji:

modest plover
#

\🏳️‍🌈

slate swan
#

custom emoji

modest plover
#

That's- not it

#

It's a default emoji, it's 🏳️‍🌈

slate swan
abstract dagger
#

Error ahead

slate swan
abstract dagger
slate swan
modest plover
#

The yellow text isn't an error

slate swan
#

and this isnt the right channel

abstract dagger
#

but it isn't installed

maiden fable
maiden fable
abstract dagger
boreal ravine
slate swan
#

hun kawaii

maiden fable
#

hi

abstract dagger
#

oh lol thanks hunter

maiden fable
#

all cool

abstract dagger
#

😆

maiden fable
#

its all good

cloud kiln
#

Hi uh, so i rlly wanna ask this question, so Im curently using python for my bot, but it seems running so slow.. i mean the bot respond to me a little slow, so i have a little bit of research and i just knew that python IS slower than other language, but my question is does the slow effect on python effect the bot respond speed?

boreal ravine
#

nope

maiden fable
slate swan
#

🏃‍♂️ python is not really that slow how people talk about it

maiden fable
#

Indeed

abstract dagger
slate swan
#

milliseconds of difference

karmic totem
#

How do I create a cooldown in an on_message command?

slate swan
slate swan
unkempt canyonBOT
#

Cooldowns in discord.py

Cooldowns can be used in discord.py to rate-limit. In this example, we're using it in an on_message.

from discord.ext import commands

message_cooldown = commands.CooldownMapping.from_cooldown(1.0, 60.0, commands.BucketType.user)

@bot.event
async def on_message(message):
    bucket = message_cooldown.get_bucket(message)
    retry_after = bucket.update_rate_limit()
    if retry_after:
        await message.channel.send(f"Slow down! Try again in {retry_after} seconds.")
    else:
        await message.channel.send("Not ratelimited!")

from_cooldown takes the amount of update_rate_limit()s needed to trigger the cooldown, the time in which the cooldown is triggered, and a BucketType.

maiden fable
abstract dagger
#

Why it is not imported yet @maiden fable

slate swan
#

thanks for the token

maiden fable
slate swan
#

tho its an invalid one

maiden fable
#

Lmao see the error 🤣

unkempt canyonBOT
#

You are not allowed to use that command here. Please use the #bot-commands channel instead.

karmic totem
#

!token

#

@abstract dagger delete message

abstract dagger
slate swan
karmic totem
#

don't dp that

#

delete the message

abstract dagger
cloud kiln
karmic totem
cloud kiln
boreal ravine
slate swan
abstract dagger
maiden fable
#

@cloud kiln can u try printing bot.latency?

abstract dagger
maiden fable
#

your bot is slow u say

#

So please print bot.latency

slate swan
abstract dagger
cloud kiln
#

Hmm okok wait imma try

abstract dagger
boreal ravine
slate swan
#

santa, wot is this

abstract dagger
#

lol i just didn't used the "" i used ''

boreal ravine
#

@cloud kiln Are you hosting your bot locally

slate swan
#

client.run('your token here') 🤨

cloud kiln
slate swan
slate swan
abstract dagger
cloud kiln
#

Oh ok

abstract dagger
maiden fable
slate swan
#

how can i fix this problem

boreal ravine
modest plover
boreal ravine
#

and you're missing a colon at the end of the parenthesis

slate swan
modest plover
#

But yeah, no learn python lmao

boreal ravine
#

so many things wrong in your code

maiden fable
#

indent goes brrrr

slate swan
abstract dagger
modest plover
boreal ravine
abstract dagger
boreal ravine
#

!source custom-cooldown

unkempt canyonBOT
#
Bad argument

Unable to convert 'custom-cooldown' to valid command, tag, or Cog.

boreal ravine
#

ok

abstract dagger
modest plover
#

Oh, so like how does it do the embed?

boreal ravine
#

wdym 'do the embed'

slate swan
maiden fable
unkempt canyonBOT
#
Command: source

Display information and a GitHub link to the source code of a command, tag, or cog.

Source Code
maiden fable
#

take a look at this :D

abstract dagger
slate swan
#

Or use jishaku

#

🤡 .jsk src <command>

abstract dagger
#

.jsk discord

#

😂😂😂😂😂😂

slate swan
#

Well I have a python discord bot. It has a mc server status command working with api. I want to post the description of the server and not all the motd. Can you tell me how can I post only the "text" in the picture?

motd = str(json_data["motd"])```
#

json_data["motd"]["text"]

#

Lemme try

modern fiber
#
@client.event
async def on_guild_join(guild: disnake.Guild):
    embed = disnake.Embed(title="Thanks for adding me to the Server!")
    embed.add_feld(name="Before securing your server 100%, please make sure to:",
                   value="Have a channel named protech-logs\nGive bot an Administrator Permission\nPut the Bot's Role high enough to be able to Moderate the users below it!",
                   inline=False)
    embed.add_field(name="Help & Support",
                    value=f"[Alpha Bot Website]()\n[Support Server](https://discord.gg/)\n[Commands List](https://urlhere.com)",
                    inline=False)
    embed.add_field(name="Documentation", value=f"[Privacy Policy](https://urlhere.com)", inline=False)
    embed.add_field(name="Get AlphaBot", value=f"[Add AlphaBot to your server](https://urlhere.com)", inline=False)
    embed.add_field(name="Version", value=f"V1.1.1", inline=False)
    await guild.system_channel.send(embed=embed)```

This is my code, it says that the add.embed (line 4) has no attribute.
slate swan
#

Hmm

modern fiber
#

embed.add_feld(name="Before securing your server 100%, please make sure to:",
AttributeError: 'Embed' object has no attribute 'add_feld'

#

OH ITS FIELD

slate swan
modern fiber
#

All good, misspelled smth

slate swan
#

No worries

slate swan
abstract dagger
maiden fable
#

!d discord

unkempt canyonBOT
#

To work with the library and the Discord API in general, we must first create a Discord Bot account.

Creating a Bot account is a pretty straightforward process.

slate swan
#

Imagine not googling it

modern fiber
#

How can I get a number of the users / guilds using a bot?

slate swan
#

!d discord.ext.commands.Bot.guilds

unkempt canyonBOT
slate swan
#

!d discord.Client.users

unkempt canyonBOT
#

property users: List[discord.user.User]```
Returns a list of all the users the bot can see.
modern fiber
#

Thank you champs!

boreal ravine
#

remember to len those objects

modern fiber
#

yep

abstract dagger
boreal ravine
modern fiber
#

I need it so it just pops up a number of the users

boreal ravine
slate swan
boreal ravine
#

nice

slate swan
#

lol

maiden fable
abstract dagger
slate swan
maiden fable
#

Imagine removing PFPs

slate swan
#

len([";","5"])

slate swan
final iron
slate swan
#

!e print(len([";","5"]))

unkempt canyonBOT
#

@slate swan :white_check_mark: Your eval job has completed with return code 0.

2
modern fiber
slate swan
modern fiber
#

How do I add the , tho?

final iron
#

What

slate swan
slate swan
slate swan
#

nvm then

modern fiber
maiden fable
#

U don't

#

U do len(bot.users)

modern fiber
#

so I don't get 69999 I need 69,999

maiden fable
#

Ah that

slate swan
modern fiber
slate swan
final iron
#

There a formatting thing for that

slate swan
#

like f'{len(client.users):,}'

maiden fable
slate swan
slate swan
abstract dagger
#

!e print(len([";","5"]))

maiden fable
modern fiber
slate swan
#

dont remember really pepe_cri

slate swan
maiden fable
unkempt canyonBOT
#

@slate swan :white_check_mark: Your eval job has completed with return code 0.

46,316,974,151
slate swan
#

woah cool

maiden fable
#

Hmm, I never understood that syntax tbh

slate swan
#

same

slate swan
maiden fable
slate swan
#

use list comprehensions to manually add delimiters

maiden fable
maiden fable
#

Sure

final iron
slate swan
#

anyways, lets adhere to rule 7 now

maiden fable
#

Was waiting for kayle to run the command but thanks for saying it without using the command 👀

slate swan
maiden fable
#

Channel dead once again lemon_pensive

boreal ravine
maiden fable
spring flax
#

how do I make a custom bot for a server?

#

are they webhooks?

pliant gulch
slate swan
#

What's this?

quick gust
#

base64 data

spring flax
quick gust
#

so you just wanna make a bot for a server?

spring flax
#

and for the rest, it's constant

quick gust
#

oh I see

#

no clue, I don't think bots can have guild specific profile pictures

spring flax
#

i've seen some bots like mee6 or dyno that have different profile pictures, but the bot account isn't verified

#

so it should be a webhook

#

this is MEE6 ^

quick gust
#

that's definitely not a webhook

cold sonnet
#

a really complicated answer would be the same bot instance, running on a different token and thread with a new account

quick gust
#

I'm not sure how mee6 does it, maybe just another bot account

spring flax
#

i mean i know it's a mee6 premium feature but mee6 is a big bot so would they have that many accounts..?

cold sonnet
#

no

spring flax
#

so if I want a bot to have a profile picture different in one server only anyone can give ideas?

#

i guess just make another bot application

slate swan
#

Any help?

cold sonnet
#

you closed the f-string with a quote that you prolly didn't intend

#

make sure to use " and '

quick gust
slate swan
#

Ok

kind cargo
#

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

u can use bytes

slate swan
#

Wdym

final iron
#

Rip channel 😔

#

!rule 9

unkempt canyonBOT
#

9. Do not offer or ask for paid work of any kind.

kind cargo
#

...

#

ty

boreal ravine
#

you responded too late. You must respond within 3 seconds, if you don't respond within that time limit you must defer the interaction @kind cargo

quick gust
modern fiber
#

How do I actually send embed? 😂

maiden fable
#

send(embed=...)

modern fiber
#

channel.send(embed=embed)?

maiden fable
#

Yea

modern fiber
#

wait,

#
@client.command(description="A basic help command.")
async def help(embed, seconds: int):
    embed = disnake.Embed(title="Thank You for adding Protech to this Server!")```
#

what do I type now? and is this good?

quick gust
#

uh

honest vessel
#

async def help(ctx, embed, seconds: int):

#

await ctx.send(embed=embed)

maiden fable
#

async def help(ctx, embed, seconds)

#

also it will override the default help function

quick gust
#

tbh I don't get the point of the seconds arg

maiden fable
#

!d help lol

unkempt canyonBOT
#

help([object])```
Invoke the built-in help system. (This function is intended for interactive use.) If no argument is given, the interactive help system starts on the interpreter console. If the argument is a string, then the string is looked up as the name of a module, function, class, method, keyword, or documentation topic, and a help page is printed on the console. If the argument is any other kind of object, a help page on the object is generated.

Note that if a slash(/) appears in the parameter list of a function when invoking [`help()`](https://docs.python.org/3/library/functions.html#help "help"), it means that the parameters prior to the slash are positional-only. For more info, see [the FAQ entry on positional-only parameters](https://docs.python.org/3/faq/programming.html#faq-positional-only-arguments).

This function is added to the built-in namespace by the [`site`](https://docs.python.org/3/library/site.html#module-site "site: Module responsible for site-specific configuration.") module.
quick gust
#

and also the embed arg

honest vessel
#

😄

boreal ravine
modern fiber
#

async def help(ctx, embed)

#

so like this?

honest vessel
#

remove embed too

boreal ravine
modern fiber
#

Hold on, how do I disable the default help command again?

maiden fable
modern fiber
#

thanks

velvet tinsel
velvet tinsel
#

okay

#

thanks

#

love you ❤️

#

I killed chat

cold sonnet
#

got the reboot card

spring flax
#

can anyone here tell me what x and y co-ordinates I should put to draw a rectangle down the synetrical centre of a image

unkempt canyonBOT
#

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

spring flax
#

okay yeah it's for a discord bot I wanted that but i guess it's still irrevlevant

cold sonnet
#

can't even revive the chat

stray carbon
#

pip install git+https://github.com/Rapptz/discord.py

error: Cannot find -git, do you have 'git' installed on you PATH?

how to install git :/

slate swan
#

nobody, literally 2 questions in a row not related to the channel topic PepeWalkAwkward

cold sonnet
#

Ash

slate swan
#

meh

cold sonnet
#

🤫

slate swan
stray carbon
sick birch
stray carbon
#

ty

slim ibex
#

🗿

slate swan
#

imagine still using dpy awkward1

modest plover
#

Imagine

slim ibex
#

imagine making discord bots anymore

slate swan
cold sonnet
slate swan
#

meh

cold sonnet
#

no

modest plover
#

How do I make a welcome command? I have this, but idk how to get it to send in the right channel when someone joins

import disnake
from disnake.ext import commands
import random

class Welcome(commands.Cog):
	"""Fires one of many welcome messages."""
	
	def __init__(self, bot: commands.Bot):
		self.bot = bot
		
	@commands.Cog.listener()
	async def on_member_join(self, member: disnake.Member):
		"""Fires off a welcome message on user join."""
		welcomeEmbed = disnake.Embed(
			title = f"Welcome {member.name}!",
			description = "Shitter >:)"
			)
		channel = bot.fetch_channel(channel_ID)
		await channel.send(embed = welcomeEmbed)

def setup(bot):
	bot.add_cog(Welcome(bot))
	print(" | Loaded Extension: Welcome")
	print(" | ")
slate swan
#

sad maintainers noises

slim ibex
#

lol

cold sonnet
#

use get_channel

#

self.bot.get_channel

slate swan
modest plover
#

How do I make it so they config the channel?

#

I'd imagine maybe using a /config command?

slate swan
#

yes

modest plover
#

But idk how to keep the stuff

slate swan
modest plover
#

A db maybe?

slate swan
#

anime_shrug why even ask

cold sonnet
modest plover
slate swan
glossy edge
#

What is a common approach to keeping a remote VPS updated and restarted when a github repo is commited towards/released?

slate swan
glossy edge
glossy edge
silk kelp
#

what is a way i can get all commands in a group? i can get all commands in cogs, main files, etc. but im having a hard time getting commands in a group.

honest vessel
#

@modest plover
guild = self.bot.get_guild(guild_id)
channel = self.bot.get_channel(channel_id)

silk kelp
#

my first answer i figured was [subcommand for subcommmand in command.walk_commands() if subcommmand.parents[0] == command] but i want to know if i can do this easier

honest vessel
slate swan
unkempt canyonBOT
#

@discord.ext.commands.group(name=..., cls=..., **attrs)```
A decorator that transforms a function into a [`Group`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.Group "discord.ext.commands.Group").

This is similar to the [`command()`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.command "discord.ext.commands.command") decorator but the `cls` parameter is set to [`Group`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.Group "discord.ext.commands.Group") by default.

Changed in version 1.1: The `cls` parameter can now be passed.
vale wing
#

It's easy

silk kelp
#

so i can list them in an array, embed, etc.

arctic kindle
#

Can i check if a role added to a user that the bot will write a message per dm to this user?

maiden fable
#

@sick birch want me to make this channel active again?

silk kelp
maiden fable
#

Nvm this is already active

silk kelp
#
role = discord.utils.get(ctx.message.server.roles, name="my role")
for member in ctx.message.server.members:
        if role in member.roles:
          await member.send("Hello user! This is in a dm now!")
#

@arctic kindle hope this helps

arctic kindle
#

Thx

silk kelp
#

np

honest vessel
#

ctx.message.server.members server? aint it guild?

silk kelp
honest vessel
#

ah ok

arctic kindle
#

But i want a signal when i add a role to a user yk

honest vessel
#

then you need an event

arctic kindle
#

Which event and what i have to do

honest vessel
#

!d discord.on_member_update

unkempt canyonBOT
#

discord.on_member_update(before, after)```
Called when a [`Member`](https://discordpy.readthedocs.io/en/master/api.html#discord.Member "discord.Member") updates their profile.

This is called when one or more of the following things change:

• nickname

• roles

• pending...
silk kelp
#

like if you have a "announcement" role or something

#

you can dm them updates, news, and other stuff

honest vessel
#

but if u want alert when they get role given its on_member_update

silk kelp
arctic kindle
#

I want if i add the mod role to a member that he gets the Rules for Mods yk

honest vessel
#

but if you want to dm all that already has a role, then someone already gave u the code

silk kelp
honest vessel
silk kelp
#

ahh

honest vessel
arctic kindle
#

Im 15 lol

silk kelp
#

I could give you a short example if it helps

arctic kindle
#

Okay i will try my best

honest vessel
#

he actually only needs to check after, and check if role is there

arctic kindle
silk kelp
honest vessel
#

yeah it will trigger even if change name n stuff my bad 😄

silk kelp
#

oh yeah

arctic kindle
#

Noice

honest vessel
#

what is the thing with wanna code bots but dont wanna learn :S

arctic kindle
#

Haha

honest vessel
#

its like all wanna drive a car but no one wants to learn theory

arctic kindle
#

I want to learn boy

#

but i dont understand the on_member_update event

silk kelp
honest vessel
arctic kindle
#

Ahhh Okay Thx Bro

#

I understand it now better

honest vessel
silk kelp
#
@bot.event
async def on_member_update(before, after):
    if 'mod' in str(before.roles):
        return
    elif 'mod' in str(after.roles):
            await member.send("Welcome to the mod team! here are the rules:")
#

i tried, ive never used on_member_update so i dont know if it will work

honest vessel
#

thats not good tho

#

as we said earlier 😛

silk kelp
#

it checks if the user already has it?

honest vessel
#

if he changes nickname and still has mod role he will get dm's

silk kelp
#

that was the only problem, right?

silk kelp
#
if 'mod' in str(before.roles):
        return
honest vessel
#

ah urright

#

sloppy reading

silk kelp
#

lmao nw

#

@arctic kindle its case sensitive so if your role is called Mod it will not work, you will have to change "mod" to "Mod" or "Moderator" depending on what its called

honest vessel
#

no

#

just use .lower()

#

like str(before.roles).lower()

silk kelp
#

or id

silk kelp
#

o yeah, but easire if u just change since its 4 one server

honest vessel
#

but yeah check ID's is still optimal cause maybe u wanna change rolename later

#

or include emois to the name etc

silk kelp
#

i feel like were overcomplicating this with ideas

honest vessel
#

😄

silk kelp
#

i was about to say we could log the id in a json file, array, etc, and pull it out on an on_member_update when iterating through the ids in the file

stray carbon
#

Im trying to install py-cord but im getting this error :/

No module named pip

honest vessel
#

installed pip?

stray carbon
#

how to install it

honest vessel
#

what are u using?

silk kelp
honest vessel
#

can u also type the command u try execute

stray carbon
#

py -3 -m pip install -U py-cord

stray carbon
#

3.8.6

silk kelp
#

with pip?

honest vessel
#

is it windows?

stray carbon
#

yes

silk kelp
stray carbon
#

EM_KidThonk sure?

honest vessel
#

whatyou get if u do pip -V

sick birch
stray carbon
#

py-cord 1.7.3 bruh

#

i wanted 2.0.0

honest vessel
#

pathname?

silk kelp
cold sonnet
#

want disnake

silk kelp
#

im using it until it literally does not work

stray carbon
honest vessel
#

@stray carbonpip install py-cord==2.0.0b1

stray carbon
#

Ok

alpine furnace
#

Install it from GitHub

honest vessel
alpine furnace
#

I told you this a few hours ago

stray carbon
#

how?

#

oh

alpine furnace
#

pip install git+<GitHub link>#egg=py-cord

stray carbon
#

that didnt work so im trying pycord

alpine furnace
#

Same thing

stray carbon
#

I installed git as well

cold sonnet
#

and in your PATH?

stray carbon
#

where do i paste it EM_KidThonk

stray carbon
honest vessel
#

path enviorment

stray carbon
#

how to add it to PATH?

#

:/

arctic kindle
honest vessel
#

    Right-Click on My Computer
    Click on Advanced System Settings
    Click on Environment Variables
    Then, under System Variables, look for the path variable and click edit

    Add the path to git’s bin and cmd at the end of the string like this:

    ;C:\Program Files\Git\bin\git.exe;C:\Program Files\Git\cmd

OR

;C:\Users\<user>\AppData\Local\GitHub\PortableGit_<guid>\bin;C:\Users\<user>\AppData\Local\GitHub\PortableGit_<guid>\cmd

To verify, restart cmd and type git --version in cmd```
stray carbon
#

ok

silk kelp
cold sonnet
#

no

#

in dpy, there's only before and after iirc

silk kelp
#

disnake and the other bootlegs that popped up changed alot so i cant help as well as i used to

cold sonnet
#

in disnake, for example, there's member, before and after

#

it's really unnecessary but yeah

silk kelp
cold sonnet
#

you can do after.send() instead of member.send()

silk kelp
#

right

honest vessel
#

ye ^

#

@silk kelpdpy is dying 2023

silk kelp
#

i have a year

honest vessel
#

😄

#

why not already dump it 😄

slate swan
#

you're still on 3.7, updated libraries wont work

cold sonnet
#

lmao just update everything

arctic kindle
stray carbon
#

wait I-

#

I installed 3.8.6 why does it still show 3.7

slate swan
#

cause you have multiple installations now.

stray carbon
#

lemme uninstall 3.7 first

slate swan
#

👍

#

python3.8 -m pip install py-cord==2.0.0b4

#

if you're on linux or something

#

for windows you can just pip install if you have pip in the path

modest plover
slate swan
#

why would you use command prompt to interact with the bot and a database?

#

there are already libraries for all ( or atleast most) of databases

modest plover
#

Because I can't see what's in a database on sqlite3

#

Without using the command line

slim ibex
inner wing
#

how make add emoji command how get the emoji from the message?

modest plover
slim ibex
#

no? why would you code and do that on mobile in the first place

silk kelp
#

you can still use in browser ides.

slim ibex
#

yeah but its not ideal to program on a phone

slate swan
#

you can just use this to view it.

eager prism
#

hello

#

I need help at this

Traceback (most recent call last):
  File "main.py", line 6, in <module>
    from chatbot import Chat, register_call
ImportError: cannot import name 'Chat' from 'chatbot' (/home/runner/PowerChat/venv/lib/python3.8/site-packages/chatbot/__init__.py)
slate swan
#

whats chatbot ?

eager prism
placid skiff
#

i'm pretty sure not a discord bot relevant package

slate swan
#

seems like it does not have a Chat class

eager prism
slate swan
#

show full traceback

placid skiff
eager prism
#

Its a package

#

I installed it using pip

unkempt canyonBOT
modest plover
slate swan
slate swan
modest plover
#

How?

stray carbon
placid skiff
slate swan
modest plover
#

I do but adding to it makes the text go away

slate swan
#

well, you cannot code on a phone as per your comfort. thats the con

slate swan
eager prism
placid skiff
#

...

eager prism
#

||1 little im just new to py tho||

#

please tell me

#

I can send the codde if wanted

modest plover
ornate linden
#

I'm trying to get a bot to print ascii-art but it's formatting wrong. I think it's an issue with Discord eating tabs that are in the art.

#

what it should look like

#

what it does look like

#

right now i have it replacing tabs with 4 spaces

#

it's printing inside of ```

honest vessel
#

try more spaces

ornate linden
#

i'll try it with 6

honest vessel
#

try both with 6 and 8 and see what brings most correct shape

ornate linden
#

6 spaces

#

nvm lmao i forgot to restart the bot after changing my code

honest vessel
#

try 8 😄

#

it starting to shapeup

ornate linden
#

oh it's so close

honest vessel
#

🙂

winter moth
#

in the process of making a bot respond to a string of text. i can do it when the text is all lower case but im trying to make it case insensitive.

ive tried adding the string in different cases and labeling them string_1, string_2 etc. anyone know the way to do this?

honest vessel
#

if msg.startWith("hello") etc

stray carbon
ornate linden
final iron
honest vessel
#

what ever its spelled 😄

winter moth
#
        return
    if message.content == ("xxxstring herexxx"):
        await message.channel.send(
            "Finally, a WINNER! Still hope left for humankind after all. Will need to scan specimen's brain waves. Come here. Only the first one to get this wins."
        )

    else:
        await message.channel.send(random.choice(list))```
honest vessel
#

@winter moth```py
if message.author.bot:
return
msg = message.content.lower()
if msg == ("xxxstring herexxx"):
await message.channel.send(
"Finally, a WINNER! Still hope left for humankind after all. Will need to scan specimen's brain waves. Come here. Only the first one to get this wins."
)

else:
    await message.channel.send(random.choice(list))
#

msg = message.content.lower() this .lower() makes a string be only lower-cases

winter moth
#

will it respond to a input if it is not only lower case?

eager prism
honest vessel
#

lets say message.content is "HeLlo"

msg = message.content.lower()
    if msg == ("hello"):``` will still be true in the if statement
winter moth
#

youre a gem

#

tysm

honest vessel
#

np

winter moth
#

so the () in it is the part where it is ignoring the case?

slate swan
#

does this include slash commands as well

red sundial
honest vessel
winter moth
#

ok that makes sense

red sundial
honest vessel
#

@winter mothlook here

#

!e
myvar = "ABCdefGh"
print(myvar.lower())
print(myvar.upper())
print(myvar.title())

unkempt canyonBOT
#

@honest vessel :white_check_mark: Your eval job has completed with return code 0.

001 | abcdefgh
002 | ABCDEFGH
003 | Abcdefgh
winter moth
#

okokok

slate swan
#

what the tomwtf

silk kelp
slate swan
#

doesnt really matter

honest vessel
#

that msg var will never be declared n run and throw an error

slate swan
#

Command

@bot.event
async def on_message(message):
   for i in links:
      if i in message:
          await message.delete()
          await message.channel.send(f"{message.author.mention} doesn't work my friend")
   else:
      await bot.process_commands(message)```
**Error**
#

message.content

winter moth
#

i did what #! said and its working exactly as described

honest vessel
#

ignore them

junior falcon
#

Guys when i try to create a text channel in a category i get this error:

AttributeError: 'NoneType' object has no attribute 'create_text_channel'```
This is how i defined "TICKET_CATEGORY":
https://lel.link/5vkvuZAUhr
lel.link
junior falcon
honest vessel
#

i am just guessing but bot.get_guild(guild) guild.create_text_channel() and pass akwarg for parents/category id?

#

let me check docs

maiden fable
#

!d discord.Guild.create_text_channel has a category kwarg

unkempt canyonBOT
#

await create_text_channel(name, *, reason=None, category=None, position=..., topic=..., slowmode_delay=..., nsfw=..., overwrites=...)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).

Creates a [`TextChannel`](https://discordpy.readthedocs.io/en/master/api.html#discord.TextChannel "discord.TextChannel") for the guild.

Note that you need the [`manage_channels`](https://discordpy.readthedocs.io/en/master/api.html#discord.Permissions.manage_channels "discord.Permissions.manage_channels") permission to create the channel.

The `overwrites` parameter can be used to create a ‘secret’ channel upon creation. This parameter expects a [`dict`](https://docs.python.org/3/library/stdtypes.html#dict "(in Python v3.9)") of overwrites with the target (either a [`Member`](https://discordpy.readthedocs.io/en/master/api.html#discord.Member "discord.Member") or a [`Role`](https://discordpy.readthedocs.io/en/master/api.html#discord.Role "discord.Role")) as the key and a [`PermissionOverwrite`](https://discordpy.readthedocs.io/en/master/api.html#discord.PermissionOverwrite "discord.PermissionOverwrite") as the value.

Note

Creating a channel of a specified position will not update the position of other channels to follow suit. A follow-up call to [`edit()`](https://discordpy.readthedocs.io/en/master/api.html#discord.TextChannel.edit "discord.TextChannel.edit") will be required to update the position of the channel in the channel list...
honest vessel
#

ah ye

junior falcon
maiden fable
#

what is GUILD?

maiden fable
#

if it is a guild object, then sure

silk kelp
junior falcon
#

This should work?

maiden fable
#

yea

spring flax
junior falcon
spring flax
#

you don't have to use bot.get_guild then

junior falcon
spring flax
#

!d disnake.Interaction.guild

unkempt canyonBOT
honest vessel
#

to be fair i didnt know if he ran a command or not 🙂

junior falcon
#

Like this?

spring flax
#

no

vale wing
#

What's this copy service

slate swan
#

imagine posting the image directly awkward

honest vessel
#

if its a command then just ctx.guild

slate swan
spring flax
spring flax
#

remove the bot.get_guild var (variable)

maiden fable
slate swan
#

^

spring flax
vale wing
#

Never seen it before

maiden fable
unkempt canyonBOT
#
I don't think so.

No documentation found for the requested symbol.

maiden fable
slate swan
#

uh

maiden fable
#

!d disnake.InteractionResponse.defer

unkempt canyonBOT
#

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

Defers the interaction response.

This is typically used when the interaction is acknowledged and a secondary action will be done later.
slate swan
maiden fable
#

I got ya

vale wing
#

That message wasn't meant for you sry

maiden fable
#

Ah okay

vale wing
#

(did I say it politely enough)

maiden fable
#

Everything is polite for me unless it isn't said in an argument

junior falcon
#

AttributeError: 'property' object has no attribute 'id'

maiden fable
#

code

slate swan
#

Hunter

maiden fable
#

wot

vale wing
#

Property object lookin sus

junior falcon
#

ticket_channel = await interaction.guild.create_text_channel(name=f"{ctx.author.name}", overwrites=overwrites, category=TICKET_CATEGORY)

junior falcon
#

a sec

vale wing
spring flax
#

how are you doing ctx?

maiden fable
#

Apex do be taking ages to find a match lemon_pensive