2021-01-25 21:52:36 +00:00
|
|
|
import discord
|
|
|
|
from discord.ext import commands
|
|
|
|
from time import sleep
|
|
|
|
import os
|
|
|
|
import datetime
|
|
|
|
import wget
|
|
|
|
from zipfile import ZipFile
|
|
|
|
import shutil
|
|
|
|
|
|
|
|
|
|
|
|
client = commands.Bot(command_prefix='.')
|
|
|
|
|
|
|
|
|
|
|
|
@client.command()
|
2021-01-25 21:59:04 +00:00
|
|
|
async def addcharacter(ctx):
|
2021-01-25 21:52:36 +00:00
|
|
|
await ctx.message.attachments[0].save("newcharacter.zip")
|
|
|
|
|
|
|
|
await ctx.send("adding to database please wait")
|
|
|
|
zf = ZipFile('newcharacter.zip', 'r')
|
2021-01-25 21:59:04 +00:00
|
|
|
zf.extractall('public/singlecharacter')
|
2021-01-25 21:52:36 +00:00
|
|
|
zf.close()
|
2021-01-25 21:59:04 +00:00
|
|
|
if os.path.exists("newcharacter.zip"):
|
2021-01-25 22:00:02 +00:00
|
|
|
os.remove("newcharacter.zip")
|
2021-01-25 21:59:04 +00:00
|
|
|
else:
|
|
|
|
pass
|
|
|
|
if os.path.exists("public/characters.zip"):
|
2021-01-25 22:00:02 +00:00
|
|
|
os.remove("public/characters.zip")
|
2021-01-25 21:59:04 +00:00
|
|
|
else:
|
|
|
|
pass
|
|
|
|
shutil.make_archive('public/characters', 'zip', 'public/singlecharacter')
|
|
|
|
await ctx.send("added to database")
|
|
|
|
|
|
|
|
async def addsound(ctx):
|
|
|
|
await ctx.message.attachments[0].save("newsound.zip")
|
|
|
|
|
|
|
|
await ctx.send("adding to database please wait")
|
|
|
|
zf = ZipFile('newsound.zip', 'r')
|
|
|
|
zf.extractall('public/singlesound')
|
|
|
|
zf.close()
|
|
|
|
if os.path.exists("newsound.zip"):
|
2021-01-25 22:00:02 +00:00
|
|
|
os.remove("newsound.zip")
|
2021-01-25 21:59:04 +00:00
|
|
|
else:
|
|
|
|
pass
|
|
|
|
if os.path.exists("public/sounds.zip"):
|
2021-01-25 22:00:02 +00:00
|
|
|
os.remove("public/sounds.zip")
|
2021-01-25 21:59:04 +00:00
|
|
|
else:
|
|
|
|
pass
|
|
|
|
shutil.make_archive('public/sounds', 'zip', 'public/singlesound')
|
2021-01-25 21:52:36 +00:00
|
|
|
await ctx.send("added to database")
|
|
|
|
|
2021-01-25 21:54:12 +00:00
|
|
|
client.run('botid')
|