summaryrefslogtreecommitdiff
path: root/cogs/git.py
blob: 191ca6b46955f4810e3da7c2af4c1744183b60db (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
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]")