Bot now checks for youtrack issue id's and sends a link the the issue in

message channel
This commit is contained in:
Quentin 2021-01-20 16:05:36 -06:00
parent a124119353
commit 7d11e22c6d
2 changed files with 29 additions and 1 deletions

View 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))

View File

@ -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()