#discord-bots

1 messages · Page 1057 of 1

flint isle
#

Redacted UwU

potent spear
#

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

potent spear
#

don't leak your token ofc

flint isle
#

yep i hid the env file lol

cloud dawn
#

I hope .env

flint isle
#

lol it was .env

flint isle
potent spear
#

you seem lost

flint isle
#

i am lost

potent spear
#

you're just throwing a custom_guilds everywhere to try and make it work

flint isle
#

yeah 😦 i is dumb boi

potent spear
#

try and implement this simple implementation, scrap the "subclassing a bot" thing for now

flint isle
#

should i remove everything i tried throwing it on first?

potent spear
#

correct

flint isle
#

ok ill try that first

wicked wren
#

Hello

flint isle
flint isle
#

and how can i fix my events cog. ill paste it in here and you can tell me whats not needed

import disnake
from disnake.ext import commands
from colorama import Fore
from datetime import datetime
import time


#below are two date time functions that have different functions but one of them adds to the other durring startup
from wb import guild_ids

start_time = datetime.now()
mytime = time.localtime()
if mytime.tm_hour < 12:
    timeofday = 'AM'
else:
    timeofday = 'PM'

class events(commands.Cog):
    """Useful Features for Bot Development."""

    def __init__(self, bot: commands.Bot):
        self.bot = bot
        print('Loading Events cog')


def setup(bot):
    bot.add_cog(events(bot))
potent spear
#

you can access the variable from wherever in that cog now via
self.bot.custom_guild_ids

flint isle
# potent spear you can access the variable from wherever in that cog now via `self.bot.custom_g...

hrmm

C:\Users\Andy\virenv\Scripts\python.exe C:/Users/Andy/PycharmProjects/WhiskeyBotMain/wb.py
Traceback (most recent call last):
  File "C:\Users\Andy\PycharmProjects\WhiskeyBotMain\wb.py", line 2, in <module>
    from disnake.ext import commands
  File "C:\Users\Andy\AppData\Local\Programs\Python\Python310\lib\site-packages\disnake\ext\commands\__init__.py", line 12, in <module>
    from .bot import *
  File "C:\Users\Andy\AppData\Local\Programs\Python\Python310\lib\site-packages\disnake\ext\commands\bot.py", line 57, in <module>
    class Bot(BotBase, InteractionBotBase, disnake.Client):
  File "C:\Users\Andy\AppData\Local\Programs\Python\Python310\lib\site-packages\disnake\ext\commands\bot.py", line 183, in Bot
    @guilds.setter
NameError: name 'guilds' is not defined

Process finished with exit code 1

i still dont know what i broke UwU

potent spear
#

no idea at this point, maybe ask in the disnake discord server, I'm using discord py

wicked wren
#

Hi, I have a very newbish question I'm sure.

#

This is my first time working with python I have extremely small prior experience with coding and I just want to create a command that translates text to French and I cant seem to manage it I have been trying multiple things but if someone could help me out that would be awesome!

potent spear
#

you should first learn how to use a Translate API outside of discord py

slate swan
#

no?

potent spear
#

yes, this is a project wrapped around a project

slate swan
#

you can just use a dict

flint isle
wicked wren
#

I'm using googletrans

pliant gulch
slate swan
#

yup

pliant gulch
#

Why do hard work when something already exists for that?

slate swan
#

its really not allot of work

potent spear
#

excuse me?

pliant gulch
#

To translate a language to another is a lot of work

slate swan
#

cant you just do it letter by letter?

potent spear
#

translating every single word in a dict, as well as sentences? that's huge

pliant gulch
potent spear
#

he's talking about translating languages

pliant gulch
#

Also not all languages use an alphabet

potent spear
#

french to english etc

slate swan
stone beacon
#

oh no translation is a bit more complex than that

pliant gulch
stone beacon
#

Some languages kill the brain, some have like 18 alphabet letters, some have none etc

pliant gulch
#

And it's not as simple as doing A (lang 1) -> A(lang 2)

stone beacon
#

Better to just use google's api

slate swan
#

🤷‍♂️

pliant gulch
#

There are other things at play, such as english vs french. French assigns gender to words, where as english does not

wicked wren
#

I am using googles api

potent spear
#

sure, does that already work for you OUTSIDE of a command?

#

like with a given input or whatever

wicked wren
#

Nah, Im going to look into it more and comeback if I don't find anything. Thanks for helping me readjust how to look at the problem though

potent spear
#

always make sure to do it outside the bigger project first, then adapt where needed

flint isle
potent spear
#

Great

flint isle
# potent spear you can access the variable from wherever in that cog now via `self.bot.custom_g...

did i mess that up

import disnake
from disnake.ext import commands
from colorama import Fore
from datetime import datetime
import time


#below are two date time functions that have different functions but one of them adds to the other durring startup

start_time = datetime.now()
mytime = time.localtime()
if mytime.tm_hour < 12:
    timeofday = 'AM'
else:
    timeofday = 'PM'

class events(commands.Cog):
    """Useful Features for Bot Development."""

    def __init__(self, bot: commands.Bot):
        self.bot = bot
        print('Loading Events cog')

    @commands.Cog.listener()
    async def on_ready(self):
        print(Fore.GREEN + 'Connected!')
        print('Bot is ready!' + Fore.WHITE)
        print(Fore.CYAN + 'Waiting For Commands' + Fore.WHITE)
        embed = disnake.Embed()
        embed.title = f"**Online**"
        embed.set_footer(text="Logging System")
        embed.set_author(name='WhiskeyBot', icon_url=f"{self.bot.user.avatar}")
        embed.description = f"""**Bot Startup and Information**
        Start Time: `{datetime.now().strftime('%b-%d-%Y at %I:%M:%S')} {timeofday}`
        Current Uptime: <t:{round(datetime.timestamp(start_time))}:R>
        Bot account: `{self.bot.user.name}`
        Bot ID: `{self.bot.user.id}`
        Guilds: `{len(self.bot.guilds):,}`
        Users: `{len(list(self.bot.get_all_members()))}`
        Disnake Version: `{disnake.__version__}`
        Loaded Cogs: `{list(self.bot.cogs)}`
        Developer: `whiskeythefox#7339`
        """
        GUILD_ID = 798726719573065749
        CHANNEL_ID = 798726720181633047
        location = self.bot.get_guild(GUILD_ID).get_channel(CHANNEL_ID)
        await location.send(embed=embed)
        ids = self.bot.custom_guild_ids

    @commands.slash_command(name="uptime", guild_ids=ids)
    async def uptime(self, ctx):
potent spear
#

I’m gonna go to sleep, ☮ⓅⒺⒶⒸⒺ☮

flint isle
potent spear
#

It’s already defined…

#

You can already access it via self.bot.custom_guild_ids

flint isle
#

so just put guild_ids=self.bot.custom_guild_ids in the commands args?

#

for the slash command as shown above?

potent spear
#

Stop thinking you have to redefine that stupid guild_ids in every file

#

You did it once, you can use it anywhere without having to redefine it

flint isle
#

ok but i got the error


