add command issue
This commit is contained in:
parent
fcfc1c8b9b
commit
679515ca84
1 changed files with 31 additions and 0 deletions
|
@ -9,6 +9,7 @@ import requests
|
||||||
import aiocron
|
import aiocron
|
||||||
import asyncio
|
import asyncio
|
||||||
import giphy_client
|
import giphy_client
|
||||||
|
import gitlab
|
||||||
|
|
||||||
from time import sleep
|
from time import sleep
|
||||||
from discord.ext import tasks, commands
|
from discord.ext import tasks, commands
|
||||||
|
@ -131,6 +132,36 @@ class Mybot(commands.Cog):
|
||||||
else:
|
else:
|
||||||
await ctx.channel.send(random.choice(slap_multiple) % user)
|
await ctx.channel.send(random.choice(slap_multiple) % user)
|
||||||
|
|
||||||
|
@commands.command(help="Interrogation issues")
|
||||||
|
async def issue(self, ctx, *args):
|
||||||
|
if args:
|
||||||
|
args = list(args)
|
||||||
|
gl = gitlab.Gitlab('https://git.0w.tf/', private_token='VHLsCQTcjF3oxujqFRYz')
|
||||||
|
gl.auth()
|
||||||
|
if args[0] == 'list':
|
||||||
|
projects = gl.projects.list(search='Kabot')[0]
|
||||||
|
await ctx.channel.send(projects.name)
|
||||||
|
issues = projects.issues.list()
|
||||||
|
for issue in issues:
|
||||||
|
if "closed" == issue.state:
|
||||||
|
pass
|
||||||
|
else:
|
||||||
|
await ctx.channel.send('Issue: %s' % issue.title)
|
||||||
|
elif args[0] == 'search':
|
||||||
|
query = ''.join(args[1:])
|
||||||
|
find_issues = gl.search("issues", query)
|
||||||
|
for issue in find_issues:
|
||||||
|
await ctx.channel.send("#" + str(issue['id']) + ": " + issue['title'] + '\n' + issue['web_url'])
|
||||||
|
elif args[0] == 'add':
|
||||||
|
title = ' '.join(args[1:])
|
||||||
|
projects = gl.projects.list()
|
||||||
|
for project in projects:
|
||||||
|
if "Kabot" == project.name:
|
||||||
|
issue = project.issues.create({'title': title})
|
||||||
|
await ctx.channel.send(issue.web_url)
|
||||||
|
else:
|
||||||
|
await ctx.channel.send('unknown command')
|
||||||
|
|
||||||
@commands.command(help="optionnal args : [livre] [character]")
|
@commands.command(help="optionnal args : [livre] [character]")
|
||||||
async def kaamelott(self, ctx, *args):
|
async def kaamelott(self, ctx, *args):
|
||||||
response = None
|
response = None
|
||||||
|
|
Loading…
Reference in a new issue