add owner command to update text and data
from discord.ext import commands
+import classyjson as cj
import discord
import os
@@ -78,6 +79,21 @@ class Owner(commands.Cog):
await ctx.message.add_reaction(self.d.emojis.yes)
+ @commands.command(name='update')
+ @commands.is_owner()
+ async def update(self, ctx, thing):
+ if thing.lower() == 'data':
+ with open('data/data.json', 'r') as d:
+ self.d.update(cj.load(d))
+ elif thing.lower() == 'text':
+ with open('data/text.json', 'r') as t:
+ bot.langs.update(cj.load(t))
+ else:
+ await self.bot.send('Invalid, options are "data" or "text"')
+ return
+
+ await ctx.message.add_reaction(self.d.emojis.yes)
+
def setup(bot):
bot.add_cog(Owner(bot))
