#discord-bots

1 messages Β· Page 356 of 1

ebon ocean
#

Whatever.

brazen raft
#

What errors do you get

glad cradle
#

the one that is called "Windows installer - 64-bit"

#

you still need to install the packages

#

and select the new python version in Vs code

ebon ocean
midnight oracle
ebon ocean
#

Says it already installed.

midnight oracle
glad cradle
ebon ocean
#

I don't even know where to find it, let alone put it.

midnight oracle
midnight oracle
ebon ocean
ebon ocean
glad cradle
ebon ocean
glad cradle
#

arm64 is most likely the wrong build for your pc

glad cradle
midnight oracle
ebon ocean
glad cradle
ebon ocean
glad cradle
#

did you select the add to PATH option when installing python 3.12?

ebon ocean
#

Or was i not supposed to hit install button?

glad cradle
glad cradle
ebon ocean
#

guess can download it again and redo it

glad cradle
#

take a screenshot at the corner and let me see

ebon ocean
glad cradle
ebon ocean
#

That's what comes up.

ebon ocean
glad cradle
#

do this then

ctrl + shift + p
type Python select interpreter and press enter
select python 3.12

#

if python 3.12 is not there you need to add python to PATH following the guide that you sent

ebon ocean
#

It gave me error message, sigh that extremely hard guide

#

I'm guessing the one that says 3.12 64 bit is the one?

woeful thistle
#

I am still stuck with the attribute error that I got few hours ago so might need help with that again.

    @tasks.loop(minutes= 10)
    async def timezone_update(self):
         guild = self.client.get_guild(<ID HERE>)
         argentina = guild.get_channel(<ID HERE>)
         us_central = guild.get_channel(<ID HERE>)
         us_pacific = guild.get_channel(<ID HERE>)
         asia = guild.get_channel(<ID HERE>)
         jst = guild.get_channel(<ID HERE>)
         await argentina.edit(name= f'πŸ•“ Argentina {ART.strftime(fmt)}')
         await us_central.edit(name= f'πŸ•“ US Central {CST.strftime(fmt)}')
         await us_pacific.edit(name= f'πŸ•“ US Pacific {PST.strftime(fmt)}')
         await asia.edit(name= f'πŸ•“ PH/SG/CN {UTC8.strftime(fmt)}')
         await jst.edit(name= f'πŸ•“ Japan {JST.strftime(fmt)}

the said error:

Traceback (most recent call last):
  File "G:\pythonProject\discord_bot\.venv\Lib\site-packages\discord\ext\tasks\__init__.py", line 239, in _loop
    await self.coro(*args, **kwargs)
  File "g:\pythonProject\discord_bot\main.py", line 58, in timezone_update
    argentina = guild.get_channel(<ID HERE>)
                ^^^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'get_channel' ```
#

I tried doing it with my old code without cogs and it works there but doesn't loop

#

one above is the new one using cogs for timezone.

ebon ocean
#

PS: I'm getting somewhere.

#

This as far as I got

#

Taken from website

#

Step 4: Add Python Path to User Environmental Variables
There will be two categories namely β€œUser” and β€œSystem”, we have to add it in Users, click on New button in the User section. Now, add a Variable Name and Path which we copied previously and click OK. That’s it, DONE!

glad cradle
#

refresh vscode too

glad cradle
#

the guild is not cached

woeful thistle
#

The intents I am using is discord.Intents().all()

glad cradle
#

you can do

guild = self.client.get_guild(...) or await self.client.fetch_guild(...)
woeful thistle
#

Oh, that actually work! I got an error with the other variables but also used the same code to fetch the other channels and now they work!

#

Now it's only the matter of whether the loop works 😭

glad cradle
ebon ocean
#

@glad cradle I finally finished that guide and it did absolutely nothing

woeful thistle
glad cradle
glad cradle
ebon ocean
#

I come to the conclusion that those false errors will always be there.

#

I DON'T KNOW WHAT TO DO!

ebon ocean
#

Never go to that discord py dpy s--t server unless you want this to happen with you.

ebon ocean
safe seal
ebon ocean
viscid hornet
safe seal
# ebon ocean I deleted them all.

I see. I am no health professional and don't know what the conversation there was, but incontrollable fits of rage are never a good sign. You should probably consult a medical professional?

#

I've always had positive interactions in discord.py so I can't relate to your anger either. Good server

viscid hornet
#

like an above your normal temp bath where it stings when you go in or move around but once you adjust it works fine

pale zenith
woeful thistle
ebon ocean
#

If you don't know 100% about everything about computers or python, then you are worthless piece of s--t over there.

wicked cairn
#

That's quite wrong, there are countless of helpful people over there, the difference is, they won't spoonfeed but try to show you a path towards the solution.
It's basically just assistance in thinking. (besides, one of the rules over there states you are supposed to have a basic understanding of Python, so, that's on you, it's not a beginner lib)

ebon ocean
#

Yes FU-K THOSE PIECES OF S-IT who truely want to learn! It's like people who want to learn math and they try and learn it, and we say FU-K YOU! Like come on, LMAO, you should already know most of all the math even though that is really arbitrary to really know what is considered basic or not. You should know the quadratic formula. Instead of just telling you the quadratic formula, will tell you to use this axΒ²+bx+c=0 and solve for x to get the quadratic formula. I mean, I DID PROVIDE you the information you need to. Not my fault if you're an idiot who can't figure out how to solve for x. That's a "basic" level of math! I'm so f--king superior and better than you and look down upon you for the crime of trying to learn something! Sarcasm.

wicked cairn
flat pier
wicked cairn
#

And in your help post you were even told how you can mitigate your issue, I don't see the problem really.

#

Well I do, but I won't get into it.

ebon ocean
wicked cairn
#

Once again, outlined in the same help post πŸ™‚

ebon ocean
wicked cairn
#

Well, people just aren't going to give you that, regardless of your situation, because you don't learn that way (or shouldn't)

ebon ocean
#

Anyway f--k you, pissing me off!

wicked cairn
#

Seek a therapist.

ebon ocean
#

Anyway, f--k you all except that one person who was always fair to me. I give up on python. I'm too r word and stupid for this. I don't wanna ever see python ever again. And that person I just blocked can go straight to hell with that other jerk. I have no friends and nothing to lose, so f--k all of you mean evil people!

flat pier
#

bro πŸ’€

blissful lagoon
#

!timeout 241629325223395329 2d Chill out. You need a better attitude if you want to participate in our community.

unkempt canyonBOT
#

:x: The user doesn't appear to be on the server.

blissful lagoon
#

ok

pale zenith
#

lol

languid steppe
#

lol

flat pier
#

r/im14andthisisdeep

hallow osprey
#

lol

quaint epoch
#

lol

woeful thistle
#

lol

rugged shadow
#

lol

severe sonnet
#

okay guys

#

how do i make a loading message

#

before the bot send another message?

#

i need it to my bot don't time out

#

on response

severe sonnet
#

guys

#

how do i make a follow up response

#

message

upbeat otter
blissful grove
#

There are no errors in my code, there are no warnings on my terminal. But the slash commands take FOREVER to sync with the server guild. I am unable to diagnose the problem. Please help.

Ive also given a 8 hours gap. The problem still persists

golden portal
#

A, C is yes, B is no

turbid condor
#

am confused

blissful grove
turbid condor
#

syncing is instanteneous afaik

blissful grove
turbid condor
#

just need to restart the discord app that's it

golden portal
#

yes, as long as the bot have read message history permission, you can fetch messages

turbid condor
#

wait why can't we search a specific word?

golden portal
turbid condor
#

it needs perms for it

#

unlesss it has admin which overrides all other perms

turbid condor
obsidian hill
#

I’ve never created a discord bot In py but Ima learn now, what’s the best way to create a currency system and give a different amount of /daily currency based on role? Then when they run a / command it charges one credit and runs main.py ?

hushed galleon
# obsidian hill I’ve never created a discord bot In py but Ima learn now, what’s the best way to...

there's two main topics to tackle at once:

  • For the currency system, you'll want to use a database so that you can permanently store each member's currency. SQLite's a good start, since its file-based, supports concurrent reads/writes, and is well suited for organizing data from discord (users, guilds, members, etc.). Python has a built-in sqlite3 module so it's easy to use in most projects.
  • discord.py's a popular library for writing discord bots, where your script connects to discord to receive real-time events and make API requests. Commands are defined as functions, and dpy will automatically call them for you when someone wants to use your command.
    That's a general overview of it, but when you get into it you'll deal with more specific details like learning SQL, defining a command tree, dealing with async/await syntax, etc.
drifting arrow
#

:D

#

Why use SQLITE?! just store everything in a txt file.

#

Wait no. heheheh individual txt files for each user 😎

obsidian hill
drifting arrow
#

Take it a step further.
Folder named "database"
subfolders for each individual user
txt files named after each column/data thing you need to monitor.
each file holds a single entry

obsidian hill
#

I can figure out the currency part, but my current code generates a tiktok style video. And I need it to generate when they purchase, how would I make the command run main.py and then dm the user the output?

hushed galleon
#

if it helps, here's a glimpse of what dpy code looks like: ```py
import discord
from discord.ext import commands

Ask discord to send us non-privileged events,

like when the bot joins a guild or a message is sent

intents = discord.Intents.default()
bot = commands.Bot(command_prefix="?", intents=intents)

Define a slash command named /daily:

@bot.tree.command()
async def daily(interaction: discord.Interaction):
money = 500
await interaction.response.send_message(f"You received your daily reward of {money}!")

@bot.event
async def setup_hook():
# After the bot first logs in, tell discord about our slash commands:
await bot.tree.sync()

bot.run("your.token.here")```

drifting arrow
#

So basic

hushed galleon
obsidian hill
#

So would it be easier to integrate the bot into my main.py instead?

#

Just make the video generating a function

hushed galleon
#

kind of, usually your main.py script would be the one hosting your bot

#

yeah, once its in a function you can call that in your command every time someone uses it

drifting arrow
#

It's usually encouraged to do the cogs system

obsidian hill
#

Only problem is it doesn’t generate everything in one file it goes all over with all kinds of utils and idk if that’s a problem

#

I’ll try to do it

#

I wish I could do the bot in js I’d already be done 😭

drifting arrow
#

All a command is doing is running the code you tell it to run. You don't need to limit yourself to just that function. if you know it'll take a few moments to finish you can defer the response

obsidian hill
#

But my ass gotta be special and learn py πŸ’€

drifting arrow
#

You can do it in js..

#

discordjs

obsidian hill
#

I can do the bot in js and run a python script on cmd?

drifting arrow
#

literally anything you can do in python you can do in js

obsidian hill
#

Ik but that would mean converting my entire video generator into js

#

So if I were to do it in js I’d need to run a python script in a js cmd

hushed galleon
#

theoretically your node.js discord bot could run your python script on demand in a subprocess

drifting arrow
#

o7 you absolute legend

obsidian hill
#

Hm alr

hushed galleon
drifting arrow
#

My last ventures into html/css/js ended resulting in a website that looks like its from the 90s lol

obsidian hill
#

I might just hop my ass over on fiverr so I can focus on the course part of it and let someone else do the bot πŸ’€

drifting arrow
#

Alright. pythons not that hard, but alright.

obsidian hill
#

Welll

#

Do I reallllllllyyyyyy wanna learn it just for a discord bot????

#

Or throw my not so hard earned money at it and hope it works

drifting arrow
#

Majority of programming is mostly about learning the syntax and the various methods to achieve a task. Like all those loops and shit.

Once you understand that, you can easily transition from language to language and adjust to the syntax.

Like once you learn that SQL is written the same in most popular languages, your only challenge becomes learning the syntax as it varies slightly.

drifting arrow
obsidian hill
#

Someone should make the Minecraft language skript a real thing

#

That might just be typescript tho idk πŸ’€

upbeat otter
midnight oracle
#

How do I turn off the visibility of a channel trough code?

#

I'm using the create_text_channel()

upbeat otter
#

You can't. It's done from the client side

midnight oracle
#

but it says that the "visible" argument doesn't exist

midnight oracle
upbeat otter
#

Do you want it to be a private channel?

midnight oracle
upbeat otter
#

Then pass the roles which can access it

#

!d discord.Guild.create_text_channel

unkempt canyonBOT
#
await create_text_channel(name, *, reason=None, category=None, news=False, 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/latest/api.html#discord.TextChannel) for the guild.

Note that you must have [`manage_channels`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Permissions.manage_channels) 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) of overwrites with the target (either a [`Member`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Member) or a [`Role`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Role)) as the key and a [`PermissionOverwrite`](https://discordpy.readthedocs.io/en/latest/api.html#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/latest/api.html#discord.TextChannel.edit) will be required to update the position of the channel in the channel list...
midnight oracle
#

gotcha, thanks :D

upbeat otter
#

See the documentation of this method
There is an overwrites kwarg you can set. It is detailed within the docs

viscid hornet
upbeat otter
spice seal
#

Guys I can't make a discord bot on pythonanywhere.com
It's showing this
No module named discord
And when I give
pip install discord.py
It says this
pip install discord.py syntax error

upbeat otter
#

But what's the complete error

slate swan
#

Hey everyone! The problem is I know how to code a discord bot but I'm having trouble connecting my git to github to push code. I did it, however it says that I need to set username and email to push code. I tried doing it, but it says that the git command is not recognized. Can anyone help?

viscid hornet
#

this channel is for help with discord bots (like the bots themselves) so i don’t think you’ll get much help here

slate swan
viscid hornet
slate swan
shrewd apex
#

ok cool

spice seal
floral tulip
#

guys if anyone looking for domains or cloud storage or priavte ip security pls dm me!!

unkempt canyonBOT
#

6. Do not post unapproved advertising.

floral tulip
#

mb

viscid hornet
#

best bet is replit atp

spice seal
viscid hornet
spice seal
#

Oh

#

How to get it then

upbeat otter
#

Buy a server

#

Or buy replit

viscid hornet
# spice seal Oh

PA has hosting but its basically the same constraints as replit

viscid hornet
upbeat otter
#

😳

rugged shadow
#

$10 will get you an okay VPS

upbeat otter
#

That's more than enough to get a pretty good vps πŸ’€

spice seal
spice seal
viscid hornet
#

how tf did you code a discord bot on your phone

spice seal
#

Bruh that's the same thing

spice seal
#

but

viscid hornet
#

?

upbeat otter
#

Yes

turbid condor
#

depends on what lib you using

upbeat otter
#

Pls don't refer to pycord indirectly

quick gust
#

Correct

upbeat otter
#

😭

turbid condor
#

but yeah discord.bot isn't anything

turbid condor
upbeat otter
#

Nobody likes pycord 😭

turbid condor
#

calling in pycord users

#

calling in pycord users ...

#

XD

#

I can name a few

#

including pycord, nextcord, disnake

#

but yes in discord.py it's

from discord.ext import commands

bot = commands.Bot(command_prefix='Your_Prefix', intents = ...)
#

!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) and as a result anything that you can do with a [`discord.Client`](https://discordpy.readthedocs.io/en/latest/api.html#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) to provide the functionality to manage commands.

Unlike [`discord.Client`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Client), this class does not require manually setting a [`CommandTree`](https://discordpy.readthedocs.io/en/latest/interactions/api.html#discord.app_commands.CommandTree) and is automatically set upon instantiating the class.

async with x Asynchronously initialises the bot and automatically cleans up.

New in version 2.0.
turbid condor
#

you imported it right?

#

no

turbid condor
#

it's a module inside discord

#

u need to specifically import it

unkempt canyonBOT
#
viscid hornet
#

commands.Bot

turbid condor
#

you need to first import commands from discord.ext module

#

then do

bot = commands.Bot()
viscid hornet
turbid condor
naive briar
#

You just asked

#

Yes. But why would you want to do that?

turbid condor
#

no it's an open source project

naive briar
#

No, it's a community project

turbid condor
#

well i doubt you will get anywhere near editing it for now

viscid hornet
#

yes it uses discord’s API to make that happen

#

nobody else

turbid condor
#

yes along with adequate knowledge of the programming language you use

viscid hornet
#

no, use the dpy docs because you want to make a bot with dpy, not remake dpy from scratch

viscid hornet
#

to make a bot, they should use dpy docs

turbid condor
viscid hornet
turbid condor
#

well i'd just use discord.py to create my own wrapper tbh

#

instead of going after the raw API

viscid hornet
turbid condor
#

learn step by step instead jumping into the ocean

viscid hornet
#

its just easier to say dpy

turbid condor
#

it's great that you are trying to learn but there are levels to everything

#

which you should follow in sequence instead of jumping from level 1 to 50

viscid hornet
#

mfs writing a book

turbid condor
#

XD

viscid hornet
#

still going?

turbid condor
#

πŸ’€

viscid hornet
#

how much thinking did that take 😭

turbid condor
#

learn python till you are at advanced level first

viscid hornet
#

what dpy classes?

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) and as a result anything that you can do with a [`discord.Client`](https://discordpy.readthedocs.io/en/latest/api.html#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) to provide the functionality to manage commands.

Unlike [`discord.Client`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Client), this class does not require manually setting a [`CommandTree`](https://discordpy.readthedocs.io/en/latest/interactions/api.html#discord.app_commands.CommandTree) and is automatically set upon instantiating the class.

async with x Asynchronously initialises the bot and automatically cleans up.

New in version 2.0.
viscid hornet
#

wdym by modify

#

you cant rename or rewrite stuff

#

thats how the lib was made and it was made for a purpose

naive briar
turbid condor
viscid hornet
#

and the class names are only so long because it's basically going from py import discord so for this it'll be py discord.ext.commands.Bot(...)
but you can use imports to make it easier, ie. py from discord.ext import commands commands.Bot(...) # much smaller

viscid hornet
#

average pycord supporter

viscid hornet
#

Bot is a class

naive briar
#

commands is a module

turbid condor
#

so we need an insult_cord now

naive briar
#

It's a folder

viscid hornet
#

i'm gonna see if i can pull up a file tree for it

naive briar
#

Look at the channel's topic

#

There's a link to the project's GitHub

viscid hornet
naive briar
#

I tend to forget about it too

#

Yes

viscid hornet
#

yep

#

heres the file tree for commands.Bot ```
.
└── discord
└── ext
└── commands
└── bot.py
└── Bot() class

#

you can use commands.Bot instead of commands.bot.Bot because in the commands folder, it has an __init__.py which is basically a setup file, that says py from bot import *

#

!e py f = print f('hi')

unkempt canyonBOT
#

@viscid hornet :white_check_mark: Your 3.12 eval job has completed with return code 0.

hi
viscid hornet
#

you can have classes with the same name as files, yk

#

this exists (idk if its a file, class or wtv) py datetime.datetime

#

yes, you see it a lot in libraries online

#

classes also have an __init__ which defines the class properties upon initialisation, eg.

#

!e ```py
class A:
def init(self):
self.var = 9

a = A()
print(a.var)```

unkempt canyonBOT
#

@viscid hornet :white_check_mark: Your 3.12 eval job has completed with return code 0.

9
viscid hornet
#

this is like snippets of advanced knowledge, dont worry

#

2 separate things prettythumbsup

#

yes, because __init__.py is used for installing libraries and modules and whatnot

#

wdym?

#

do you know about classes?

#

thats functions

#

i asked if you know classes

#

loads more

#

ok, how do you make a class

#

like i said, much more

#

i asked, do you know what a class is?

#

have you seen this before? py class SomeClass: def some_func(self): something = ... return something

#

i use them to centralise data, but you can do some cool stuff like inheritance

#

i feel like you need to be more specific

#
# this is a function
def func():
    return 5

class A:
    # this is a method
    def func(self):
        return 5

# both use def
#

if you have a method, call it a method

#

if you have a function, call it a function

#

clarity is key prettythumbsup

#

hi link

spice warren
viscid hornet
spice warren
#

That's a class level attribute

A.var will work

viscid hornet
#

thanks link πŸ™

viscid hornet
spice warren
#

You can define them sure, you can't add special functionality to them

spice warren
#

What would you want to add to it?

viscid hornet
spice warren
#

That's very unhelpful

#

Please define this "utility" you want to add

viscid hornet
#

anything

#

like how to generally make your own methods that look like this __this__

spice warren
#

A single python file isn't exactly special

You can add one class or a billion classes in one file no issue, when it comes to importing from it is when you may face difficulty but that's rather unrelated

viscid hornet
#

i'm probably waffling ngl, i dont sound clear at all

#

asking vague questions joystroke

spice warren
#

You can define your own dunder methods sure, you can't make your own magic methods, not without some cursed knowledge I won't share here

def __foo__() -> str:
  return "foo"

__foo__()

will work as you expect

viscid hornet
#

i'll let it slide, thanks for the help πŸ™

#

whats your question

#

also use "function" and "method" to define what you mean. both use def which creates ambiguity for what you generally mean

spice warren
#

(as someone new to Python, it's on you to try and figure out the difference until they're able to make the distinction themselves, it's a little non-trivial at first)

viscid hornet
#

return

#

thats also not a class

#

thats a function

#
  1. thats not a class
  2. use return
shrewd apex
spice warren
#

you can do some trickery outwidth it but it wouldn't be seamless nor good

#

see: forbiddenfruit and the like

shrewd apex
#

aight omw to take a look

#

ty

golden portal
#

can u rephrase that

glad cradle
#

this is the wrong channel for these questions

shrewd apex
#

thats not an error its an info log

#

send ur traceback

thin raft
#

theres a traceback there

shrewd apex
#

are u on some vpn?

thin raft
#

are you on macos?

shrewd apex
#

try to change ur net connection to a hotspot once and try

viscid hornet
#

where are you from btw

shrewd apex
#

its an internet issue lol

#

its not able to verify the ssl cert

#

??

viscid hornet
#

thats a command

viscid hornet
#

nobody said that 😭

#

alr hold on

#

thats fine

#

use that instead

#

i’ll delete the other one

shrewd apex
#

i have told u before also lol thats just a log

#

its not an error

#

wdym solve it? that will always print

#

its not an issue

#

its a message or information

#

yes

#

how is that an error

#

thats for the 443 ssl error

#

lmao

#

when you have no idea what you are doing

#

its not a bot issue

#

maybe try switching to your mobile hotspot

#

??

#

sure

#

why not

#

maybe also rebuild discord while we are at it

#

maybe not today i am kind of tired

obsidian hill
# upbeat otter Minecraft uses java which is comparatively harder to learn

Nah, theres a plugin called skript which most people use. It allows for coding for shi like this ```on first join:

command /start:
trigger:
give player wooden pickaxe named "<##BB8054>&lStarter Pickaxe" with lore "&f" and "&fα΄‘α΄€Κ€α΄˜ ᴛᴏ α΄›Κœα΄‡ &e&l/ᴍΙͺɴᴇ&f ᴛᴏ ɒᴇᴛ" and "&fΚ€α΄‡κœ±α΄α΄œΚ€α΄„α΄‡κœ±" and "&f" and "&f&cꜱʜΙͺκœ°α΄› &f+ &cΚ€ α΄„ΚŸΙͺα΄„α΄‹&f ᴛᴏ" and "&fα΄œα΄˜Ι’Κ€α΄€α΄…α΄‡" and "&f" and "&7&lCOMMON" with all flags hidden
set {EnchantLvl::%uuid of player%} to 0```

#

I coded my entire factory server in it

dawn lake
#

How can I start making a bot with python?

#

I know that

naive briar
#

Yes, reset to get the token

dawn lake
#

I mean where i can test my commands of that like where to host bot

naive briar
brittle turret
#

🀣🀣🀣

dawn lake
#

Any newbie here like me?

brittle turret
dawn lake
brittle turret
#

U can't talk either 🀣

dawn lake
#

Wdym

brittle turret
dawn lake
#

Where you host your bot?

#

Say how you test your codes either it's working or naut

#

Idk

#

Idk python things in discord

#

Lol

#

U need to host

#

To make it online

#

Pay

#

There are free hosting providers too

viscid hornet
dawn lake
viscid hornet
viscid hornet
#

there are quite a few constraints, including network constraints

dawn lake
#

Then what? I want when my codes are finished then I will start paying to any host

#

Until test my codes on free host

viscid hornet
dawn lake
#

Mobile user (ikik too much pain these days)

quick gust
#

the "static token" isnt the error

dawn lake
#

Areee you on PC?

quick gust
#

no... I'm saying that the "static token" line isnt the error, its an information log

#

yes token of the bot

dawn lake
#

Are you making a normal App or kinda dynamic? With d.py?

sick birch
#

No, it uses a cloud computer

dawn lake
#

See on youtube how to make a bot

sick birch
#

I'm not understanding you, sorry

dawn lake
#

Ohh lol now i get it

#

You are new to discord

obsidian hill
#

What would be the best way to upload a file (to big for discords messages) through a bot?

#

I was thinking upload it to a host with api or smth but idk

obsidian hill
#

mp4

dawn lake
#

tf first explore discord then decide to make stuffs

sick birch
#

Otherwise blob storage is the way to go

dawn lake
#

πŸ’€ n

#

No

sick birch
#

@wide plaza can you tell us more about the problem?

obsidian hill
#

Also whats the cost like

dawn lake
obsidian hill
dawn lake
#

Use chatgpt

#

Even i have that app

obsidian hill
#

Github

#

I p sure discordpy has a example code πŸ’€

dawn lake
#

Do you know Python well?

obsidian hill
#

This isnt makeawish

dawn lake
#
import discord

# Create a client instance
client = discord.Client()

# Event: When the bot is ready
@client.event
async def on_ready():
    print('Bot is ready.')

# Event: When a message is received
@client.event
async def on_message(message):
    # Check if the message is from the bot itself
    if message.author == client.user:
        return

    # Check if the message is a command
    if message.content.startswith('!embed'):
        embed = discord.Embed(
            title="Embedded Message",
            description="This is a simple embedded message.",
            color=discord.Color.blue()
        )
        embed.set_author(name="ChatGPT")
        embed.add_field(name="Field 1", value="Value 1", inline=False)
        embed.add_field(name="Field 2", value="Value 2", inline=True)
        embed.set_footer(text="Footer text")

        await message.channel.send(embed=embed)

# Run the bot with your token
client.run('YOUR_DISCORD_BOT_TOKEN')```
#

This is to build simple embed

upbeat otter
#

You cant learn to use dpy just by looking at code you don't even understand

dawn lake
#

You should try it with your bot

upbeat otter
#

What problem

dawn lake
#

You have to know python then d.py to make stuffs

obsidian hill
#

Im trying python for the first time. If I define a function in main.py It can be called in bot.py right? πŸ’€

#

Or do I gotta recall it

dawn lake
#

Recall it

#

import < that func >

upbeat otter
#

You can't do that

obsidian hill
dawn lake
#

Maybe

obsidian hill
#

Like import function from ...

#

I dont think so right

dawn lake
#

Why don't you YouTube it ?? How to host my bot "free"

#

Then test codes

upbeat otter
quick gust
dawn lake
#
  • you need to make bot online to run codes... How? Host it

  • learn python.. if yes...

  • learn d.py... how?

  • HERE

upbeat otter
#
import discord

client = discord.Client(intents=discord.Intents.all())

@client.event
async def on_message(message):
    await message.channel.send("I will ban you")

client.run(token)```
upbeat otter
dawn lake
#

I am learning python only for my Bot

upbeat otter
upbeat otter
#

Or cpp

#

you will hve a fine time trying to make a bot

dawn lake
#

Why not python?

upbeat otter
dawn lake
#

Can't we make bots with it?

dawn lake
#

Also python is my first open source language which i am learning

quick gust
#

client.run

quick gust
upbeat otter
quick gust
#

but ash was just being sarcastic, since CPP's syntax is comparatively harder

dawn lake
dawn lake
upbeat otter
dawn lake
#

πŸ’€β˜ οΈ.

turbid condor
upbeat otter
#

what else do you wanna compare 😭 nobody likes nerdy stuff here

#

😭😭

dawn lake
#

Idk what is cpp syntax

quick gust
turbid condor
dawn lake
quick gust
#

It's fine

dawn lake
#

Use original bot token instead of "token here"

turbid condor
#

Forgot about that

slate swan
#

Does anyone know if it is possible (if yes then how) to put multiple attachements (images) inside of 1 embed?

#

using the embed.set_image() func

quick gust
#

you can't set more than one I'm pretty sure

slate swan
#

I feel like there was indeed a way but can't remember it

#

@restive perch any ideas, magic box? pithink

upbeat otter
slate swan
#

ah man

upbeat otter
#

there is a reason it is named image and not images

restive perch
#

Well technically you can do that

#

But thats a split view

#

with max 4 images

slate swan
#

that would be enough images

upbeat otter
#

yeah but they're pretty small then 😭

slate swan
#

do you know how to implement that?

restive perch
#

Nah, they arent shown properly. Like it already does if you send 4 attachments in chat

#

They get big if you click on them

#
# For this to work correctly, both embeds need the same `url` in the constructor. The URLs in `set_image` can be different.
embed = discord.Embed(url="some custom url")
embed.set_image(url="image 1")
embed2 = embed.copy()
embed2.set_image(url="image 2")
await send(embeds=[embed, embed2])

# Better code was suggested by Maya [455289384187592704]
slate swan
#

wouldn't that just send 2 separate embeds?

#

time to do some testings

#

nevermind, it could work after reading the docs

hushed galleon
#

when you open the bot tab in the developer portal, you can scroll down to see the privileged intents that you have to enable before your code can use them

#

as per the above text, you don't have to worry about verification for small bots

upbeat otter
#

but what did you actually achieve

#

you don't know python and you just copy pasted the code and you understand none of it. not being rude but it's of no use

sick birch
sick birch
#

It only works on PC sadly

obsidian hill
dawn lake
#

They are giving a bundle

junior falcon
#

Hey there, im making a bot and im using the requests library but i need to send the request with a different ip then the one where the bot is hosted. How could i achieve that?

meager rock
#

O.o

meager rock
upbeat otter
#

sarthakkkkk hellooo

#

it's been soooo long

meager rock
upbeat otter
obsidian hill
#

would it be like ```from main import make_final_video, main

junior falcon
viscid hornet
#

its in a feedback loop

#

dont use events, use commands (as a beginner)

#

on_message is called when a message gets sent, but after a message is sent, the bot also sends a message, creating an endless loop

#

no thats not related to dpy

#

it says the basics about how coroutines work by the looks of it. nothing to do with dpy

#

yes

#

lemme show two examples rq

quick gust
viscid hornet
#

yes

#

πŸ‘

#
# this is an event
@bot.event
async def on_message(message):
    if message.content.startswith('thumbsup'):
        await message.add_reaction('πŸ‘')

# this is a command
@bot.command()
async def thumbs_up(ctx):
    await ctx.message.add_reaction('πŸ‘')```
quick gust
#

once you learn them, dpy is easy

viscid hornet
#

can you rephrase? im not getting your question.
also use the terms "function" and "method"

#

nope. you just made a feedback loop because its responding to itself

#

what language is "details and roots"?

#

no like the language you speak

quick gust
#

no you cannot

viscid hornet
#

nope

#

you're adding a reaction, so you need an emoji

#

does the python bot even run dpy?

#

!e py import discord embed = discord.Embed() embed.description = 'hi' print(embed.description)

unkempt canyonBOT
#

@viscid hornet :x: Your 3.12 eval job has completed with return code 1.

001 | Traceback (most recent call last):
002 |   File "/home/main.py", line 1, in <module>
003 |     import discord
004 | ModuleNotFoundError: No module named 'discord'
viscid hornet
#

exactly a copy of my example

quick gust
#

no the two functions have the same name, that wont work

viscid hornet
quick gust
#

yours is correct

viscid hornet
#

oh wait no i did change the name

quick gust
#

but @wide plaza isn't

viscid hornet
#

yes

quick gust
#

nope, a function has a unique name

#

they didn't forget anything

viscid hornet
#

cool prettythumbsup

quick gust
#

this is almost correct, you just need to change the function name of the command

#

which is after async def

viscid hornet
#

no

#

they're two different things

#

because they are?

quick gust
#

you can do that but its not a good practice.

glad cradle
#

is it too difficult to learn python basics first and then use discord.py?

quick gust
#

Β―_(ツ)_/Β―

viscid hornet
#

you're not hearing me. they are:
TWO
SEPARATE
THINGS.

quick gust
#

@wide plaza ill just say its difficult to teach basic python, espceially in a #discord-bots channel. You should really consider learning python first

viscid hornet
#

learn python first, learn the terminology so communicating your problems is easier, and then learn dpy

blazing beacon
quick gust
#

otherwise its hell trying to learn dpy

blazing beacon
blazing beacon
viscid hornet
#

yes. quite important

#

i dont send 1000 lines of code and expect you to find one line. where'd you get that from? farm_vspongesquint

hushed galleon
#

for point 3, the differences are due to how dpy implemented their decorators, but knowing the technical details about it isn't too important

limpid apex
#

Would this work for a button?

@bot.command(name="test_buttons")
async def test_buttons(ctx):
  view = discord.ui.View()
  style = discord.ButtonStyle.green
  embed = discord.Embed(title="Button Testing", description="This is a test")
  item = discord.ui.Button(style=style, label="Test")
  view.add_item(item=item)
  await ctx.send("Test", view=view)
#

Cuz im hella new to buttons

naive briar
#

Sure

limpid apex
#

oh fr?

naive briar
#

You'd need a callback to make the button remotely useful though

viscid hornet
viscid hornet
# limpid apex I see

like this, if you want an example: ```py
class MyButton(ui.Button):
def init(self):
super().init(your_qualities)

async def callback(self, interaction: ...):
    # whatever you want to happen when the button
    # gets clicked. uses interaction```
limpid apex
brazen raft
#
  1. Because otherwise the name of the function will reference the lastly defined function and the former definitions would lose reference. On another note, discord.py registers async def on_message functions decorated with event as event handlers for the event of newly received messages.
  2. Can, but this isn't meaningful in the same way. What you have will error because the name ctx is not a thing in the.. context of the command function.
  3. It's an arbitrary choice on two accounts
glad cradle
slate swan
viscid hornet
# limpid apex Okay! Thank you, I appreciate it

so you could have a green button that says "Click Me!" and when you click it, it responds saying "You clicked me!": ```py
class MyButton(ui.Button):
def init(self):
super().init(
label = "Click me!",
style = ButtonStyle.green
)

async def callback(self, interaction: ...):
    await interaction.response.send_message("You clicked me!", ephemeral = True) # ephemerals make it so only you can see the message```
viscid hornet
limpid apex
#

and ui.Button is also giving me an error

limpid apex
#

Didn't see this! Thanks lol

viscid hornet
limpid apex
viscid hornet
unkempt canyonBOT
#

class discord.ui.Button(*, style=<ButtonStyle.secondary: 2>, label=None, disabled=False, custom_id=None, url=None, emoji=None, row=None)```
Represents a UI button.

New in version 2.0.
viscid hornet
#

all those arguments are your_qualities

naive briar
limpid apex
#

Thanks again!

viscid hornet
#

hold on, lemme bike and grab my pizza

viscid hornet
hushed galleon
brazen raft
#

Right

#

I forgot that's a thing

limpid apex
#

How would I refrence the button to use it?

#

would it just be MyButton.Super()?

quick gust
#

Just, button = MyButton()

limpid apex
#

ok! Thanks!

brazen raft
#

Depends on the terms of service

obsidian hill
#
AttributeError: module 'discord' has no attribute 'Intents'``` wsp with this? Python 3.10
brazen raft
#

Did you name some folder discord

limpid apex
# quick gust Just, `button = MyButton()`

for the send, would this work:

@bot.command(name="buttontest")
async def buttontest(ctx):
  button = MyButton()
  embed = discord.Embed(title="test", description="testing")
  await ctx.send(embed=embed, view=button)
obsidian hill
#

me?

quick gust
#

nope, you need to add the button to a view like u were doing before

limpid apex
#

I see

brazen raft
obsidian hill
#

nah I didnt name anything discord

brazen raft
#

I was about to ask what do you work with

limpid apex
obsidian hill
#

yes

limpid apex
#

hm

obsidian hill
#

ill redo it

brazen raft
limpid apex
#

This line worked 1st try for me:

bot = commands.Bot(command_prefix='-', intents=discord.Intents.all())
obsidian hill
#

I just had to reinstall py ima make sure discords installed

brazen raft
#

Better uninstall whatever discord is and install discord.py

obsidian hill
#

Ok I installed both and it worked

limpid apex
#

πŸ‘

quick gust
obsidian hill
#

In the cmd here how could I call a function? if message.content.startswith('$hello'): await message.channel.send('Hello!')

quick gust
#

!pypi discord

unkempt canyonBOT
obsidian hill
#

would I need to keep the await or just main()

hushed galleon
obsidian hill
hushed galleon
#

in other words, the difference is: ```py
def my_normal_func(): ...
async def my_async_func(): ...

@bot.event
async def on_message(message):
my_normal_func()
await my_async_func()```

limpid apex
#

would this work?

@bot.command(name="buttontest")
async def buttontest(ctx):
  button = MyButton()
  view = discord.ui.View()
  embed = discord.Embed(title="Button Testing", description="This is a test")
  view.add_item(item=button)
  await ctx.send(embed=embed, view=view)
quick gust
#

Probably, show your MyButton class as well

limpid apex
#

Kk! Thank you for the help

dusk dagger
obsidian hill
#

This is my function from main.py but when this is called I need to send a dm to the user who ran the command in bot.py, how can I do this?
make_final_video(number_of_comments, length, reddit_object, bg_config)

dusk dagger
obsidian hill
#

The function is in main.py, I just dont know how I can get the user ID used in the function main.py

#

whats the best way to do that?

#

the main() function starts the video generation then the make_final_video(number_of_comments, length, reddit_object, bg_config) function ends it

sick birch
#

your functions should have one responsibility, as a matter of good design principle

#

one would not expect a function named "make_final_video` to send a discord DM

obsidian hill
#

main just generates everything from the config then the other function starts the generation

#

once the generation is finished I need to dm the user the result

limpid apex
#

If I were to use a ephemeral to message a user thats not the command user, is that possible?

quick gust
#

Nope

limpid apex
#

dang ity

#

is there any way to send a 1-sided message to a user?

#

other than DMs

dusk dagger
#

no

limpid apex
#

dang. alr

viscid hornet
#

thats as close to your goal as i can think of

limpid apex
#

I want it to be forced tbh

#

as a joke lol

#

I settled for this

#

XD

#

just DMs them, which is somewhat more annoying

limpid apex
#

anyone know how I would use a website (in html) to send a value to a discordpy bot

viscid hornet
viscid hornet
#

and you'd probably need a way to start something with your db

#

or occasionally loop and check the db

limpid apex
#

kk

obsidian hill
#

How can I create a db to make a currency ?

#

And how do I check it, like if currency >= 1 ...
Idk python πŸ˜‚

viscid hornet
#

i dont think >= even works

obsidian hill
obsidian hill
viscid hornet
#

!e py x = 5 if x >= 3: print("yes")

unkempt canyonBOT
#

@viscid hornet :white_check_mark: Your 3.12 eval job has completed with return code 0.

yes
viscid hornet
#

oh it does

obsidian hill
#

so how would I make a variable for that assigned to each user id?

#

idk if a variable or a db would be best

#

Im assuming a ram variable wouldnt be good since those clear on restart

viscid hornet
#

thats pretty easy

obsidian hill
#

I just need a way to give, store, and take a currency from people

viscid hornet
obsidian hill
#

Nah I dont need a wallet and bank just need tokens

viscid hornet
#

make user_id either a PRIMARY KEY or a UNIQUE integer

viscid hornet
obsidian hill
#

yes store as in save it

viscid hornet
#

ohh okk

obsidian hill
#

Yea I just need to know how to add remove and save currency

viscid hornet
obsidian hill
#

No not really

viscid hornet
#

the basics are fine

obsidian hill
#

what?

viscid hornet
#

because i use discord and i code

#

so put two and two together: discord bots

viscid hornet
viscid hornet
#

its knowing how to use and work with it thats by far more important

viscid hornet
obsidian hill
#

I tried sql once for a website and gave up

viscid hornet
#

yes

#

some dbs like postgres can work online

viscid hornet
obsidian hill
#

For the collums just user id and token count right?

viscid hornet
obsidian hill
#

I see here CREATE TABLE movies ( id INTEGER PRIMARY KEY, title TEXT, director TEXT, year INTEGER, length_minutes INTEGER ); when should I run this code tho?

#

make a seperate file and run it once? Run it on bot startup?

viscid hornet
#

im guessing you use sqlite?

obsidian hill
#

idfk

obsidian hill
#

so id say prob not

viscid hornet
#

❌

viscid hornet
obsidian hill
#

I dont use a db Im trynna create one rn πŸ˜‚

viscid hornet
#

get sqlite if you want something easy and small.
get postgres if you have a relatively big project or something.
fuck the rest of them

obsidian hill
#

Alr, so how does one "get" sqlite

#

docs?

dusk dagger
viscid hornet
#

yes

viscid hornet
viscid hornet
dusk dagger
obsidian hill
viscid hornet
#

!d sqlite3

unkempt canyonBOT
#

Source code: Lib/sqlite3/

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

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

This document includes four main sections:

viscid hornet
#

let them learn sqlite first and then they can move onto asqlite

#

one step after the other, otherwise they'll fall over shrug

obsidian hill
#

So pip install sqlite3 ?

viscid hornet
obsidian hill
#

alr

#

I tried pip install sqlite but aint work so ig that why πŸ˜‚

#
ERROR: No matching distribution found for sqlite3```
viscid hornet
obsidian hill
#

Python 3.10 could be reason

viscid hornet
#

oh wait its pip install sqlite

#

nvm

obsidian hill
#

you aint gonna believe what Im boutta say

#
ERROR: No matching distribution found for sqlite
WARNING: You are using pip version 21.2.3; however, version 24.0 is available.
You should consider upgrading via the 'C:\Program Files\Python310\python.exe -m pip install --upgrade pip' command.```
viscid hornet
#

wait wtf

obsidian hill
#

Im using python 3.10 and aint upgrading 😭

viscid hornet
#

apparently its in the stdlib whatpepe2

viscid hornet
#
import sqlite3```
#

lmk if it comes up with missing module errors

obsidian hill
#

wouldnt that upgrade python?

viscid hornet
#

i have updated pip and it has the same error

viscid hornet
obsidian hill
#

what am I running tho?

viscid hornet
obsidian hill
#

I dont got any code to run

viscid hornet
obsidian hill
#

I got this CREATE TABLE movies ( id INTEGER PRIMARY KEY, title TEXT, director TEXT, year INTEGER, length_minutes INTEGER ); but thats not python

obsidian hill
viscid hornet
viscid hornet
obsidian hill
#

nah it worked

viscid hornet
obsidian hill
#

I ran it and outputted nothin so I assume it did

viscid hornet
#

!d sqlite3.connect

unkempt canyonBOT
#
sqlite3.connect(database, timeout=5.0, detect_types=0, isolation_level='DEFERRED', check_same_thread=True, factory=sqlite3.Connection, cached_statements=128, uri=False, *, ...)```
Open a connection to an SQLite database.
obsidian hill
#

well

#

actually

viscid hornet
obsidian hill
#

idk what this meanshttps://file.coffee/u/WjIMZlRVW9GpCDP5HQpm4.png

viscid hornet
obsidian hill
#

ah alr

obsidian hill
#

I made the tokens.sql file

viscid hornet
#

accessing a module and importing it are two different things

viscid hornet
obsidian hill
#

would this be easier for you to help to do over vc?

obsidian hill
viscid hornet
#
import sqlite3
conn = sqlite3.connect('whatever.db') # this makes your connection

conn.execute("whatever SQL statement") # this executes your SQL

conn.commit() # this saves your changes```
viscid hornet
obsidian hill
viscid hornet
#

stick to here

obsidian hill
#

alr

#

wait should I be making a sql file or a .db file??

viscid hornet
viscid hornet
obsidian hill
#

3 errors

obsidian hill
limpid apex
slate swan
#

isnt sql a language and sqlite a software?

limpid apex
# unkempt canyon

cursor.execute(
    "CREATE TABLE IF NOT EXISTS data (user_id INTEGER, coins INTEGER)")
connection.commit()

This will work too

limpid apex
slate swan
#

pretty sure sqlite was a software for database management

#

I dunno pithink

obsidian hill
limpid apex
#

Try this:


connection = sqlite3.connect("database2.sqlite")
print(connection.total_changes)
cursor = connection.cursor()

cursor.execute(
    "CREATE TABLE IF NOT EXISTS data (user_id INTEGER, coins INTEGER)")
connection.commit()
#

U needa define cursor

viscid hornet
limpid apex
#

This works just fine lol

viscid hornet
obsidian hill
limpid apex
limpid apex
viscid hornet
limpid apex
#

Thats prob why lol

obsidian hill
#

Alr. now how to I add things to it? I needa import userid and tokens

viscid hornet
limpid apex
#

like how to use bot commands, like !help

obsidian hill
viscid hornet
limpid apex
#

Yea

viscid hornet
#

nope

limpid apex
#

If the prefix is "!", then doing !help would trigger the help command

viscid hornet
#

!help ⬅️ always has a prefix

obsidian hill
slate swan
#

Prefix here is just something that you will need to put before the command name for it to execute

#

in this case !command_name

viscid hornet
limpid apex
#

@wide plaza If for example you have "-" as the prefix, then -help would be the command

#

instead of !help

#

yes, although / is a slash command

slate swan
#

without nothing, it should work, ? and ! aswell

limpid apex
#

yes

obsidian hill
limpid apex
#

Although, nothing is quite annoying to work with

slate swan
#

/ should work probably too but there are slash commands for that and im unsure if something could error because of that

obsidian hill
#

yea

#

I just gotta import data to the userid and tokens now

slate swan
#

but you could try it

limpid apex
#

creating one is:

cursor.execute("CREATE TABLE IF NOT EXSISTS <name> (<var> <type>)
#

true

#

For an embed

obsidian hill
limpid apex
#

No, that you customize in dev portal

viscid hornet
obsidian hill
slate swan
obsidian hill
obsidian hill
limpid apex
viscid hornet
slate swan
#

most of the stuff are still related to sql and databases

viscid hornet
#

little bobby tables will explain why

obsidian hill
viscid hornet
slate swan
obsidian hill
#

ohh those thingys

viscid hornet
#

you didnt define description with anything

#

and thats not an embed description

obsidian hill
#

so like cursor.execute(f"INSERT INTO data WHERE user_id = userid") ?

viscid hornet
#

and please for the love of god, dont call your .Bot client 😭

obsidian hill
#

damn

slate swan
viscid hornet
obsidian hill
#

ye

slate swan
#

you would most likely go for the second one

slate swan
#

also more functionality

dusk dagger
#

It also inherits Client so no reason not to use it

slate swan
#

yep

#

yeah you need to import commands from d.py's extensions

from discord.ext import commands
#

whoopsies

#

!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) and as a result anything that you can do with a [`discord.Client`](https://discordpy.readthedocs.io/en/latest/api.html#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) to provide the functionality to manage commands.

Unlike [`discord.Client`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Client), this class does not require manually setting a [`CommandTree`](https://discordpy.readthedocs.io/en/latest/interactions/api.html#discord.app_commands.CommandTree) and is automatically set upon instantiating the class.

async with x Asynchronously initialises the bot and automatically cleans up.

New in version 2.0.
slate swan
#

yep

dusk dagger
#

the description is just an optional text you can put on the default help command

#

nah it’s just a general description that you can show on the default help command

slate swan
#

Yeah those are intents

sick birch
#

sort of

slate swan
#

I would just describe intents as stuff that your bot can see/do if something is enabled

#

you need to pass your intents as an keyword argument to the Bot class, also yeah thats how you set intents, for example

intents = discord.Intents()
intents.emojis = True
#

it means that the intents defined by you should be passed to your Bot class as an keyword argument intents

obsidian hill
#

Ok Ima come back to my economy system later, how do I add a / command?

#

I dont think thats how that works

#

also how do you do a prefix var is it like if message.content.startswith(command_prefix + 'test'): ?

#

what docs u reading?

viscid hornet
#

whys this mf reading the intents docs 😭

#

you're just controlling what you want your bot to be checking

#

ngl, .typing i havent seen

#

!d discord.Intents.typing

unkempt canyonBOT
#

Whether guild and direct message typing related events are enabled.

This is a shortcut to set or get both guild_typing and dm_typing.

This corresponds to the following events:

β€’ on_typing() (both guilds and DMs)

This does not correspond to any attributes or classes in the library in terms of cache.

viscid hornet
#

i mean, there you go

#

you can customise it further

#

those are optional ones

obsidian hill
#

so how do I import the function main() from main.py so I can call it in bot.py?

#

import main from main?

#

wait no

#

from main import main maybe?

#

nope

#

it didnt work

#

from ..main import main gave this Traceback (most recent call last): File "C:\Users\liama\Downloads\folder\code\bot\bot.py", line 2, in <module> from ..main import main ImportError: attempted relative import with no known parent package

#

the bot is in bot/main.py and im importing from ../main.py

#

so I need the 2 dots since importing from outside the bot folder

#

My files are like this

β”‚
β”œβ”€β”€ main.py
└── bot/
    └── bot.py
#

SyntaxError: (unicode error) 'unicodeescape' codec can't decode bytes in position 2-3: truncated \UXXXXXXXX escape wtf

viscid hornet
#

last two aren’t necessarily related

obsidian hill
#

from ..main import main

viscid hornet
#

yeah pretty much

obsidian hill
#
    from ..main import main
ImportError: attempted relative import with no known parent package```