#๐Ÿ”’ dc-bot help

28 messages ยท Page 1 of 1 (latest)

stable jackal
#

its for a dc bot btw

past lintel
#

"file" or folder?

#

a virtual environment is a folder containing an isolated Python installation and its dependencies - they are created to separate your project's dependencies from your global environment

PyCharm creates it automatically for you and manages it, but regardless of which IDE or package manager you are using it's recommended to use a venv to prevent version conflicts

#

you should just let it create then ignore it and let PyCharm manage it for you

regardless, you should post the actual errors - odds are the problems is either in your script or the versions you're using of things you depend on

stable jackal
#
import os

import discord

intents = discord.Intents.default()
intents.members = True
intents.messages = True

client = discord.Client()


@client.event
async def on_ready():
    print('We have logged in as {0.user}'.format(client))

@client.event
async def on_message(message):
    if message.author == client.user:
        return
    if message.content.startswith('!hello'):
        await message.channel.send('Hello!')

client.run(os.getenv('TOKEN'))```
#

whats wrong here?

nimble raft
gray fulcrumBOT
#

Read key-value pairs from a .env file and set them as environment variables

Released on <t:1742897696:D>.

stable jackal
#

dc-bot help

stable jackal
nimble raft
stable jackal
#

ohh ty

stable jackal
# nimble raft read the summary in the embed

it says this now: Traceback (most recent call last):
File "C:\Users\juli2\PycharmProjects\PythonProject\main.py", line 11, in <module>
client = discord.Client(intents)
TypeError: Client.init() takes 1 positional argument but 2 were given

gray fulcrumBOT
#

class discord.Client(*, intents, **options)```
Represents a client connection that connects to Discord. This class is used to interact with the Discord WebSocket and API.

async with x
:   Asynchronously initialises the client and automatically cleans up.

New in version 2.0...
nimble raft
#

intents = intents

stable jackal
#

ty it works now

stable jackal
nimble raft
fiery cloak
#

I very strongly recommended you looking into slash commands (app commands). There is no point to learn message based commands first at this point in time

stable jackal
#

I will do both things! Thank you all!!

#

how do delete this

fiery cloak
#

You can close it with !close (funnily enough this server has not updated to use slash commands yet)

stable jackal
#

ok lol

#

!close

gray fulcrumBOT
#
Python help channel closed with !close

This help channel has been closed. Feel free to create a new post in #1035199133436354600. To maximize your chances of getting a response, check out this guide on asking good questions.