Traceback (most recent call last):
  File "C:\Users\Andy\PycharmProjects\WhiskeyBotMain\wb.py", line 49, in <module>
    bot.load_extension('cogs.events')
  File "C:\Users\Andy\AppData\Local\Programs\Python\Python310\lib\site-packages\disnake\ext\commands\common_bot_base.py", line 487, in load_extension
    self._load_from_module_spec(spec, name)
  File "C:\Users\Andy\AppData\Local\Programs\Python\Python310\lib\site-packages\disnake\ext\commands\common_bot_base.py", line 419, in _load_from_module_spec
    raise errors.ExtensionFailed(key, e) from e
disnake.ext.commands.errors.ExtensionFailed: Extension 'cogs.events' raised an error: NameError: name 'self' is not defined

when i tried


    @commands.slash_command(name="uptime", guild_ids=self.bot.custom_guild_ids)
    async def uptime(self, ctx):
potent spear
#

Hmm, I’ve never used your library, I can’t tell you how to pass it to the cog

pallid meadow
#

It's the same

#

disnake is just another dpy fork it handles cogs the same way

potent spear
#

Not the slash commands

pallid meadow
#

Yeah you can't call self in a function header

#

just looked at that now

pallid meadow
potent spear
#

You’ll probably have to load the custom guild ids on top of the file and access it that way

pallid meadow
#

mhm

#

or just import your config variable

#

just make sure you load it

#

before you access it

potent spear
#

Yup, so there was never any need for the botvar after all

flint isle
#

... how would i do that lol

pallid meadow
#

wdym, it's just like importing any other variable

potent spear
#

Loadenv in every file

flint isle
#

hmm how would i load the env if its in the folder about the current folder

slate swan
#

are you using python-dotenv?

pallid meadow
#

No, don't load the env in every file lol

#

just make a variable that you import into all of your other cog files

#

you can just make that variable in I assume you have a bot.py file

slate swan
#

or use the botvar

pallid meadow
#

from bot import config

#

no because you can't access self

#

in a function header

flint isle
#

please give an example to help my brain that is bouncing like the dvd logo

slate swan
#

why would you need to access the env variables in a function header?

pallid meadow
#

that's why

#

makes perfect sense

slate swan
#

why not just set the global test_guilds variable instead

pallid meadow
#

no don't do that

#

globals should be avoided as much as possible and this is a case that they can be avoided in.

pallid meadow
flint isle
pallid meadow
#

that's where you are loading extensionsand initializing your bot

slate swan
#

doesn't matter what it's called

pallid meadow
#

ok

flint isle
#

yes

pallid meadow
#

yes ik

#

but most people call it a bot.py file

#

so that's why I was asking...

#

alright so in that file you should load your config and set it as a variable in that wb.py file

#

make sense so far?

#

the variable can just be called config

#

doesn't really matter whatever you want it to be

flint isle
pallid meadow
#

I have no idea what your env file looks like

#

so however you were loading it before just do that

#

just don't set it as a bot variable

#

well you can still set it as both because I am assuming you access the config outside of function decorators as well.

flint isle
#
TOKEN = "Nope UwU"
GUILDS = 798726719573065749```
pallid meadow
#

yeah

flint isle
#

wait should the guilds be [the number]

pallid meadow
#

so just do what you were doing before?

flint isle
#

ok

#

so the code example i gave?

pallid meadow
#

what about it?

flint isle
#

well is that what you meant to do lol

pallid meadow
#

meant by what?

#

Yes, but don't do it bc it's against TOS

#

and we won't help/show you how.

flint isle
pallid meadow
#

Yeah but this is your env file

#

that should be in your python code

flint isle
#

!rule 5

unkempt canyonBOT
#

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

pallid meadow
#

you are making a variable called config in python

flint isle
pallid meadow
#

and then are setting it to your environment var

flint isle
#

ah ok

#

because using it for bots is allowed but user accounts not allowed

#

because bots are meant to use the api but the user accounds use what discord says they should use

pallid meadow
#

bc account automation is a thing.

#

any sort of account automation that's not authorized through discord's own public api through a bot user is not allowed.

flint isle
#

yeah since they arent marked as bots

#

well you can do it but we cant help you. and it is all at your own risk of getting your account terminated

flint isle
# pallid meadow and then are setting it to your environment var

ok so now i have

import disnake
from disnake.ext import commands
import datetime
import os
# import requests
from dotenv import load_dotenv
# import aiohttp
# import aiofiles

# import logging

# logging.basicConfig(level=logging.INFO)


import cogs.whiskey

from colorama import Fore
load_dotenv()
config = os.getenv('GUILDS')
bot = commands.Bot(command_prefix="$")
#

now how am i passing it to cogs? @pallid meadow

pallid meadow
#

You just import config in your cogs

#

From .wb import config

#

Or whatever your import would be

flint isle
#

Ok I will put that in when im back on my system in a bit. I'll let you know if there is issues

potent spear
flint isle
flint isle
potent spear
#

and then import that variable in your cog file
from <main file> import custom_guild_ids

flint isle
potent spear
flint isle
#

lol i saw the correction right after the message i sent

potent spear
#

just import that variable from your main file to your cog file, then it's also accessible there

#

normally, you'd just use a botvar for this (so you don't have to import it all the time), but since you can't use self.bot in your slash command decorator, you'll have to import this

#

I hope you finally understand after doing this for the past 5 hours

flint isle
#

yeah now i do XD

#

tho how would i import since im trying to import inside events.py

potent spear
#

python relative import

pallid meadow
#

Please make sure you actually read all their code before giving help

potent spear
#

he called his guilds variable in the .env a config..

flint isle
#

and i have became confuzzled. how am i going to import from the dir above lol

potent spear
#

you'll have to do as said

flint isle
#

cause i tried .wb and ..wb and they didnt work

potent spear
flint isle
#

and when i tried ..wb i got

disnake.ext.commands.errors.ExtensionFailed: Extension 'cogs.events' raised an error: ImportError: attempted relative import beyond top-level package```
potent spear
#

you can also google errors yk 😉

flint isle
potent spear
flint isle
#

import error attempted relative import beyond top-level package

#

and i found:

flint isle
#

nd this is what i have currently from ..wb import config

potent spear
#

10 secs

#

try
from wb import config

flint isle
#

!paste

cloud dawn
#

So you are in your main and doing from ..?? import ??

cloud dawn
#

You can't import relatively above the current dir

potent spear
potent spear
#

there are simple fixes

cloud dawn
potent spear
#

ah, you were referring to "which file to import"

cloud dawn
#

You always imoport "relatively" to main

potent spear
flint isle
#

omg i feel so dumb about that lmao. but now i have to fix the env part of guilds

#

so would they be GUILDS = [number]?

potent spear
#

GUILDS = [1515165615, 485185485185, 4151558]

#

that's a basic example

flint isle
#

i have GUILDS = [798726719573065749] whats wrong in it

potent spear
#

nothing

flint isle
#

because it throws the errror
disnake.ext.commands.errors.ExtensionFailed: Extension 'cogs.events' raised an error: ValueError: guild_ids must be a sequence of int.

potent spear
#

can you print type(config)?

flint isle
#

class str

#

does env pass strings

potent spear
#

maybe that's the issue

flint isle
#

can i do int(os.getenv('GUILDS'))

