Can anyone tell me why the code is not working , i just used chat gpt , i have 0 idea about coding

import discord
from discord.ext import commands
import random

# Config class for constants
class Config:
    BOT_TOKEN = 'YOUR_BOT_TOKEN'

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

bot = commands.Bot(command_prefix='!', intents=intents)


@bot.event
async def on_ready():
    print(f'Logged in as {bot.user.name}')

@bot.event
async def on_member_join(member):
    welcome_message = f'Hope you brought Jalebi for me, {member.mention}! If you need help, reply with "i need help".'
    await member.send(welcome_message)

@bot.event
async def on_message(message):
    if message.author == bot.user:
        return

    if message.content.lower() == 'i need help':
        responses = [
            'Contact mods πŸ›‘οΈ',
            'I am just a bot πŸ™ƒ',
            'I am a busy person 😎, contact any mod or I will kidnap you!'
        ]
        response = random.choice(responses)
        await message.channel.send(response)

    # Responses to members saying 'hello'
    if 'hello' in message.content.lower() and message.author != bot.user:
        hello_responses = [
            'I am eating Jalebi right now, can we talk later?',
            'Hey, how was your day?',
            'Hello πŸ˜”, I am sad right now.',
            'I see, you are interested in me 😏, I am just a bot.',
            'You wanna chat with me?',
            'Hello, I am gonna ignore you because my mom is angry at me right now 😑',
            'Do you watch anime?',
            '................',
            'Finally, someone wants to talk to me.'
        ]
        hello_response = random.choice(hello_responses)
        await message.channel.send(hello_response)

        # Check if member responds to the specific "mom is angry" message
        if hello_response == 'Hello, I am gonna ignore you because my mom is angry at me right now 😑' and message.reference:
            original_message = await message.channel.fetch_message(message.reference.message_id)
            if original_message.author == bot.user:
                await message.channel.send("Idk, I was just playing games with my brother and he broke my gaming console, so I beat him and now mom is angry at me. I will talk to you later.")

    # New feature: Bot response when member responds with '..........'
    if message.content.lower().strip() == '..........':
        await message.channel.send('..........')

    # New feature: Bot response when member responds to "Finally, someone wants to talk to me"
    if message.content.lower() == 'finally, someone wants to talk to me':
        await message.channel.send('Are you bored?')

    # New feature: Bot response when member pings bot and says 'yes i am bored'
    if bot.user.mentioned_in(message) and ('yes' in message.content.lower() or 'yah' in message.content.lower()):
        await message.channel.send('Me too sed')

    # New feature: Bot response when member pings bot and says 'no or nah i am not sad'
    if bot.user.mentioned_in(message) and ('no' in message.content.lower() or 'nah' in message.content.lower()):
        await message.channel.send('#$$***#*')

    # New feature: Bot response when member responds with 'no I am not interested'
    if message.content.lower() == 'no i am not interested':
        await message.channel.send('Cap, you are interested in me. 😏')

    # New feature: Bot response when member responds with 'yes I am not interested'
    if message.content.lower() == 'yes i am not interested':
        await message.channel.send('uwu , ❀️')

    # New feature: Bot response when member pings bot and asks about marriage or sleeping together
    if bot.user.mentioned_in(message) and ('marry me' in message.content.lower() or 'sleep with me' in message.content.lower()):
        await message.channel.send('I refuse 😑, don\'t talk to me')

    # New feature: Bot response when member responds to the marriage or sleep request
    if message.content.lower() == 'sike i was joking':
        await message.channel.send('Nice one! I was joking too. πŸ˜„')

    # New feature: Bot response when member pings and says 'thank u'
    if bot.user.mentioned_in(message) and 'thank u' in message.content.lower():
        await message.channel.send('My pleasure ☺️')

    # New feature: Bot response when member pings and uses abusive words
    if bot.user.mentioned_in(message) and any(word in message.content.lower() for word in ['abusive_word1', 'abusive_word2']):
        await message.channel.send('Sorry sir/mam.')

    # New feature: Bot response when member pings bot and asks for favorite anime
    if bot.user.mentioned_in(message) and 'favorite anime' in message.content.lower():
        await message.channel.send('I like a lot of animes, my favorites are AOT, HxH, One Piece, and many more.')

    # New feature: Bot response when member pings bot and asks for favorite manga
    if bot.user.mentioned_in(message) and 'favorite manga' in message.content.lower():
        await message.channel.send("I don't read manga that much, but my favorite mangas are Beserk, One Piece.")

    # New feature: Bot response when member pings bot and asks 'his name'
    if bot.user.mentioned_in(message) and 'his name' in message.content.lower():
        await message.channel.send('I am Jalebi, your personal assistant.')

    # New feature: Bot response when member pings bot and asks for 'your age'
    if bot.user.mentioned_in(message) and 'your age' in message.content.lower():
        await message.channel.send('I was created yesterday.')

    # New feature: Bot response when member pings bot and asks 'where u live'
    if bot.user.mentioned_in(message) and 'where u live' in message.content.lower():
        await message.channel.send('In your heart UWu.')

    # New feature: Bot response when member pings bot and says 'it was cringe'
    if bot.user.mentioned_in(message) and 'it was cringe' in message.content.lower():
        await message.channel.send('I know, my creator is more cringe.')

    # New feature: Bot response when member pings bot and says 'bye'
    if bot.user.mentioned_in(message) and 'bye' in message.content.lower():
        await message.channel.send('Cya, have a good day πŸ€—.')

    # New feature: Bot response when member pings bot and says things that have no programmed response
    if bot.user.mentioned_in(message):
        await message.channel.send("I don't know; I am still learning, so maybe next time I can answer that question")

Welcome to Ask!

For one thing, you should store this in a secret and import that.
https://docs.replit.com/programming-ide/workspace-features/secrets
Follow the simple steps in the doc above to set a secret. To use it, add import os to your imports at the top of your code and then replace 'YOUR_BOT_TOKEN' with os.getenv("MY_SECRET") (with MY_SECRET being the name of your secret (NOT the value, just the name).

While some users have been able to get by with this, I would highly recommend actually learning to code. There are many good websites that teach you how to code. W3Schools is an excellent choice. There are several topics on Ask about how to code. Also there is replit.com/learn and Replit’s 100 Days of Code.

8 Likes

I just want to second learning the code. Especially since this is python and would not be that difficult comparatively, it would be a good first project to get your hands dirty!

1 Like