Update database bot.py

This commit is contained in:
insert-usernamehere 2021-01-27 12:16:39 -05:00 committed by GitHub
parent 28d4cf4f84
commit e99ceb015f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -24,6 +24,7 @@ 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.send("adding to database please wait")
try:
await ctx.message.attachments[0].save("newcharacter.zip") await ctx.message.attachments[0].save("newcharacter.zip")
zf = ZipFile('newcharacter.zip', 'r') zf = ZipFile('newcharacter.zip', 'r')
@ -39,11 +40,14 @@ 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")
except BaseException:
await ctx.send("something went wrong! this probably means you didn't attach a file or discord api is broken")
@client.command() @client.command()
async def addsound(ctx): async def addsound(ctx):
await ctx.send("adding to database please wait") await ctx.send("adding to database please wait")
try:
await ctx.message.attachments[0].save("newsound.zip") await ctx.message.attachments[0].save("newsound.zip")
zf = ZipFile('newsound.zip', 'r') zf = ZipFile('newsound.zip', 'r')
@ -59,6 +63,8 @@ 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")
except BaseException:
await ctx.send("something went wrong! this probably means you didn't attach a file or discord api is broken")
@client.command() @client.command()
async def setip(ctx): async def setip(ctx):
@ -70,12 +76,14 @@ async def setip(ctx):
@client.command() @client.command()
async def getchrasset(ctx): async def getchrasset(ctx):
weburl = ctx.message.content[13:] weburl = ctx.message.content[13:]
await ctx.send("http://fierce-push.auto.playit.gg:53368/singlecharacter/"+str(weburl)) betterweburl = weburl.replace(" ", "%20")
await ctx.send("http://fierce-push.auto.playit.gg:53368/singlecharacter/"+str(betterweburl))
@client.command() @client.command()
async def getsound(ctx): async def getsound(ctx):
sound = ctx.message.content[10:] sound = ctx.message.content[10:]
await ctx.send("http://fierce-push.auto.playit.gg:53368/singlesound/"+str(sound)) bettersound = sound.replace(" ", "%20")
await ctx.send("http://fierce-push.auto.playit.gg:53368/singlesound/"+str(bettersound))
@client.command() @client.command()
async def downloadcharacter(ctx): async def downloadcharacter(ctx):