potent spear
#

no pls

uncut barn
#

hi , umm i am new to programing i can someone tell me where i can make discord bots?

potent spear
#

so your env will look like
GUILDS = 55151,515151,515151
then your
GUILDS_STRING = getenv shit
config = [int(guild_id) for guild_id in GUILDS_STRING.split(",")]

flint isle
#

omg

#

that worked thanks ^w^

potent spear
#

gl, hf!

flint isle
#

thanks ^w^

flint isle
#

cause i have an embed that needs to send on bot settup

potent spear
flint isle
#

oh is there a reccomendation for it to just run when the bot starts?

potent spear
#

do that in your main file ^

flint isle
#

the top 5? for the main?

#

cause i was kinda wanting to put it in a cog so it dosent clog my main file

potent spear
#

you can just keep the print in on_ready, remove the rest

potent spear
flint isle
#

ok

potent spear
#

where do_stuff_here() is replaced by all the shit you wanted in the on_ready

flint isle
#

umm can i move the start script to my cog?

potent spear
#

nope

#

your cog is Events my guy, you don't want to put a startup task there

flint isle
#

ok. i was using that cog for just that and a uptime command

potent spear
#

just only keep the print in that on_ready in the cog

#

then it wasn't for nothing

flint isle
#

ok

potent spear
#

I use a .json for my config, so idk what to suggest there tbh

flint isle
potent spear
cloud dawn
unkempt canyonBOT
#

@cloud dawn :white_check_mark: Your eval job has completed with return code 0.

1 2 3
cloud dawn
#

@slate swan i gotchu

slate swan
#

💓

potent spear
flint isle
#

huh. thats the link for the code

potent spear
#

click it yourself

#

you'll see

flint isle
#

oh add .py to the end

potent spear
#

nope, still the same ofc

#

just make a new one

flint isle
#

ugg 1 sec lol

#

there we go

#

now it works

potent spear
flint isle
#

line 5? the commented line?

potent spear
#

bruh

flint isle
#

i have that out lmao since i didnt need it

potent spear
flint isle
#

oh dang

#

lol i feel dumb

potent spear
#

time to get some sleep for you bud

flint isle
#

hmm?

#

what time do you think it is for me

potent spear
#

time to get some rest

flint isle
#

i will after im done dropping errors out of my code lol

wicked wren
#

Hey I'm back!

#

I figured it out

potent spear
#

yup, the Baguette makes it 100% accurate

wicked wren
#

it is prefixed with a Hon hon hon (stereo typical french laugh) and suffixed with baguette

potent spear
#

I noticed

wicked wren
#

im convincing an old friend of mine from france to come back to online gaming and I want the discord server to make him laugh

flint isle
#
import disnake
from disnake.ext import commands
import datetime
import os
# import requests
from dotenv import load_dotenv
import time
# import aiohttp
# import aiofiles

# import logging

# logging.basicConfig(level=logging.INFO)

start_time = datetime.now()
Traceback (most recent call last):
  File "C:\Users\Andy\PycharmProjects\WhiskeyBotMain\wb.py", line 15, in <module>
    start_time = datetime.now()
AttributeError: module 'datetime' has no attribute 'now'
potent spear
wicked wren
#

He would also be able to code all of this blindfolded

flint isle
potent spear
flint isle
#

huh?

#

change what

potent spear
#

I told you to change the import 🧠

flint isle
#

i did lol

#

wait did i have an old typi

potent spear
#

line 31 just has to be datetime.now()

#

instead of the sucky datetime.datetime.now()

flint isle
#

yep apparently i had an old typo that didnt trip earlier for some reason

#

thanks lol

#

ima go to sleep now

potent spear
#

peace

robust fulcrum
#

Guys how to fix it

true quartz
#

i am programming a bot in discord and i want to know how i can make it so that when someone does a specific command, it chooses a random image from a set selection of images

#

how can i do that?

#

(i am new to python btw)

supple thorn
supple thorn
true quartz
#

would i just link the image files and make a array or images?

#

does python even have arrays?

#

idk javascript is all i know rn

supple thorn
#

It doesn't

jolly flume
true quartz
#

aight

supple thorn
jolly flume
supple thorn
jolly flume
#

i wanted to hire him for something

true quartz
#

idk what numphy is lmfao

supple thorn
unkempt canyonBOT
#

NumPy is the fundamental package for array computing with Python.

slate swan
#

btw hi skev

supple thorn
#

Hello

true quartz
#

ok cool

#

thanks

supple thorn
#

What i do is that i send the images first here in discord and copy the discord image link

#

Then just send those links

#

To not have images in my system

#

Wdym it can't choose anymore

#

I mean

#

You could do this but it feels like a hacky ass way

#

!e ```py
import random
ree = [1,2,3]

print(ree.pop((ree.index(random.choice(ree)))))
print(ree)

unkempt canyonBOT
#

@supple thorn :white_check_mark: Your eval job has completed with return code 0.

001 | 2
002 | [1, 3]
supple thorn
#

It gets the randomly chosen item in the list and also removes it from the list

#

So that it can't chose that item anymore

true quartz
#

so where would i set that up?

supple thorn
#

!d discord.ext.commands.Bot

unkempt canyonBOT
#

class discord.ext.commands.Bot(command_prefix, *, help_command=<default-help-command>, tree_cls=<class 'discord.app_commands.tree.CommandTree'>, description=None, intents, **options)```
Represents a discord bot.

This class is a subclass of [`discord.Client`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Client "discord.Client") and as a result
anything that you can do with a [`discord.Client`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Client "discord.Client") you can do with
this bot.

