from discord.ext import commands
import asyncio
import os
import random
import re
prefix = 'bz '
client = commands.Bot(command_prefix=prefix)
@client.event
async def on_ready():
print('Logged in as: ')
print(client.user.name)
print(client.user.id)
print('---------------')
await client.change_presence(activity=discord.Game(name='bz help'))
class DataCreate(commands.Cog):
def __int__(self, client):
self.client = client
async def createdatacash(self, member):
path = 'bal_' + member + '.txt'
print('createddatacash')
if not os.path.isfile(path):
file = open(path, 'w+')
file.write('0')
file.close()
self.data = True
async def writefile(self, member, inputthing):
path = 'bal_' + member + '.txt'
if not os.path.isfile(path):
await DataCreate.createdatacash(member)
file = open(path, 'w+')
file.write(str(inputthing))
self.data = True
class GetCash(commands.Cog):
def __init__(self, client):
self.client = client
async def view_cash(self, member):
path = 'bal_' + member + '.txt'
if not os.path.isfile(path):
datacreate = DataCreate
await datacreate.createdatacash(member)
file = open(path, 'r')
output= file.read()
file.close()
self.data = output
我的源代码在上面,我希望这就足够了
我得到了错误missing 1 required positional argument: 'amount'
此错误显示在:await cashmodify.addtobal(person, cash)
我一直在尝试为python 3.7制作一个带有discord重写的经济机器人,我决定这次让自己更容易将它们保留在类中,然后在需要时使用它们,但每当我在discord中运行命令时,它说我缺少一个称为数量的必需位置参数。我试过从字符串和整数切换输入,我回头看了看课程,它仍然无法工作。
我尝试过的另一件事是删除 commands.Cog,但这仍然不起作用。所以我很感激任何人能给我的帮助
回首忆惘然
相关分类