convert most botconfig.NICK usages to users.Bot.nick

This commit is contained in:
jacob1 2017-12-29 11:26:22 -05:00
parent b3687268c2
commit 15e0d9f503
4 changed files with 21 additions and 21 deletions

View File

@ -206,7 +206,7 @@ class VillagergameMode(GameMode):
pc = len(var.ALL_PLAYERS)
if (pc >= 8 and lpl <= 4) or lpl <= 2:
evt.data["winner"] = ""
evt.data["message"] = messages["villagergame_lose"].format(botconfig.CMD_CHAR, botconfig.NICK)
evt.data["message"] = messages["villagergame_lose"].format(botconfig.CMD_CHAR, users.Bot.nick)
else:
evt.data["winner"] = None
@ -255,7 +255,7 @@ class VillagergameMode(GameMode):
if not tgt:
tgt = random.choice(pl)
from src.roles import wolf
wolf.KILLS[botconfig.NICK] = [tgt.nick]
wolf.KILLS[users.Bot.nick] = [tgt.nick]
def on_retribution_kill(self, evt, var, victim, orig_target):
# There are no wolves for this totem to kill

View File

@ -4,7 +4,7 @@ import re
import botconfig
import src.settings as var
from src import proxy, debuglog
from src import proxy, debuglog, users
from src.events import Event
from src.messages import messages
@ -433,8 +433,8 @@ def get_victim(cli, nick, victim, in_chan, self_in_list=False, bot_in_list=False
pll = [x.lower() for x in pl]
if bot_in_list: # for villagergame
pl.append(botconfig.NICK)
pll.append(botconfig.NICK.lower())
pl.append(users.Bot.nick)
pll.append(users.Bot.nick.lower())
tempvictims = complete_match(victim.lower(), pll)
if len(tempvictims) != 1:

View File

@ -3,7 +3,7 @@ import re
import botconfig
import src.settings as var
from src import channels, db
from src import channels, db, users
from src.utilities import *
from src.decorators import cmd, COMMANDS
from src.events import Event
@ -146,7 +146,7 @@ def add_warning(cli, target, amount, actor, reason, notes=None, expires=None, sa
if tacc is None and thm is None:
return False
if actor not in var.USERS and actor != botconfig.NICK:
if actor not in var.USERS and actor != users.Bot.nick:
return False
sacc = None
shm = None
@ -203,9 +203,9 @@ def add_warning(cli, target, amount, actor, reason, notes=None, expires=None, sa
mass_mode(cli, cmodes, [])
for (nick, user) in var.USERS.items():
if user["account"] in acclist:
cli.kick(botconfig.CHANNEL, nick, messages["tempban_kick"].format(nick=nick, botnick=botconfig.NICK, reason=reason))
cli.kick(botconfig.CHANNEL, nick, messages["tempban_kick"].format(nick=nick, botnick=users.Bot.nick, reason=reason))
elif user["host"] in hmlist:
cli.kick(botconfig.CHANNEL, nick, messages["tempban_kick"].format(nick=nick, botnick=botconfig.NICK, reason=reason))
cli.kick(botconfig.CHANNEL, nick, messages["tempban_kick"].format(nick=nick, botnick=users.Bot.nick, reason=reason))
# Update any tracking vars that may have changed due to this
db.init_vars()

View File

@ -225,7 +225,7 @@ def check_for_modes(cli, rnick, chan, modeaction, *target):
trgt = ""
keeptrg = False
target = list(target)
if target and target != [botconfig.NICK]:
if target and target != [users.Bot.nick]:
while modeaction:
if len(modeaction) > 1:
prefix = modeaction[0]
@ -1829,8 +1829,8 @@ def chk_decision(cli, force="", end_game=True, deadlist=[]):
gm = var.CURRENT_GAMEMODE.name
if (gm == "default" or gm == "villagergame") and len(var.ALL_PLAYERS) <= 9 and var.VILLAGERGAME_CHANCE > 0:
if botconfig.NICK in votelist:
if len(votelist[botconfig.NICK]) == avail:
if users.Bot.nick in votelist:
if len(votelist[users.Bot.nick]) == avail:
if gm == "default":
cli.msg(botconfig.CHANNEL, messages["villagergame_nope"])
stop_game("wolves")
@ -1840,7 +1840,7 @@ def chk_decision(cli, force="", end_game=True, deadlist=[]):
stop_game("everyone")
return
else:
del votelist[botconfig.NICK]
del votelist[users.Bot.nick]
# we only need 50%+ to not lynch, instead of an actual majority, because a tie would time out day anyway
# don't check for ABSTAIN_ENABLED here since we may have a case where the majority of people have pacifism totems or something
@ -2759,7 +2759,7 @@ def reaper(cli, gameid):
if var.PHASE in var.GAME_PHASES:
var.DCED_LOSERS.add(user)
if var.IDLE_PENALTY:
add_warning(cli, nck, var.IDLE_PENALTY, botconfig.NICK, messages["idle_warning"], expires=var.IDLE_EXPIRY)
add_warning(cli, nck, var.IDLE_PENALTY, users.Bot.nick, messages["idle_warning"], expires=var.IDLE_EXPIRY)
del_player(user, end_game=False, death_triggers=False)
win = chk_win(cli)
if not win and var.PHASE == "day" and var.GAMEPHASE == "day":
@ -2779,7 +2779,7 @@ def reaper(cli, gameid):
else:
channels.Main.send(messages["quit_death_no_reveal"].format(dcedplayer))
if var.PHASE != "join" and var.PART_PENALTY:
add_warning(cli, dcedplayer.nick, var.PART_PENALTY, botconfig.NICK, messages["quit_warning"], expires=var.PART_EXPIRY) # FIXME
add_warning(cli, dcedplayer.nick, var.PART_PENALTY, users.Bot.nick, messages["quit_warning"], expires=var.PART_EXPIRY) # FIXME
if var.PHASE in var.GAME_PHASES:
var.DCED_LOSERS.add(dcedplayer)
if not del_player(dcedplayer, devoice=False, death_triggers=False):
@ -2790,7 +2790,7 @@ def reaper(cli, gameid):
else:
channels.Main.send(messages["part_death_no_reveal"].format(dcedplayer))
if var.PHASE != "join" and var.PART_PENALTY:
add_warning(cli, dcedplayer.nick, var.PART_PENALTY, botconfig.NICK, messages["part_warning"], expires=var.PART_EXPIRY) # FIXME
add_warning(cli, dcedplayer.nick, var.PART_PENALTY, users.Bot.nick, messages["part_warning"], expires=var.PART_EXPIRY) # FIXME
if var.PHASE in var.GAME_PHASES:
var.DCED_LOSERS.add(dcedplayer)
if not del_player(dcedplayer, devoice=False, death_triggers=False):
@ -2801,7 +2801,7 @@ def reaper(cli, gameid):
else:
channels.Main.send(messages["account_death_no_reveal"].format(dcedplayer))
if var.PHASE != "join" and var.ACC_PENALTY:
add_warning(cli, dcedplayer.nick, var.ACC_PENALTY, botconfig.NICK, messages["acc_warning"], expires=var.ACC_EXPIRY) # FIXME
add_warning(cli, dcedplayer.nick, var.ACC_PENALTY, users.Bot.nick, messages["acc_warning"], expires=var.ACC_EXPIRY) # FIXME
if var.PHASE in var.GAME_PHASES:
var.DCED_LOSERS.add(dcedplayer)
if not del_player(dcedplayer, devoice=False, death_triggers=False):
@ -3225,7 +3225,7 @@ def leave_game(cli, nick, chan, rest):
if var.PHASE != "join":
var.DCED_LOSERS.add(users._get(nick)) # FIXME
if var.LEAVE_PENALTY:
add_warning(cli, nick, var.LEAVE_PENALTY, botconfig.NICK, messages["leave_warning"], expires=var.LEAVE_EXPIRY)
add_warning(cli, nick, var.LEAVE_PENALTY, users.Bot.nick, messages["leave_warning"], expires=var.LEAVE_EXPIRY)
if nick in var.PLAYERS:
var.DCED_PLAYERS[nick] = var.PLAYERS.pop(nick)
@ -5074,7 +5074,7 @@ def transition_night(cli):
debuglog("{0} REMEMBER: {1} as {2}".format(amn, amnrole, showrole))
if var.FIRST_NIGHT and chk_win(cli, end_game=False): # prevent game from ending as soon as it begins (useful for the random game mode)
start(cli, botconfig.NICK, botconfig.CHANNEL, restart=var.CURRENT_GAMEMODE.name)
start(cli, users.Bot.nick, botconfig.CHANNEL, restart=var.CURRENT_GAMEMODE.name)
return
# game ended from bitten / amnesiac turning, narcolepsy totem expiring, or other weirdness
@ -6943,7 +6943,7 @@ if botconfig.DEBUG_MODE or botconfig.ALLOWED_NORMAL_MODE_COMMANDS:
cli.msg(chan, messages["incorrect_syntax"])
return
who = rst.pop(0).strip()
if not who or who == botconfig.NICK:
if not who or who == users.Bot.nick:
cli.msg(chan, messages["invalid_target"])
return
if who == "*":
@ -7037,7 +7037,7 @@ if botconfig.DEBUG_MODE or botconfig.ALLOWED_NORMAL_MODE_COMMANDS:
return
if not is_fake_nick(who):
who = ul[ull.index(who.lower())]
if who == botconfig.NICK or not who:
if who == users.Bot.nick or not who:
cli.msg(chan, messages["invalid_target"])
return
pl = list_players()