This class also subclasses [`GroupMixin`](https://discordpy.readthedocs.io/en/latest/ext/commands/api.html#discord.ext.commands.GroupMixin "discord.ext.commands.GroupMixin") to provide the functionality
to manage commands...
true quartz
#

im confused

supple thorn
#

As it says it's a subclass of discord.Client so it can do anything discord.Client does and more

true quartz
#

sorry, im not very well versed in python

true quartz
#

any specific spot?

supple thorn
#

Please explain to travis

#

I'm eating i can't

true quartz
supple thorn
#

Rather than using names use the id of the role

#

Then just get the role using that id

sage otter
#

Nothing more and nothing less.

true quartz
#

sorry i just dont know what to do

#

im new to python

supple thorn
#
team1 = ctx.guild.get_role(teams.pop(teams.index(random.choice(teams))))
obtuse heron
#

!b

supple thorn
#

!d discord.Guild.get_role

unkempt canyonBOT
#

get_role(role_id, /)```
Returns a role with the given ID.

Changed in version 2.0: `role_id` parameter is now positional-only.
supple thorn
sage otter
#

at the top of your file, import the commands extension
from discord.ext import commands
where you define client replace it with
bot = commands.Bot()
There’s a significant difference between these two, one may be a subclass. However, that subclass in your case will be what handles your commands and what makes you make them easier.

obtuse heron
#

!e ```
while 1000:
print("o")

unkempt canyonBOT
#

@obtuse heron :x: Your eval job has completed with return code 143 (SIGTERM).

001 | o
002 | o
003 | o
004 | o
005 | o
006 | o
007 | o
008 | o
009 | o
010 | o
011 | o
... (truncated - too many lines)

Full output: too long to upload

supple thorn
#

I'd have to explain to him to use commands rather than manually doing every prefix commands like some caveman

true quartz
supple thorn
sage otter
#

there’s actually a guide somewhere on how to use the commands framework.

#

Idk where it is but you could probably find it on the repos examples folder

true quartz
#

idek

sage otter
#

As the name ext hints

#

It’s an extension of the actual library

supple thorn
true quartz
#

does this tutorial cover what im tryna do?

supple thorn
#

Man i hate vcokltfre's name

#

It's so hard

supple thorn
true quartz
#

then ill use it in the future

sage otter
#

Covers disnake.

supple thorn
#

Also what you're trying to do is easy

sage otter
#

And nextcord only.

supple thorn
true quartz
#

but i just want help with what im trying to do in simplest terms

#

i have no clue what im doing

sage otter
#

I’m pretty sure he’s using dpy.

upbeat vigil
#

is discord_slash not a module?

supple thorn
upbeat vigil
#

idk, i was taking code off a github repo

sage otter
#

The commands framework between all 3 libraries carry significant changes and different implementations between the three

#

So I don’t think giving him that guide is wise.

#

Unless, he wants to swap to disnake. Which is more hassle than he probably wants to have.

sage otter
#

Do what the error says.

slate swan
#

Back

sage otter
#

Pass in a prefix to invoke your bots commands with.

true quartz
#

i have no clue what that means

slate swan
true quartz
#

its fine

slate swan
#

maths homework

#

it's ez but ye 35 questions

true quartz
#

@sage otter can you explain how to do it in the simpliest of terms please lmfao i dont know anything about python

slate swan
true quartz
slate swan
#

Ye

jolly flume
sage otter
true quartz
#

sorry

jolly flume
#

it seems most people are now using replit

slate swan
sage otter
#

cool.

jolly flume
true quartz
#

alright

slate swan
#

@true quartz did u add what I just said

true quartz
slate swan
#

Brooo

true quartz
#

sorry

slate swan
#

inside commands.bot()

#

inside ()

true quartz
#

inside the ()?

slate swan
#

ye

true quartz
#

ok

slate swan
#

Tf

true quartz
#

idk

slate swan
true quartz
#

oh

#

i thought that was part of the code

#

sorry

slate swan
#

It wasn't

sage otter
# true quartz sorry

Don’t apologize either. Just because you don’t know something. We all start somewhere. Like I said, you should try learning the language or versing yourself in it a little more before attempting. Familiarize yourself with the terms so you're not always confused.

sage otter
true quartz
fossil monolith
sage otter
#

You should of stopped when he said "I don’t know anything about python"

true quartz
slate swan
unkempt canyonBOT
#
Resources

The Resources page on our website contains a list of hand-selected learning resources that we regularly recommend to both beginners and experts.

slate swan
#

Don't use client as ur bot instance ⚠️

fossil monolith
#

yeah, you defined your commands.Bot(...) object as bot, dunno where you got client from

supple thorn
#

Check it out

fossil monolith
# true quartz

it's also suggested that you don't use the on_message event to handle commands. Use the built-in decorators like @bot.command to do that.

sage otter
slate swan
#

Sad

fossil monolith
sage otter
#

You should of known why as soon as he said that.

fossil monolith
#

that makes sense

true quartz
sage otter
#

You should just stop now. Trying to help an absolute beginner who probably just learned Hello World with an advanced topic like dpy will do more harm than good

true quartz
#

i know more than that

slate swan
#

Now I'll create a maths dc bot to make maths easier for discord users

supple thorn
#

@true quartz big B

#

It's commands.Bot

true quartz
#

ok

#

thanks

supple thorn
#

That's a lowercase b

true quartz
#

ok it worked

#

so now what

#

what do i do to make the command?

slate swan
#

Damn few days ago I got same and I didn't even realize that it's bot and I stop cuz everything was fine 😂

true quartz
sage otter
fossil monolith
#

take a look at the documentation/repository for examples

sage otter
#

Please and thank you.

fossil monolith
ionic garden
#

should i have support for both prefixed commands & slash commands?

#

i remember reading somewhere that discord wanted ppl to just migrate to slash commands

fossil monolith
#

is your bot in 100 guilds

sage otter
#

Just because they encourage you doesn’t mean you should.

ionic garden
#

no

#

it's just a lil thing for myself

fossil monolith
#

otherwise you should migrate to slash commands

sage otter
#

i mean if you get the message intent you don’t have to

ionic garden
#

ok i can use normal commands
but should i have support for both

fossil monolith
#

that's you to you

ionic garden
#

k cool

fossil monolith
#

you can use the hybrid command deco to support both at the same time

true quartz
#

honestly i think im just gonna quit

#

for now at least

ionic garden
#

oh ppl still use the normal discord.py here? thought that library was dead or something

fossil monolith
#

danny came back

ionic garden
#

oh wow

#

here i am learning pycord like an absolute moron

#

what made him come back?

fossil monolith
fossil monolith
ionic garden
#

big f

fossil monolith
#

tried testing it with a prod bot and it was just filled with internal errors lmao

#

although it was a valiant effort from the lib developers

ionic garden
#

fff

#

so uh

#

how do you use slash commands? don't really see anything in the docs

inner epoch
#

Am using on_member_remove how to know if the user left on his own or was kicked?

slate swan
#

k wait

#
@commands.command()
    @commands.has_permissions(ban_members=True)
    async def heist(self, ctx, ping, amount, sponsor, mins: int):
        time1 = datetime.now() + timedelta(minutes=mins)
        await ctx.channel.purge(limit=1)
        await ctx.send(f"{ping} :money: **Heist Starting!** :money:")
        hEmbed = discord.Embed(title=f"⏣ {amount}", description=f" :flexUwU: Sponsor: {sponsor} \n:flexUwU: Timer: <t:{time1.timestamp():.0f}:R> \n Requirements: \n \n:dot:Grab **Heist Ping** role to get ponged! \n:dot:Withdraw coins: `pls withdraw 2000` \n:dot:Use a life saver.", color = discord.Colour.random())
        hEmbed.set_footer(text=f"Thank the grinders too")
        msg = await ctx.send(embed = hEmbed)
        reaction = await msg.add_reaction(":DI_heist:")
        users = [users.mention async for user in reaction.users()]
        await asyncio.sleep(mins)
        await msg.edit_message(content=f"{ctx.author.mention} It is heist time!, may the heist commence")
hollow agate
#
@client.command()
async def tt(ctx):
    with open("dice.gif", "r") as f:
        image = discord.File(f)
        await ctx.send(file=image)``` ```py
Traceback (most recent call last):
  File "C:\Users\\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\ext\commands\bot.py", line 1329, in invoke
    await ctx.command.invoke(ctx)
  File "C:\Users\\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\ext\commands\core.py", line 995, in invoke
    await injected(*ctx.args, **ctx.kwargs)  # type: ignore
  File "C:\Users\\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\ext\commands\core.py", line 209, in wrapped
    raise CommandInvokeError(exc) from exc
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: UnicodeDecodeError: 'charmap' codec can't decode byte 0x8f in position 250: character maps to <undefined>``` What am I doing wrong here?
stone beacon
#

Just pass the file name to discord.File

keen lynx
#

is anyone running here premium membership model for any bot? need some idea how to make one 🧐 thinking for using strpie

sick birch
#

Stripe would probably be the best

#

Obviously a database with premium users

#

And a check for premium only commands

#

Hardest part would be stripe integration

pliant gulch
#

I think patron has an API that’ll make it pretty easy to process premium purchasing as well

zenith basin
#
import discord
from os import listdir
from discord.ext import commands


class Bot(commands.Bot):
    def __init__(self):
        super().__init__(command_prefix="!", case_insensitive=True, intents=discord.Intents.default())

    async def cogs_manager(self,bot: commands.Bot, mode: str, cogs: list[str]) -> None:
        for cog in cogs:
            try:
                if mode == "unload":
                    await bot.unload_extension(cog)
                elif mode == "load":
                    await bot.load_extension(cog)
                elif mode == "reload":
                    await bot.reload_extension(cog)
                else:
                    raise ValueError("Invalid mode.")
            except Exception as e:
                raise e

    async def on_ready(self):
        print(f"Logged as: {self.user} | discord.py{discord.__version__}\nGuilds: {len(self.guilds)} Users: {len(self.users)}")
        print("_"*100)

    async def close(self):
        await super().close()

        print("Shutting down...")

    async def startup(self):
        """Sync application commands"""
        await self.wait_until_ready()
        await self.tree.sync()


    async def setup_hook(self):
        """Initialize the db, prefixes & cogs."""

        # Cogs loader
        cogs = [f"Cogs.{filename[:-3]}" for filename in listdir("./Cogs") if filename.endswith(".py")]
        print(await self.cogs_manager(self, "load", cogs))


        # Sync application commands & show logging informations
        self.loop.create_task(self.startup())


if __name__ == '__main__':
    bot = Bot()
    bot.run(token)
#

I have this basic code

#

but I can't run any commands

#

from my cogs

#

MY cog:

import discord
import discord.ext.commands as commands

class H(commands.Cog):
    def __init__(self, bot):
        self.bot = bot
    async def cog_load(self):
        print("H cog loaded")
    @commands.command()
    async def ping(self, ctx):
        await ctx.send("Pong!")

async def setup(bot):
    await bot.add_cog(H(bot))
potent spear
desert heart
#

Are you sure your cog is being loaded?

#

Does your whole listdir thing actually find the cog files?

potent spear
#

also

Sync application commands & show logging informations

self.loop.create_task(self.startup())
why don't you just await self.startup()?

#

lastly
print(await self.cogs_manager(self, "load", cogs))
printing this makes no sense, since it doesn't return anything

#

there are other small optimizations, but these just are the most obvious ones

#

also, you probably noticed that the on_ready prints no guilds nor users (or the incorrect length) since the cache isn't loaded there yet => you don't want to do anything in on_ready except maybe a print

potent spear
#

and finally, to top things off:
cogs = [f"Cogs.{filename[:-3]}" for filename in listdir("./Cogs") if filename.endswith(".py")]
verify that this isn't just an empty list, which could be why your cogs aren't loaded

zenith basin
#

returns ['Cogs.H']

#
class Bot(commands.Bot):
    def __init__(self):
        super().__init__(command_prefix="!", case_insensitive=True, intents=discord.Intents.default())


    async def on_ready(self):
        print(f"Logged as: {self.user} | discord.py{discord.__version__}\nGuilds: {len(self.guilds)}")
        print("_"*100)

    async def close(self):
        await super().close()

        print("Shutting down...")

    async def startup(self):
        """Sync application commands"""
        await self.wait_until_ready()
        await self.tree.sync()


    async def setup_hook(self):
        """Initialize the db, prefixes & cogs."""

        # Cogs loader
        cogs = [f"Cogs.{filename[:-3]}" for filename in listdir("./Cogs") if filename.endswith(".py")]
        print(cogs)
        #load cogs
        for cog in cogs:
            await self.load_extension(cog)


        # Sync application commands & show logging informations
        self.loop.create_task(self.startup())
potent spear
#

great, then that should be it I'd say

zenith basin
#

is this better

potent spear
#

try and see

slate swan
#

how can i send help for a particular cog
cog name: utilitycmds
user used: ,help cog utilitycmds
sends help for that particular cog
default help command

#

I am getting:

send() got an unexpected keyword argument 'ephemeral'

For:

await channel.send(embed = choose_catagory_embed, ephemeral = True, view = view)
placid verge
slate swan
slate swan
#

all users in the list?

#

same code i sent earlier

#

you reaction variable was wrong that's it

#

anyone know how i can make sure my bot auto restarts upon any crashes?

slate swan
ionic garden
#

not sure if i should ask this here
but why did rapptz quit discord.py at first
i get the part about staff being nonreceptive to feedback & stuff
but i don't really get the part about "gateway intents" or "privileged intents"
if anyone could explain that to me, i'd be really grateful

glossy ruin
#

do i need to give commands a file

#

like ban mute kick all in separate file

slate swan
#

You mean the blue text?

#

If yes:

[link text here](url here)
#

I don’t think the work in footer

slate swan
maiden fable
unkempt canyonBOT
maiden fable
#

In the error handler

robust fulcrum
#

Guys my bot was working fine before 5 minutes but when i am using comamnds now its not working even it's online and there's no error
If possible pls help me
I'll dm you file if need

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.

vocal snow
#

send your code ^

robust fulcrum
robust fulcrum
#

Or its replit error?

vocal snow
#

also in your error handlers, add ```py
else:
raise error

slate swan
#
else:
     raise error/exc/exception```
warped mirage
#

guys can someone help me

#
sqlite3.ProgrammingError: Incorrect number of bindings supplied. The current statement uses 2, and there are 1 supplied.```
slate swan
#

anyone got smth for how i can make my bot delete its own messages? (a cleanup command that deletes the bot's past 15 messages or so in the current channel)

paper sluice
#

and delete if author is the bot

upbeat vigil
#

hey, how would i make a command inside of another command? for example inside of a ! lyrics command i could have song lyrics loaded

slate swan
#

ah k will give it a shot ty

supple thorn
#

You could invoke another command inside that command

supple thorn
unkempt canyonBOT
#

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

Calls a command with the arguments given.

This is useful if you want to just call the callback that a
[`Command`](https://discordpy.readthedocs.io/en/latest/ext/commands/api.html#discord.ext.commands.Command "discord.ext.commands.Command") holds internally...
supple thorn
#

!d discord.ext.commands.Bot.get_command

unkempt canyonBOT
#

get_command(name, /)```
Get a [`Command`](https://discordpy.readthedocs.io/en/latest/ext/commands/api.html#discord.ext.commands.Command "discord.ext.commands.Command") from the internal list
of commands.

This could also be used as a way to get aliases.

The name could be fully qualified (e.g. `'foo bar'`) will get
the subcommand `bar` of the group command `foo`. If a
subcommand is not found then `None` is returned just as usual...
supple thorn
#

To get the command

#

Or it'll invoke the same command

paper sluice
#

👀

light violet
#

hey i enabled in my bot to join guilds for me btw i authorized it btw i am not joined to any of the servers, how to configure the bot to make me join server my authorizeing it

slate swan
#

You want your bot to invite you in the server it joins?

robust fulcrum
#

Guys when i say %help my bot send the following result in image /
How can I remove it and make a new help command

tacit adder
gaunt ice
robust fulcrum
gaunt ice
#

yes

robust fulcrum
#

Like other comannds?

gaunt ice
#

after u remove it

tacit adder
gaunt ice
#

u can create a command called help without the error

robust fulcrum
#

Hmmm like other comannds?

gaunt ice
#

yes

robust fulcrum
#

Ok

#

Ty

tacit adder
robust fulcrum
#

Ok

#

I'll make my own first

#

Then I'll remove

stray carbon
#
+ akai123 hacked ⏣ 696,696,696 out of the bank.

I want to get integers after and ignore all ints before it, any idea?

stone beacon
#

Use regex

supple thorn
stray carbon
supple thorn
unkempt canyonBOT
#

@supple thorn :white_check_mark: Your eval job has completed with return code 0.

['+ akai123 hacked ', ' 696,696,696 out of the bank.']
stray carbon
#

ooo

supple thorn
#

And just get the first index

#

And use regex on it

stray carbon
#

yup ty ty

#

saved my day

supple thorn
#

So the usernames with digits doesn't fuck you

supple thorn
tropic burrow
#

why does my uptime robot online hosting via replit not work,
code:

from flask import Flask

from threading import Thread



app = Flask('')



@app.route('/')

def home():

    return "I'm alive"



def run():

  app.run(host='0.0.0.0',port=8080)



def keep_alive():  

    t = Thread(target=run)

    t.start()

The website given is correctly pasted into uptime robot whats wrong, when i go offline the bot goes offline

warped mirage
#

ValueError: parameters are of unsupported type guys how do i fix this

warped mirage
loud junco
warped mirage
#

1 sec

loud junco
#

but not sure if i can help

warped mirage
#

alright

loud junco
loud junco
warped mirage
#

So check there .

loud junco
#

send the whole error

warped mirage
#

Kk

#
Ignoring exception in on_message
Traceback (most recent call last):
  File "C:\Users\Dom\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\client.py", line 343, in _run_event
    await coro(*args, **kwargs)
  File "C:\Users\Dom\Desktop\beta test\bot.py", line 37, in on_message
    async with client.db.execute("SELECT levelsys FROM levelSettings WHERE guild = ?",
  File "C:\Users\Dom\AppData\Local\Programs\Python\Python310\lib\site-packages\aiosqlite\context.py", line 41, in __aenter__
    self._obj = await self._coro
  File "C:\Users\Dom\AppData\Local\Programs\Python\Python310\lib\site-packages\aiosqlite\core.py", line 184, in execute
    cursor = await self._execute(self._conn.execute, sql, parameters)
  File "C:\Users\Dom\AppData\Local\Programs\Python\Python310\lib\site-packages\aiosqlite\core.py", line 129, in _execute
    return await future
  File "C:\Users\Dom\AppData\Local\Programs\Python\Python310\lib\site-packages\aiosqlite\core.py", line 102, in run
    result = function()
ValueError: parameters are of unsupported type````
loud junco
#

async with client.db.execute("SELECT levelsys FROM levelSettings WHERE guild = ?"

warped mirage
#

?

loud junco
#

this is the error i think

warped mirage
#

Yes

#

I could try await

#

Idk .

loud junco
#

maybe ask the other

#

i have no idea how to fix it

#

cuz i hardly use sql

slate swan
warped mirage
slate swan
warped mirage
#
async def setup_db():
    client.db = await aiosqlite.connect("level.db")
    await client.db.execute(
        "CREATE TABLE IF NOT EXISTS levels (level INTEGER, xp INTEGER, user INTEGER, guild INTEGER)")
    await client.db.execute(
        "CREATE TABLE IF NOT EXISTS levelSettings (levelsys BOOL, role INTEGER, levelreq INTEGER, guild INTEGER)")
    await client.db.commit()``` this?
slate swan
#

hm, and the part where you input data?

warped mirage
#

idk u have to check my code

slate swan
#

thats what im asking for...

warped mirage
paper sluice
slate swan
#

show line 37 of your code

#

oh wait

tropic burrow
#

@loud junco

warped mirage
#
                                (guild.id)) as cursor:```
#

line 37

paper sluice
#
async with client.db.execute("SELECT levelsys FROM levelSettings WHERE guild = ?",
                                (guild.id))

try (guild.id, )

slate swan
#

^

warped mirage
#

kk

slate swan
#

client.db.execute() as cursor uwu

paper sluice
#

parens dont make tuple 😔

warped mirage
#

none of my commands respond now

#

tf???

slate swan
#

error in the event

warped mirage
#

theres no errors

loud junco
slate swan
#

on_message is an event-

warped mirage
#

i meant ....

tropic burrow
loud junco
#

not the website id

slate swan
loud junco
visual island
# tropic burrow

The url you link to uptimerobot should be the flask app url, not your replit project url (you can see the app's url on the upper right panel of the replit page).

warped mirage
#

it might be to do with indents @slate swan

slate swan
#

smh

warped mirage
#

idk these are the 2 new commands i implemented as a group

light violet
tropic burrow
#

og bruh\

light violet
#

👀

warped mirage
#

can someone see an error in my code?

light violet
#

ss

warped mirage
#

this part first

light violet
#

console ss

#

of error

warped mirage
light violet
#

remove return

warped mirage
warped mirage
#

without the new stuff i added theres no issues , so i know for sure its the new code

#

@slate swan any ideas?

slate swan
maiden fable
#

What's the issue

warped mirage
#

no commands respond and no errors

#

shall i send code ?

maiden fable
#

sure

warped mirage
slate swan
maiden fable
#

which command no work? @warped mirage

warped mirage
#

yeah probs someone is blocking the code without me knowing idk

maiden fable
#

slvl?

warped mirage
stone beacon
#

Ouch sql statements

warped mirage
#

lol

stone beacon
#

That's alot of sql executions for an on_message

warped mirage
#
async def setup_db():
    client.db = await aiosqlite.connect("level.db")
    await client.db.execute(
        "CREATE TABLE IF NOT EXISTS levels (level INTEGER, xp INTEGER, user INTEGER, guild INTEGER)")
    await client.db.execute(
        "CREATE TABLE IF NOT EXISTS levelSettings (levelsys BOOL, role INTEGER, levelreq INTEGER, guild INTEGER)")
    await client.db.commit()``` any errors here?
stone beacon
#

Won't it be better to have one context manager handle all that instead of creating 3

maiden fable
#

yea

warped mirage
#

ok one sec

#

how about here?

maiden fable
#

what the heck is that if statement

warped mirage
#

this is in the level command

brazen raft
warped mirage
#

and last but not least

#

bruh tf is this

#

@maiden fable so any ideas for my code?

maiden fable
#

No, tbh

warped mirage
#

That’s all that I added and it breaks my code

#

Idk ….

maiden fable
#

Weird

warped mirage
#

Wait @maiden fable I might have an idea , can u check my if statements and ye maybe indents or smth

#

If not then alright I guess

maiden fable
#

Can u share the code link again

maiden fable
#

@slate swan with?

#

Lemme check the indent and statements @warped mirage

warped mirage
#

@slate swan idk if it’s a rule here but generally there shouldn’t be helping with stuff against minecraft stuff or smth idk

#

Cuz auto bots for a game is technically a cheat

maiden fable
#

@warped mirage also don't have so many context managers

warped mirage
maiden fable
#

Use a single one.
Sometimes these can cause uncaught errors

#

Can u show the error

#

Not u

#

only this?

#

Wait, can u try doing def handle(ctx, *args):

slate swan
maiden fable
#

Try opening a help channel, never used the module sooo

slate swan
maiden fable
warped mirage
#

So any ideas for my code

slate swan
maiden fable
#

Lmao why
I never really hated JS, but I just prefer using Python wherever I can

stone beacon
#

Nothing like opene a js file and seeing that

()(function()((()(()()(())))
#

That just makes you wanna alt f4

maiden fable
#

Agreed

#

reasons I hate JS sometimes

#

And ofc, the CORS policy sucks
istg I spent days trying to fix that error due to which I wasn't even able to send requests to the backend API on another port 🤣

vocal plover
#

doesnt everyone love minified js

slate swan
#

its fun

maiden fable
#

vc, get out before everyone here loses their mind

maiden fable
#

Uh yea

vocal plover
maiden fable
#

I still remember messing with React's config file and bothering ppl in the React discord for days

formal basin
#

Anyone know how to make a tiktok notification bot using json

maiden fable
#

Is there a tiktok api?

slate swan
#

yes

warped mirage
#

Does anyone know error to my code

formal basin
slate swan
formal basin
maiden fable
#

Ashley just posted it

formal basin
slate swan
#

....

#

fine, IM SORRY

warped mirage
maiden fable
robust fulcrum
#
@client.command()
async def fight(self, ctx, user:str=None, *, weapon:str=None):
        if user is None or user.lower() == ctx.author.mention or user == ctx.author.name.lower() or ctx.guild is not None and ctx.author.nick is not None and user == ctx.author.nick.lower():
            await ctx.send("{} fought themself but only ended up in a mental hospital!".format(ctx.author.mention))
            return
        if weapon is None:
            await ctx.send("{0} tried to fight {1} with nothing so {1} beat the breaks off of them!".format(ctx.author.mention, user))
            return
        await ctx.send("{} used **{}** on **{}** {}".format(ctx.author.mention, weapon, user, random.choice(fight_results).replace("%user%", user).replace("%attacker%", ctx.author.mention)))

There is a error in it
Can anyone help me fix pls

formal basin
warped mirage
maiden fable
warped mirage
#

Hmm

maiden fable
warped mirage
#

How

#

it’s just a bot that notifies

formal basin
#

How?

robust fulcrum
#
@client.command()
async def fight(self, ctx, user:str=None, *, weapon:str=None):
        if user is None or user.lower() == ctx.author.mention or user == ctx.author.name.lower() or ctx.guild is not None and ctx.author.nick is not None and user == ctx.author.nick.lower():
            await ctx.send("{} fought themself but only ended up in a mental hospital!".format(ctx.author.mention))
            return
        if weapon is None:
            await ctx.send("{0} tried to fight {1} with nothing so {1} beat the breaks off of them!".format(ctx.author.mention, user))
            return
        await ctx.send("{} used **{}** on **{}** {}".format(ctx.author.mention, weapon, user, random.choice(fight_results).replace("%user%", user).replace("%attacker%", ctx.author.mention)))

There is a error in it
Can anyone help me fix pls

maiden fable
#

Getting information from youtube.com without using the API via the means of bot is against their ToS @formal basin

warped mirage
stone beacon
#

Please don't spam repost + send the error

formal basin
#

Send me link of it saying that

maiden fable
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)
robust fulcrum
#
@client.command()
async def fight(self, ctx, user:str=None, *, weapon:str=None):
        if user is None or user.lower() == ctx.author.mention or user == ctx.author.name.lower() or ctx.guild is not None and ctx.author.nick is not None and user == ctx.author.nick.lower():
            await ctx.send("{} fought themself but only ended up in a mental hospital!".format(ctx.author.mention))
            return
        if weapon is None:
            await ctx.send("{0} tried to fight {1} with nothing so {1} beat the breaks off of them!".format(ctx.author.mention, user))
            return
        await ctx.send("{} used **{}** on **{}** {}".format(ctx.author.mention, weapon, user, random.choice(fight_results).replace("%user%", user).replace("%attacker%", ctx.author.mention)))

There is a error in it
Can anyone help me fix pls

stone beacon
#

For the second time please don't spam repost 🗿 and send the error if there is one

formal basin
formal basin
stone beacon
#

Ytdl is just one

formal basin
warped mirage
#

Wait WTF

#

Ytdl is against Tos ?

formal basin
#

You can’t use it

warped mirage
#

I use it in my js bot with Distube I think

formal basin
#

Which I’m not using

warped mirage
#

What do u use

stone beacon
formal basin
warped mirage
#

Music

stone beacon
#

The most popular , but any thing that mimics its functionality in any way does break tos

warped mirage
#

I use ytdl and distube for music I think

#

So ur saying YouTube will sue me for this and I’m getting arrested?

formal basin
#

Anything wrong with this I’m not using yt dl

formal basin
warped mirage
#

can someone tel me with I will get arrested

warped mirage
#

What then

stone beacon
#

🤣

warped mirage
stone beacon
formal basin
stone beacon
#

But I'm no expert

formal basin
warped mirage
#

And ytdl is a package , so the person who made it must get sued

#

Not me …

stone beacon
#

No need to get paranoid m8

warped mirage
#

00008B dark blue hex code

stone beacon
#

Nothing is gonna happen to you 💀

#

If push comes to shove you'll have to stop using the package

warped mirage
#

Then why do people make it sound like it’s terrifying

stone beacon
#

hence so many streaming bots died

warped mirage
#

Oh ok

formal basin
stone beacon
#

Breaking the law is infact illegal

slate swan
#

!d discord.ButtonStyle.blurple or do you need the hex?

unkempt canyonBOT
warped mirage
#

Well I’m just using my bot for music

#

So nothing too bad xD

slate swan
#

ah wait

stone beacon
#

wack

#

Ik I saw blurple somewhere

warped mirage
#

If it’s illegal then how the f do u make music bots

#

Makes no sense , everything is illegal

slate swan
#

classmethod blurple()[source]

A factory method that returns a Colour with a value of 0x5865F2.
#

its 0x5865F2 @slate swan

stone beacon
#

!d nextcord.Colour.blurple

unkempt canyonBOT
#

classmethod blurple()```
A factory method that returns a [`Colour`](https://nextcord.readthedocs.io/en/latest/api.html#nextcord.Colour "nextcord.Colour") with a value of `0x5865F2`.
formal basin
#

anyone know how to make a tiktok notification bot? No api and using json

slate swan
#

😔 they use Colour lmao. tho Color is just an alias for the same

stone beacon
#

Insanity

warped mirage
#

!d nextcord.Colour.blurple

unkempt canyonBOT
#

classmethod blurple()```
A factory method that returns a [`Colour`](https://nextcord.readthedocs.io/en/latest/api.html#nextcord.Colour "nextcord.Colour") with a value of `0x5865F2`.
maiden fable
formal basin
#

Here is the code I did for the YouTube notification bot I want it to be a tiktok one

slate swan
#

!d disnake.Colour.green is same as that color iirc

unkempt canyonBOT
#

classmethod green()```
A factory method that returns a [`Colour`](https://docs.disnake.dev/en/latest/api.html#disnake.Colour "disnake.Colour") with a value of `0x2ecc71`.
formal basin
warped mirage
stone beacon
#

google it and you're 99% sure to find it on the front page

maiden fable
warped mirage
#

What if I’m using a package

#

I can’t change the api.

stone beacon
#

Wut

warped mirage
#

Lemme say all my packages related to music that I have

stone beacon
#

You do know that alot of these packages wrap the api's e.g discord.py wraps the discord api

warped mirage
#

ytdl-core , ffmpeg static, distube , @distube/spotify THESE ARE ALL THE PACKAGES I HAVE . JS

stone beacon
#

Alright this a bit ot

warped mirage
#

Damn sad times

#

No more music bots

formal basin
manic path
#

This is inside on_command_error:

debug_message = f"{ctx.command} invoked by {ctx.message.author} with error. \n {e.__class.__name__}: {e}"

and I am getting this error:

    debug_message = f"{ctx.command} invoked by {ctx.message.author} with error. \n {e.__class.__name__}: {e}"
AttributeError: 'CommandNotFound' object has no attribute '_ErrorHandler__class'

Why is that?
I even handle CommandNotFound inside on_command_error

        elif isinstance(e, errors.CommandNotFound):
            print("Reached notfound")
            logger.debug(debug_message)
            await self.send_command_suggestion(ctx)
#

got it

warped mirage
formal basin
warped mirage
#

ytdl-core , ffmpeg static, distube , @distube/spotify THESE ARE ALL THE PACKAGES I HAVE . JS

#

Are these fine ?

#

Tbf the distube is fine cuz it’s spotifies page

vocal plover
#

spotify doesnt allow unauthorized streaming either

warped mirage
#

Tf

#

Then how does it work ……,..

vocal plover
#

what?

#

How would spotify not allowing unauthorized streaming affect itself

warped mirage
#

How can we make a music bot if everything is illegal

vocal plover
#

Either license the music you play correctly or dont make a music bot

warped mirage
#

Wdym by license it

vocal plover
#

pay to be able to stream the music to an audience

warped mirage
#

Do u know how much they charge ?

vocal plover
#

No idea, but it's not cheap

warped mirage
#

Well idk cuz it’s a package

#

So I wouldn’t know if it’s legal or not

vocal plover
#

If you're streaming popular music and you didnt pay for licensing it is illegal

#

period

warped mirage
#

ok , what I’m in streaming music that isn’t popular

vocal plover
#

Ok let me rephrase

#

Any music on spotify, youtube, amazon music, etc. is - with a 99.999% certainty - copyrighted and cannot be streamed legally without paying for licensing it

warped mirage
#

Wait general things like suggest commands , ban commands and all that sort are legal right ? Since they are for discord purpose only .

vocal plover
#

yeah why wouldnt they be

warped mirage
#

Idk so it’s only when ur using a different app for discord , that’s when it becomes illegal if not paid

#

Correct ?

robust fulcrum
#

!paste

warped mirage
#

Can someone rephrase what this means

robust fulcrum
#
@client.command()
async def test(ctx):
    await ctx.send("0--- loading")
    await asyncio.sleep(1)
    await message.edit(content = "-0-- loading")
    await asyncio.sleep(1)
    await message.edit(content = "--0- loading")
    await asyncio.sleep(1)
    await message.edit(content = "---0 done!")

Pls help me getting error that
Undefined name 'messsge'

warped mirage
robust fulcrum
#

How me not understanding

#

@warped mirage did ctx.edit

#

Now it says discord.ext have no attribute edit

#

@slate swan can you help me pls

#

I used ctx.edit
It says discord.ext have no attribute edit

slate swan
#

error says pretty much all

robust fulcrum
#

Hmm

slate swan
#

where is message defined?

robust fulcrum
#

I did import
from discord import edit

#

it's ctx.

slate swan
#

...

#

discord has no attribute edit

robust fulcrum
#

Or i need to add variable

slate swan
#

a GuildChannel, Message, etc. have edit methods

robust fulcrum
#

ok

slate swan
#

not discord

robust fulcrum
#

message = ctx.send(anything)

#

This?

slate swan
#

yes

rare saddle
#

Please tell me what should I do? I'm not a lawyer, and I'm sure I can't spell it correctly.

slate swan
rare saddle
#

So that there are no problems in the future

slate swan
slate swan
# rare saddle yea

best you could do is, either create a repo on github and add your bot's TOS to the README.md or create a static website (html and css)

rare saddle
#

How to do it right

slate swan
rare saddle
slate swan
#

thats a license

#

its of how you can use the code of the app

#

not your app's TOS

warped mirage
#

woudnt make too much sense tbf

slate swan
#

it states out the rules about how you can use the app and how you cannot

warped mirage
#

so wtf am i meant to put

slate swan
warped mirage
#

and how do i do that

slate swan
#

ofc after creating the TOS

warped mirage
#

can u gimme a example of tos

#

even tho im making my own bot which wont be illegal ....

#

@slate swan

slate swan
warped mirage
#

can u explain more...

#

like using the commands ? like what damn tos lol , for who????

regal pulsar
#

hello

regal pulsar
#

tos is terms of service

slate swan
# warped mirage can u explain more...

they are rules for an app for the consumer to the product

for example, take a library, it has a rule that all the visitors are to be silent, visitors here are consumers and the library is the app, and the library's TOS is that everybody be quiet in the hall

#

hopefully you understand

warped mirage
#

so how does it work for my bot lmao , its not like im gonna make bad commands

#

bruh no sense.......

slate swan
warped mirage
#

commandlist ?

slate swan
#

you're only forced to add a TOS to your bot if your bot is gonna be undergoing verification

warped mirage
slate swan
#

the usage rules for your app

#

for the consumers

warped mirage
#

Bruh what rules??

#

for the commands ?

slate swan
warped mirage
#

how tf do i make rules for commands , gimme a example

#

as i said before i aint gonna add illegal commands....

warped mirage
#

@slate swan look , i understand this , so what they will have access to my bot and dashboard

#

or what cuz makes no sense

slate swan
#

...?

#

bot and dashbaord?

warped mirage
#

idfk will they have access to my application? and view token and that

warped mirage
#

then how the f do they see this ???

slate swan
#

😭

#

they wont see that

warped mirage
#

then why the f do i make tos and what for

slate swan
#

read this

warped mirage
#

bro @slate swan it makes no sense

#

please explain

slate swan
#

dude, you're stubborn

warped mirage
#

only discord have tos for fs lmao

slate swan
#

😭

warped mirage
#

bots cannot have a tos

slate swan
#

a website, an android app, an iOS app

#

etc