Bot now checks for youtrack issue id's and sends a link the the issue in
message channel
This commit is contained in:
parent
a124119353
commit
7d11e22c6d
28
scr/Modules/TMC/ParseForIssues.py
Normal file
28
scr/Modules/TMC/ParseForIssues.py
Normal file
@ -0,0 +1,28 @@
|
||||
import asyncio
|
||||
import math
|
||||
from datetime import datetime, timedelta
|
||||
import re
|
||||
import discord
|
||||
import pymysql
|
||||
from discord.ext import commands
|
||||
|
||||
|
||||
class ParseForIssues(commands.Cog):
|
||||
def __init__(self, client):
|
||||
self.client = client
|
||||
|
||||
|
||||
@commands.Cog.listener()
|
||||
async def on_message(self, message):
|
||||
if message.author.id == 533427166193385494:
|
||||
return
|
||||
content = message.content.lower()
|
||||
matches = re.findall("ttg-[0-9]+",content)
|
||||
for match in matches:
|
||||
await message.channel.send("https://youtrack.themissingcrowbar.com:8942/issue/"+match)
|
||||
|
||||
|
||||
|
||||
|
||||
def setup(client):
|
||||
client.add_cog(ParseForIssues(client))
|
@ -4,7 +4,7 @@ from discord.ext.commands import Bot
|
||||
token = open("../token.txt")
|
||||
|
||||
cogs = ["Modules.TMC.autoReply.Join", "Modules.TMC.autoReply.Leave",
|
||||
"Modules.TMC.McRoll"]
|
||||
"Modules.TMC.McRoll", "Modules.TMC.ParseForIssues"]
|
||||
|
||||
prefix = 'o!'
|
||||
intents = discord.Intents().all()
|
||||
|
Loading…
x
Reference in New Issue
Block a user