#๐Ÿ”’ Discord Bot

25 messages ยท Page 1 of 1 (latest)

sturdy nebula
#

Hello, I am trying to learn python and I know input etc. commands yet. I thought I could actually improve by creating a bot and I decided to do this, I would have a few requests from you:

  1. I want to host my bot, I have a server but I haven't written any code etc. yet, what should I do to make it look and work active for now?

  2. Resources for me to learn ๐Ÿ˜„

light chasmBOT
#

@sturdy nebula

Python help channel opened

Remember to:

  • Ask your Python question, not if you can ask or if there's an expert who can help.
  • Show a code sample as text (rather than a screenshot) and the error message, if you've got one.
  • Explain what you expect to happen and what actually happens.

:warning: Do not pip install anything that isn't related to your question, especially if asked to over DMs.

hardy tundra
#

You can start by learning basic python

sturdy nebula
hardy tundra
#

Variable, syntax, conditions, error handling...

#

Functions

#

I started learning python by making telegram bot, and watching open source GitHub repos.

spare obsidian
# sturdy nebula Hello, I am trying to learn python and I know input etc. commands yet. I thought...

Here is the base for a very simple discord bot. It will send a message saying "Hello" when you use the command !hello.
You will need to get your discord bot token from here: https://discord.com/developers/applications

import discord
from discord.ext import commands

# Replace 'YOUR_BOT_TOKEN' with your actual bot token
TOKEN = 'YOUR_BOT_TOKEN'

# Intents are required for the bot to function properly
intents = discord.Intents.default()
intents.message_content = True

# Create a bot instance with a command prefix of '!'
bot = commands.Bot(command_prefix='!', intents=intents)

@bot.event
async def on_ready():
    print(f'We have logged in as {bot.user}')

@bot.command(name='hello')
async def hello(ctx):
    await ctx.send('Hello!')

# Run the bot with the specified token
bot.run(TOKEN)
sturdy nebula
spare obsidian
sturdy nebula
# spare obsidian How are you trying to start the program?
import discord
from discord.ext import commands

# Replace 'YOUR_BOT_TOKEN' with your actual bot token
TOKEN = 'bots token'

# Intents are required for the bot to function properly
intents = discord.Intents.default()
intents.message_content = True

# Create a bot instance with a command prefix of '!'
bot = commands.Bot(command_prefix='!', intents=intents)

@bot.event
async def on_ready():
    print(f'We have logged in as {bot.user}')

@bot.command(name='hello')
async def hello(ctx):
    await ctx.send('Hello!')

# Run the bot with the specified token
bot.run(TOKEN)
sturdy nebula
spare obsidian
#

You will need to install the discord module

sturdy nebula
#

how

spare obsidian
#

In CMD, type "pip install discord"

sturdy nebula
#

no respond

#

๐Ÿ˜ฆ

spare obsidian
#

Let's see the error

sturdy nebula
sturdy nebula
light chasmBOT
#
Python help channel closed

This help channel has been closed and it's no longer possible to send messages here. If your question wasn't answered, 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.