From 52801b4de1d63cd01191acf7fcee137977140ec0 Mon Sep 17 00:00:00 2001 From: lexicade Date: Fri, 27 Jan 2023 21:06:30 +0000 Subject: Project init --- cogs/git.py | 56 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 cogs/git.py (limited to 'cogs/git.py') diff --git a/cogs/git.py b/cogs/git.py new file mode 100644 index 0000000..191ca6b --- /dev/null +++ b/cogs/git.py @@ -0,0 +1,56 @@ +from discord.ext import commands +import discord +import importlib +import utils +import git +import os +importlib.reload(utils) + + +class Git(commands.Cog): + def __init__(self, bot): + self.bot = bot + + @commands.group(pass_context=True, hidden=True, invoke_without_command=True) + async def git(self, ctx, *arg): + """GIT""" + # git.init(self.__path) + # my_repo = git.Repo('git_synthy') + # git.pull('-f', '-u', 'origin', 'master') + # + # git.clone(repo, 'ssh@github.com/blah/blah.git') + # + # git.commit('-m', message, '.gitmodules', self.ROLES) or git("commit", "-m", "Initial commit") + # + # git.push('origin', 'master') + # + # git.add(some_file, f=True) + # + # git('checkout', '-b', fix_branch) + # git('checkout', 'production') + + @git.command() + async def commit(self, ctx, *, arg): + cogs = [] + git_rep = git.Repo('git_synthy') + + # Add Synthy script to rep + git_rep.index.add("synthy.py") + + # Collect cogs + for file in os.listdir("./cogs/"): + if file.endswith(".py") and not file.startswith("__"): + git_rep.index.add(f"./cogs/{file}") + + # Commit + git_rep.index.commit(arg) + # await ctx.send(content=arg) + +def setup(bot): + print("INFO: Loading [Git]... ", end="") + bot.add_cog(Git(bot)) + print("Done!") + + +def teardown(bot): + print("INFO: Unloading [Git]") -- cgit v1.2.3