Modified git to use correct utils
This commit is contained in:
parent
319943e1c4
commit
e37e0e3a72
@ -30,7 +30,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|||||||
import discord
|
import discord
|
||||||
from discord.ext import commands
|
from discord.ext import commands
|
||||||
import logging
|
import logging
|
||||||
from .imports.utils import paginate, run_command
|
from ..shared_libs.utils import paginate, run_command
|
||||||
import asyncio
|
import asyncio
|
||||||
|
|
||||||
git_log = logging.getLogger('git')
|
git_log = logging.getLogger('git')
|
||||||
@ -53,16 +53,19 @@ class Git:
|
|||||||
title=f'Git Pull',
|
title=f'Git Pull',
|
||||||
color=self.bot.embed_color)
|
color=self.bot.embed_color)
|
||||||
em.set_thumbnail(url=f'{ctx.guild.me.avatar_url}')
|
em.set_thumbnail(url=f'{ctx.guild.me.avatar_url}')
|
||||||
result = await asyncio.wait_for(self.bot.loop.create_task(run_command('git fetch --all')), 120) + '\n'
|
|
||||||
result += await asyncio.wait_for(self.bot.loop.create_task(run_command('git reset --hard '
|
result = await asyncio.wait_for(self.bot.loop.create_task(
|
||||||
'origin/$(git '
|
run_command('git fetch --all')), 120) + '\n'
|
||||||
'rev-parse --symbolic-full-name '
|
result += await asyncio.wait_for(self.bot.loop.create_task(
|
||||||
'--abbrev-ref HEAD)')), 120) + '\n\n'
|
run_command('git reset --hard origin/$(git rev-parse '
|
||||||
result += await asyncio.wait_for(self.bot.loop.create_task(run_command('git show --stat | '
|
'--symbolic-full-name --abbrev-ref HEAD)')),
|
||||||
'sed "s/.*@.*[.].*/ /g"')), 10)
|
120) + '\n\n'
|
||||||
|
result += await asyncio.wait_for(self.bot.loop.create_task(
|
||||||
|
run_command('git show --stat | sed "s/.*@.*[.].*/ /g"')), 10)
|
||||||
|
|
||||||
results = paginate(result, maxlen=1014)
|
results = paginate(result, maxlen=1014)
|
||||||
for page in results[:5]:
|
for page in results[:5]:
|
||||||
em.add_field(name='', value=f'{page}')
|
em.add_field(name='\uFFF0', value=f'{page}')
|
||||||
await ctx.send(embed=em)
|
await ctx.send(embed=em)
|
||||||
|
|
||||||
@git.command()
|
@git.command()
|
||||||
@ -72,12 +75,13 @@ class Git:
|
|||||||
title=f'Git Pull',
|
title=f'Git Pull',
|
||||||
color=self.bot.embed_color)
|
color=self.bot.embed_color)
|
||||||
em.set_thumbnail(url=f'{ctx.guild.me.avatar_url}')
|
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)
|
result = await asyncio.wait_for(self.bot.loop.create_task(
|
||||||
|
run_command('git status')), 10)
|
||||||
results = paginate(result, maxlen=1014)
|
results = paginate(result, maxlen=1014)
|
||||||
for page in results[:5]:
|
for page in results[:5]:
|
||||||
em.add_field(name='', value=f'{page}')
|
em.add_field(name='\uFFF0', value=f'{page}')
|
||||||
await ctx.send(embed=em)
|
await ctx.send(embed=em)
|
||||||
|
|
||||||
|
|
||||||
def setup(bot):
|
def setup(bot):
|
||||||
bot.add_cog(Git(bot))
|
bot.add_cog(Git(bot))
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user