From 722f27a678e20d7993e7424d93973fc57bb35fb9 Mon Sep 17 00:00:00 2001 From: "Dusty.P" Date: Sat, 14 Apr 2018 02:06:28 -0800 Subject: [PATCH] Added git pull and git status (beta) --- exts/git.py | 44 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 exts/git.py diff --git a/exts/git.py b/exts/git.py new file mode 100644 index 0000000..a845bf9 --- /dev/null +++ b/exts/git.py @@ -0,0 +1,44 @@ +import discord +from discord.exts import commands +import os +from .imports.utils import paginate, run_command + +owner_id = 351794468870946827 +embed_color = discord.Colour.from_rgb(49,107,111) + +git_log = logging.getLogger('git') + +class Git(): + def __init__(self, bot): + self.bot = bot + + @commands.group(case_insensitive=True) + async def git(self, ctx): + '''Run help set for more info''' + pass + + @git.command() + @commands.is_owner() + async def pull(self, ctx): + em = discord.Embed( style='rich', + title=f'Git Pull', + color=embed_color) + em.set_thumbnail(url=f'{ctx.guild.me.avatar_url}') + result = await asyncio.wait_for(self.bot.loop.create_task(run_command(['git','pull'])),10) + em.add_field(name='Results:', value=f'```{result}```') + await ctx.send(embed=em) + + @git.command() + @commands.is_owner() + async def status(self, ctx): + em = discord.Embed( style='rich', + title=f'Git Pull', + color=embed_color) + em.set_thumbnail(url=f'{ctx.guild.me.avatar_url}') + result = await asyncio.wait_for(self.bot.loop.create_task(run_command(['git','status'])),10) + em.add_field(name='Results:', value=f'```{result}```') + await ctx.send(embed=em) + + +def setup(bot): + bot.add_cog(Git(bot))