Update database bot.py

This commit is contained in:
insert-usernamehere 2021-01-25 20:07:02 -05:00 committed by GitHub
parent 3294a41cb4
commit 9132b79ff7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -13,9 +13,9 @@ client = commands.Bot(command_prefix='.')
@client.command() @client.command()
async def addcharacter(ctx): async def addcharacter(ctx):
await ctx.send("adding to database please wait")
await ctx.message.attachments[0].save("newcharacter.zip") await ctx.message.attachments[0].save("newcharacter.zip")
await ctx.send("adding to database please wait")
zf = ZipFile('newcharacter.zip', 'r') zf = ZipFile('newcharacter.zip', 'r')
zf.extractall('public/singlecharacter') zf.extractall('public/singlecharacter')
zf.close() zf.close()
@ -29,11 +29,13 @@ async def addcharacter(ctx):
pass pass
shutil.make_archive('public/characters', 'zip', 'public/singlecharacter') shutil.make_archive('public/characters', 'zip', 'public/singlecharacter')
await ctx.send("added to database") await ctx.send("added to database")
@client.command()
async def addsound(ctx): async def addsound(ctx):
await ctx.send("adding to database please wait")
await ctx.message.attachments[0].save("newsound.zip") await ctx.message.attachments[0].save("newsound.zip")
await ctx.send("adding to database please wait")
zf = ZipFile('newsound.zip', 'r') zf = ZipFile('newsound.zip', 'r')
zf.extractall('public/singlesound') zf.extractall('public/singlesound')
zf.close() zf.close()
@ -47,5 +49,12 @@ async def addsound(ctx):
pass pass
shutil.make_archive('public/sounds', 'zip', 'public/singlesound') shutil.make_archive('public/sounds', 'zip', 'public/singlesound')
await ctx.send("added to database") await ctx.send("added to database")
@client.command()
async def setip(ctx):
ip = userInput = ctx.message.content[7:]
with open("public/serverlist.txt", "w+") as hisc:
hisc.write(str(ip)+":best bois courthouse")
await ctx.send("changed ip to "+str(ip))
client.run('botid') client.run('botid')