.BANCHO. Compile tillerino regex only once

This commit is contained in:
Nyo 2016-05-20 18:53:09 +02:00
parent 7b89822e69
commit e483a92a2c
2 changed files with 6 additions and 8 deletions

View File

@ -6,15 +6,10 @@ from constants import exceptions
from helpers import userHelper
import time
from helpers import systemHelper
import re
import requests
import json
from constants import mods
from helpers import generalFunctions
import sys
import traceback
from helpers import consoleHelper
from constants import bcolors
"""
Commands callbacks
@ -370,8 +365,7 @@ def tillerinoNp(fro, chan, message):
return False
# Get beatmap id from URL
p = re.compile("^https?:\\/\\/osu\\.ppy\\.sh\\/b\\/(\\d*)")
beatmapID = p.search(beatmapURL).groups(0)[0]
beatmapID = fokabot.npRegex.search(beatmapURL).groups(0)[0]
# Update latest tillerino song for current token
token = glob.tokens.getTokenFromUsername(fro)

View File

@ -4,6 +4,10 @@ from objects import glob
from constants import actions
from constants import serverPackets
from constants import fokabotCommands
import re
# Tillerino np regex, compiled only once to increase performance
npRegex = re.compile("^https?:\\/\\/osu\\.ppy\\.sh\\/b\\/(\\d*)")
def connect():
"""Add FokaBot to connected users and send userpanel/stats packet to everyone"""