简体   繁体   中英

How do i create a economy bot using discord.py?

I tried creating a discord bot but i have failed alot of times, this is my most recent try...


import discord
from discord.ext.commands import Bot
from discord.ext import commands

print("This might take a few seconds")
print("Please wait...\n\n")

client = discord.Client()

bot = commands.Bot(command_prefix='/')

@client.event
async def on_ready():
    activity = discord.Game(name="test", type=3)
    await bot.change_presence(status=discord.Status.idle, activity=activity)
    print("Bot Online!\n")
    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('secret'):
        await message.channel.send('What is the "secret" you speak of?')
        if ctx.invoked_subcommand is None:
            await message.channel.send('Shh!', delete_after=5)

client.run('XXXXXXXXXXXXXXX')

I cant even get through the statues part. What im trying to do is a bot that has a economy (shop and bank). Can someone please help me

As @Joshua Nixon said you should use commands.Bot instead of discord.Client ( docs )

To store all the informations you can use json, sqlite or something like mongoDB as database

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM