Use whatever account that is in id 999 as bot

This commit is contained in:
Sunpy
2018-02-14 17:44:37 +01:00
parent 29db61fd12
commit 27a5f9c000
10 changed files with 30 additions and 27 deletions

View File

@@ -135,7 +135,7 @@ def kickAll(fro, chan, message):
def kick(fro, chan, message):
# Get parameters
target = message[0].lower()
if target == "fokabot":
if target == glob.BOT_NAME.lower():
return "Nope."
# Get target token and make sure is connected
@@ -153,7 +153,7 @@ def kick(fro, chan, message):
def fokabotReconnect(fro, chan, message):
# Check if fokabot is already connected
if glob.tokens.getTokenFromUserID(999) is not None:
return "Fokabot is already connected to Bancho"
return "{} is already connected to Bancho".format(glob.BOT_NAME)
# Fokabot is not connected, connect it
fokabot.connect()
@@ -602,7 +602,7 @@ def tillerinoLast(fro, chan, message):
rank = generalUtils.getRank(data["play_mode"], data["mods"], data["accuracy"],
data["300_count"], data["100_count"], data["50_count"], data["misses_count"])
ifPlayer = "{0} | ".format(fro) if chan != "FokaBot" else ""
ifPlayer = "{0} | ".format(fro) if chan != glob.BOT_NAME else ""
ifFc = " (FC)" if data["max_combo"] == data["fc"] else " {0}x/{1}x".format(data["max_combo"], data["fc"])
beatmapLink = "[http://osu.ppy.sh/b/{1} {0}]".format(data["sn"], data["bid"])
@@ -720,7 +720,7 @@ def report(fro, chan, message):
target = chat.fixUsernameForBancho(target)
# Make sure the target is not foka
if target.lower() == "fokabot":
if target.lower() == glob.BOT_NAME.lower():
raise exceptions.invalidUserException()
# Make sure the user exists
@@ -744,10 +744,10 @@ def report(fro, chan, message):
adminMsg = "{user} has reported {target} for {reason} ({info})".format(user=fro, target=target, reason=reason, info=additionalInfo)
# Log report in #admin and on discord
chat.sendMessage("FokaBot", "#admin", adminMsg)
chat.sendMessage(glob.BOT_NAME, "#admin", adminMsg)
log.warning(adminMsg, discord="cm")
except exceptions.invalidUserException:
msg = "Hello, FokaBot here! You can't report me. I won't forget what you've tried to do. Watch out."
msg = "Hello, {} here! You can't report me. I won't forget what you've tried to do. Watch out.".format(glob.BOT_NAME)
except exceptions.invalidArgumentsException:
msg = "Invalid report command syntax. To report an user, click on it and select 'Report user'."
except exceptions.userNotFoundException:
@@ -761,7 +761,7 @@ def report(fro, chan, message):
token = glob.tokens.getTokenFromUsername(fro)
if token is not None:
if token.irc:
chat.sendMessage("FokaBot", fro, msg)
chat.sendMessage(glob.BOT_NAME, fro, msg)
else:
token.enqueue(serverPackets.notification(msg))
return False
@@ -853,10 +853,10 @@ def multiplayer(fro, chan, message):
matchID = getMatchIDFromChannel(chan)
success = glob.matches.matches[matchID].start()
if not success:
chat.sendMessage("FokaBot", chan, "Couldn't start match. Make sure there are enough players and "
chat.sendMessage(glob.BOT_NAME, chan, "Couldn't start match. Make sure there are enough players and "
"teams are valid. The match has been unlocked.")
else:
chat.sendMessage("FokaBot", chan, "Have fun!")
chat.sendMessage(glob.BOT_NAME, chan, "Have fun!")
def _decreaseTimer(t):
@@ -864,7 +864,7 @@ def multiplayer(fro, chan, message):
_start()
else:
if t % 10 == 0 or t <= 5:
chat.sendMessage("FokaBot", chan, "Match starts in {} seconds.".format(t))
chat.sendMessage(glob.BOT_NAME, chan, "Match starts in {} seconds.".format(t))
threading.Timer(1.00, _decreaseTimer, [t - 1]).start()
if len(message) < 2 or not message[1].isdigit():
@@ -909,8 +909,8 @@ def multiplayer(fro, chan, message):
raise exceptions.invalidUserException("That user is not connected to bancho right now.")
_match = glob.matches.matches[getMatchIDFromChannel(chan)]
_match.invite(999, userID)
token.enqueue(serverPackets.notification("Please accept the invite you've just received from FokaBot to "
"enter your tourney match."))
token.enqueue(serverPackets.notification("Please accept the invite you've just received from {} to "
"enter your tourney match.".format(glob.BOT_NAME)))
return "An invite to this match has been sent to {}".format(username)
def mpMap():
@@ -1154,7 +1154,7 @@ commands = [
"callback": report
}, {
"trigger": "!help",
"response": "Click (here)[https://ripple.moe/index.php?p=16&id=4] for FokaBot's full command list"
"response": "Click (here)[https://ripple.moe/index.php?p=16&id=4] for {}'s full command list".format(glob.BOT_NAME)
}, #{
#"trigger": "!ask",
#"syntax": "<question>",
@@ -1187,7 +1187,7 @@ commands = [
"privileges": privileges.ADMIN_KICK_USERS,
"callback": kick
}, {
"trigger": "!fokabot reconnect",
"trigger": "!{} reconnect".format(glob.BOT_NAME.lower()),
"privileges": privileges.ADMIN_MANAGE_SERVERS,
"callback": fokabotReconnect
}, {

View File

@@ -94,7 +94,7 @@ def userPanel(userID, force = False):
# Get username color according to rank
# Only admins and normal users are currently supported
userRank = 0
if username == "FokaBot":
if username == glob.BOT_NAME:
userRank |= userRanks.MOD
elif userUtils.isInPrivilegeGroup(userID, "developer"):
userRank |= userRanks.ADMIN