diff --git a/core/igncore.py b/core/igncore.py
index 4becf2c..69c8fc9 100644
--- a/core/igncore.py
+++ b/core/igncore.py
@@ -48,7 +48,7 @@ class IgnCore:
self.last_timer_event = 0
self.start_time = int(time.time())
self.major_version = "IGNCore v2.9"
- self.minor_version = "1"
+ self.minor_version = "2"
self.incoming_queue = FifoQueue()
self.mass_message_queue = None
self.conns = DictObject()
diff --git a/core/text.py b/core/text.py
index 44f7ae5..3feffec 100644
--- a/core/text.py
+++ b/core/text.py
@@ -57,7 +57,7 @@ class Text:
self.bot = registry.get_instance("bot")
self.public_channel_service = registry.get_instance("public_channel_service")
- def make_chatcmd(self, name, msg, style=""):
+ def make_chatcmd(self, name: str, msg: str, style: str = "") -> str:
msg = msg.strip()
msg = msg.replace("'", "'")
return f"{name}"
diff --git a/modules/core/ban/orgban_controller.py b/modules/core/ban/orgban_controller.py
index ae9d60a..f0de083 100644
--- a/modules/core/ban/orgban_controller.py
+++ b/modules/core/ban/orgban_controller.py
@@ -85,11 +85,11 @@ class OrgBanController(BaseModule):
elif len(orgs) > 1:
blob = "Your search had multiple results; please pick an org:
"
for org in orgs:
- blob += "[%s] %s (%s) <%s>%s [%s " \
+ blob += "[%s] %s (%s) <%s>%s%s> [%s " \
"members]
" \
% (self.text.make_chatcmd("Unban", "/tell orgban remove %s" % org.org_id),
# self.text.make_chatcmd("More", "/tell org info %s" % org.org_id),
- org.org_name, org.org_id, org.faction.lower(), org.faction, org.member_count)
+ org.org_name, org.org_id, org.faction.lower(), org.faction, org.faction.lower(), org.member_count)
return ChatBlob("Pick an Org", blob)
@command(command="orgban", params=[Const("add", is_optional=True), Int("Organisation"),
@@ -119,10 +119,10 @@ class OrgBanController(BaseModule):
elif len(orgs) > 1:
blob = "Your search had multiple results; please pick an org:
"
for org in orgs:
- blob += "[%s] %s (%s) <%s>%s [%s " \
+ blob += "[%s] %s (%s) <%s>%s%s> [%s " \
"members]
" \
% (self.text.make_chatcmd("Add Ban", "/tell orgban add %s" % org.org_id),
- org.org_name, org.org_id, org.faction.lower(), org.faction, org.member_count)
+ org.org_name, org.org_id, org.faction.lower(), org.faction, org.faction.lower(), org.member_count)
return ChatBlob("Pick an Org", blob)
def fetch_single(self, org_id, sender: object):
diff --git a/modules/core/discord/discord_command_handler.py b/modules/core/discord/discord_command_handler.py
index 2dc425b..a2752e4 100644
--- a/modules/core/discord/discord_command_handler.py
+++ b/modules/core/discord/discord_command_handler.py
@@ -44,7 +44,10 @@ class DiscordCommandHandler(BaseModule):
@event("discord_command", "should the bot take care of discord commands", False)
def discord_command_handler(self, _, event_data):
acc = event_data.account
+
ctx: Message = event_data.message
+ if not acc:
+ return
message = ctx.clean_content
if message.startswith(self.discord.setting_service.get("symbol").get_value()):
threading.Thread(target=self.command_service.process_command(
@@ -138,6 +141,7 @@ class DiscordCommandHandler(BaseModule):
('#(.+?)#', r'\1'),
('<', '<'),
('>', '>'),
+ (r"", ''),
('', '')]:
ctx = re.sub(pattern, sub, ctx)
cnt = 1
@@ -147,7 +151,7 @@ class DiscordCommandHandler(BaseModule):
ctx.rstrip()
ctx.rstrip(">")
- return ctx
+ return self.discord.text.strip_html_tags(ctx)
@command(command="discord", params=[Const("invite")], access_level="member",
description="Get a personal Discord invite", sub_command="invite")
@@ -389,7 +393,7 @@ class DiscordCommandHandler(BaseModule):
@timerevent(budatime="5m", description="update activity")
def change_count(self, _, _1):
- if hasattr(self, "loop"):
+ if hasattr(self.discord, "loop"):
count = self.db.query_single('SELECT count(*) as count from online '
'where char_id NOT IN (select char_id from org_bots) and bot=?',
[self.bot.get_char_id()]).count
diff --git a/modules/core/discord/discord_controller.py b/modules/core/discord/discord_controller.py
index 65bfb50..ec9bc36 100644
--- a/modules/core/discord/discord_controller.py
+++ b/modules/core/discord/discord_controller.py
@@ -342,9 +342,9 @@ class DiscordController:
DictObject(acc), msg.content,
prefix + msg.content)
else:
- prefix = f"[-UNK-] {msg.author.username}: " if self.alias_usage().get_value() else f"[DC] {msg.author.username}: "
+ prefix = f"[-UNK-] {msg.author.name}: " if self.alias_usage().get_value() else f"[DC] {msg.author.name}: "
self.relay_hub_service.send_message("Discord_(" + channel.name+")",
- DictObject({'char_id': 0, 'name': msg.author.username, 'discord_handle': f'{msg.author.name}#{msg.author.discriminator}'}), msg.content,
+ DictObject({'char_id': 0, 'name': msg.author.name, 'discord_handle': f'{msg.author.name}#{msg.author.discriminator}'}), msg.content,
prefix + msg.content)
if str(channel.id) not in self.channel_blacklist().get_value().lstrip("[").rstrip("]").split(','):
self.bot.event_service.fire_event("discord_command", DictObject({'account': acc, 'message': msg}))
@@ -395,7 +395,7 @@ class DiscordController:
return True
def check(self, msg: Message):
- if msg.pinned or (len(msg.embeds) > 0 and (msg.created_at.utcnow() < datetime.utcnow()-timedelta(hours=12))):
+ if msg.pinned or (len(msg.embeds) > 0) and (msg.created_at.utcnow() < datetime.utcnow() - timedelta(hours=12)):
return False
else:
return True
diff --git a/modules/core/private_channel/private_channel.msg b/modules/core/private_channel/private_channel.msg
index d16708f..797857a 100644
--- a/modules/core/private_channel/private_channel.msg
+++ b/modules/core/private_channel/private_channel.msg
@@ -29,7 +29,7 @@
},
"join": {
"en_US": "{char} has joined the private channel. {logon}",
- "de_DE": "Online: {char}. {logon}"
+ "de_DE": "Online>: {char}. {logon}"
},
"leave": {
"en_US": "{char} has left the private channel. {logoff}",
diff --git a/modules/core/private_channel/topic_controller.py b/modules/core/private_channel/topic_controller.py
index 8f95ce9..efdb223 100644
--- a/modules/core/private_channel/topic_controller.py
+++ b/modules/core/private_channel/topic_controller.py
@@ -59,8 +59,8 @@ class TopicController:
def format_topic_message(self, topic):
time_string = self.util.time_to_readable(int(time.time()) - topic["created_at"])
- return f"Topic: {topic['topic_message']} " \
- f"[set by {topic['created_by']['name']}][{time_string} ago]"
+ return f"Topic: {topic['topic_message']} " \
+ f"[set by {topic['created_by']['name']}][{time_string} ago]"
@event(PrivateChannelService.JOINED_PRIVATE_CHANNEL_EVENT, "Show topic to characters joining the private channel")
def show_topic(self, _, event_data):
diff --git a/modules/onlinebot/alliance/alliance_relay_controller.py b/modules/onlinebot/alliance/alliance_relay_controller.py
deleted file mode 100644
index 6a19998..0000000
--- a/modules/onlinebot/alliance/alliance_relay_controller.py
+++ /dev/null
@@ -1,112 +0,0 @@
-# from core.aochat import server_packets, client_packets
-# from core.conn import Conn
-# from core.decorators import instance
-# from core.igncore import IgnCore
-# from core.logger import Logger
-# from core.lookup.character_service import CharacterService
-# from core.setting_service import SettingService
-# from core.setting_types import TextSettingType, BooleanSettingType, ColorSettingType
-# from core.text import Text
-# from modules.onlinebot.online.org_alias_controller import OrgAliasController
-#
-#
-# @instance("AllianceRelayController")
-# class AllianceRelayController:
-# relay_channel_id = None
-# MESSAGE_SOURCE = "alliance"
-#
-# def __init__(self):
-# self.logger = Logger(__name__)
-#
-# # noinspection DuplicatedCode
-# def inject(self, registry):
-# self.bot: IgnCore = registry.get_instance("bot")
-# self.setting_service: SettingService = registry.get_instance("setting_service")
-# self.character_service: CharacterService = registry.get_instance("character_service")
-# self.message_hub_service = registry.get_instance("message_hub_service")
-# self.public_channel_service = registry.get_instance("public_channel_service")
-# self.text: Text = registry.get_instance("text")
-# self.alias_controller: OrgAliasController = registry.get_instance("org_alias_controller")
-#
-# def pre_start(self):
-# self.message_hub_service.register_message_source(self.MESSAGE_SOURCE)
-#
-# def start(self):
-# self.setting_service.register(self.module_name, "arelaybot", "",
-# TextSettingType(allow_empty=True), "Bot for alliance relay")
-#
-# self.setting_service.register(self.module_name, "arelay_enabled", False,
-# BooleanSettingType(), "Enable the alliance relay")
-#
-# self.setting_service.register(self.module_name, "arelay_color", "#C3C3C3",
-# ColorSettingType(),
-# "Color of messages from relay")
-#
-# # self.message_hub_service.register_message_destination(self.MESSAGE_SOURCE, self.handle_relay_hub_message, [],
-# # [self.MESSAGE_SOURCE])
-#
-# self.bot.register_packet_handler(server_packets.PrivateChannelInvited.id, self.handle_private_channel_invite,
-# 100)
-# self.bot.register_packet_handler(server_packets.PrivateChannelMessage.id, self.handle_private_channel_message)
-#
-# # noinspection DuplicatedCode
-# def handle_private_channel_invite(self, conn: Conn, packet: server_packets.PrivateChannelInvited):
-# if conn.id != "main":
-# return
-#
-# if not self.setting_service.get("arelay_enabled").get_value():
-# return
-#
-# channel_name = self.character_service.get_char_name(packet.private_channel_id)
-# if self.setting_service.get_value("arelaybot").lower() == channel_name.lower():
-# self.bot.send_packet(client_packets.PrivateChannelJoin(packet.private_channel_id))
-# self.logger.info("Joined private channel {channel}".format(channel=channel_name))
-# self.relay_channel_id = packet.private_channel_id
-#
-# # noinspection DuplicatedCode
-# def handle_private_channel_message(self, conn: Conn, packet: server_packets.PrivateChannelMessage):
-# if conn.id != "main":
-# return
-#
-# if not self.setting_service.get("arelay_enabled").get_value():
-# return
-#
-# # ignore packets from the bot's own private channel and from the bot itself
-# if packet.private_channel_id == self.bot.get_char_id() or packet.char_id == self.bot.get_char_id():
-# return
-#
-# message = packet.message.lstrip()
-# if message[:6] != "!agcr ":
-# return
-#
-# message = message[6:]
-# formatted_message = self.setting_service.get("arelay_color").format_text(message)
-#
-# sender = None
-# self.message_hub_service.send_message(self.MESSAGE_SOURCE, sender, message, formatted_message)
-#
-# def handle_relay_hub_message(self, ctx):
-# if not self.setting_service.get("arelay_enabled").get_value():
-# return
-#
-# plain_msg = ctx.message or ctx.formatted_message
-# invite = self.text.make_chatcmd("click here", "/tell discord invite",
-# style="style='text-decoration:none'")
-# name = f"[{self.alias_controller.get_alias(ctx.sender.org_id)}] {ctx.sender.name}"
-# blob = self.text.format_page('Info',
-# f"
"
-# f"This message has been sent to you by:
"
-# f"Igncom
"
-# f"{ctx.sender.discord_handle}
"
-# f"{name} on Alliance Discord.
"
-# f"To reply, either respond in the relay or "
-# f"contact them directly at the provided handles.
"
-# f"Have you joined The Alliance Discord yet? "
-# f"If not {invite} to receive an invite.")
-# self.send_message_to_alliance(f"{name}: {plain_msg}" + f" [{blob}]")
-#
-# def send_message_to_alliance(self, msg):
-# if self.relay_channel_id:
-# packet = client_packets.PrivateChannelMessage(self.relay_channel_id,
-# "!agcr " + self.text.format_message(msg, False), "\0")
-# self.bot.conns["main"].send_packet(packet)
diff --git a/modules/onlinebot/online/bot_controller.py b/modules/onlinebot/online/bot_controller.py
index f97a2dc..0d836f7 100644
--- a/modules/onlinebot/online/bot_controller.py
+++ b/modules/onlinebot/online/bot_controller.py
@@ -41,19 +41,19 @@ class BotController(BaseModule):
def cmd_orgs_bots_add(self, request, _, _1, bot):
player = self.pork.request_char_info(bot.name, 5)
if self.db.exec("INSERT IGNORE INTO org_bots(char_id, org_id) VALUES(?, ?)", [bot.char_id, player.org_id]) == 0:
- request.reply(f"The bot {bot.name} is already marked as a chatbot.")
+ request.reply(f"The bot {bot.name} is already marked as a chatbot.")
else:
self.db.exec("DELETE FROM online where char_id=?", [bot.char_id])
- request.reply(f"Successfully marked {bot.name} as a chatbot.")
+ request.reply(f"Successfully marked {bot.name} as a chatbot.")
@command(command="orgs", params=[Const("bots"), Const("rem"), Character("botname")], access_level="admin",
description="Add an bot to the bot list", sub_command="bots_mng")
def cmd_orgs_bots_rem(self, request, _, _1, bot):
if self.db.exec("DELETE FROM org_bots WHERE char_id=?", [bot.char_id]) == 0:
- request.reply(f"{bot.name} is not a chatbot.")
+ request.reply(f"{bot.name} is not a chatbot.")
else:
- request.reply(f"Successfully removed {bot.name} as a chatbot. The character will show up in !online again after its next login.")
+ request.reply(f"Successfully removed {bot.name} as a chatbot. The character will show up in !online again after its next login.")
@command(command="orgs",
params=[Const("bots")],
@@ -63,8 +63,8 @@ class BotController(BaseModule):
def cmd_orgs_bots_show(self, _, _1):
def format_row(query):
bud = self.buddy_service.is_online(query["char_id"])
- buddy = "O" if bud == 1 else "O" if bud == 0 else "U"
- return "- [{status}] {name} ({org_name})\n".format(**query, status=buddy)
+ buddy = "O" if bud == 1 else "O" if bud == 0 else "U"
+ return "- [{status}] {name} ({org_name})\n".format(**query, status=buddy)
data = self.db.query("SELECT * FROM org_bots o LEFT JOIN player p on o.char_id = p.char_id order by p.org_name")
blob = ""
diff --git a/modules/onlinebot/online/org_alias_controller.py b/modules/onlinebot/online/org_alias_controller.py
index d06a0ca..b26ae75 100644
--- a/modules/onlinebot/online/org_alias_controller.py
+++ b/modules/onlinebot/online/org_alias_controller.py
@@ -64,19 +64,19 @@ class OrgAliasController:
orgs = orgs[0]
if self.db.exec("REPLACE INTO org_alias(org_id, org_alias) VALUES (?, ?)", [orgs.org_id, alias]):
self.prefix_cache[orgs.org_id] = alias
- return f"Alias for {orgs.org_name} has been set to [{alias}]."
+ return f"Alias for {orgs.org_name} has been set to [{alias}]."
else:
- return f"There's already an alias for {orgs.org_name}.. its [{self.get_alias(orgs.org_id)}]"
+ return f"There's already an alias for {orgs.org_name}.. its [{self.get_alias(orgs.org_id)}]"
elif len(orgs) == 0:
- return f"No org with the name {search} was found on PoRK."
+ return f"No org with the name {search} was found on PoRK."
else:
blob = "Your search had multiple results; please pick an org:
"
for org in orgs:
blob += f'[{self.text.make_chatcmd("Set Alias", f"/tell orgs alias set {alias} {org.org_id}")}]' \
f'[{self.text.make_chatcmd("More", f"/tell orgs info {org.org_id}")}]' \
- f' {org.org_name} ({org.org_id}) ' \
- f'<{org.faction.lower()}>{org.faction} [{org.member_count} members]' \
+ f' {org.org_name} ({org.org_id}) ' \
+ f'<{org.faction.lower()}>{org.faction}{org.faction.lower()}> [{org.member_count} members]' \
f'
'
return ChatBlob("Pick an Org", blob)
@@ -89,17 +89,17 @@ class OrgAliasController:
orgs = orgs[0]
if self.db.exec("DELETE FROM org_alias where org_id=?", [orgs.org_id]) == 1:
self.prefix_cache.pop(orgs.org_id)
- return f"Alias for {orgs.org_name} has been removed."
+ return f"Alias for {orgs.org_name} has been removed."
else:
- return f"There's no alias for {orgs.org_name}.."
+ return f"There's no alias for {orgs.org_name}.."
elif len(orgs) == 0:
- return f"No org with the name {search} was found on PoRK."
+ return f"No org with the name {search} was found on PoRK."
else:
blob = "Your search had multiple results; please pick an org:
"
for org in orgs:
blob += f'[{self.text.make_chatcmd("Set Alias", f"/tell orgs alias rem {org.org_id}")}]' \
f'[{self.text.make_chatcmd("More", f"/tell orgs info {org.org_id}")}]' \
- f' {org.org_name} ({org.org_id}) ' \
- f'<{org.faction.lower()}>{org.faction} [{org.member_count} members]' \
+ f' {org.org_name} ({org.org_id}) ' \
+ f'<{org.faction.lower()}>{org.faction}{org.faction.lower()}> [{org.member_count} members]' \
f'
'
return ChatBlob("Pick an Org", blob)
diff --git a/modules/onlinebot/online/org_controller.py b/modules/onlinebot/online/org_controller.py
index 2889bf2..cc84edc 100644
--- a/modules/onlinebot/online/org_controller.py
+++ b/modules/onlinebot/online/org_controller.py
@@ -77,22 +77,22 @@ class OrgController:
orgs = orgs[0]
if self.db.exec("REPLACE INTO orgs(org_id) VALUES(?)",
[orgs.org_id]) == 1:
- sender.reply(f"Adding the organisation {orgs.org_name} to the roster...")
+ sender.reply(f"Adding the organisation {orgs.org_name} to the roster...")
org_adder = Thread(name=orgs.org_id, target=self.fetch_single,
args=(orgs.org_id, orgs.org_name, sender))
self.threads[orgs.org_id] = org_adder
org_adder.start()
else:
- return f"The organisation {orgs.org_name} is in the roster already."
+ return f"The organisation {orgs.org_name} is in the roster already."
elif len(orgs) == 0:
- return f"No org with the name {search} was found on PoRK."
+ return f"No org with the name {search} was found on PoRK."
else:
blob = "Your search had multiple results; please pick an org:
"
for org in orgs:
blob += f'[{self.text.make_chatcmd("Add", f"/tell orgs add {org.org_id}")}]' \
f'[{self.text.make_chatcmd("More", f"/tell org info {org.org_id}")}]' \
- f' {org.org_name} ({org.org_id}) ' \
- f'<{org.faction.lower()}>{org.faction} [{org.member_count} members]' \
+ f' {org.org_name} ({org.org_id}) ' \
+ f'<{org.faction.lower()}>{org.faction}{org.faction.lower()}> [{org.member_count} members]' \
f'
'
return ChatBlob("Pick an Org", blob)
@@ -110,34 +110,34 @@ class OrgController:
org_remover = Thread(name=orgs.org_id, target=self.remove_single, args=(orgs.org_id, orgs.org_name))
self.threads[orgs.org_id] = org_remover
org_remover.start()
- return f"Removed the organisation {orgs.org_name} from the roster."
+ return f"Removed the organisation {orgs.org_name} from the roster."
else:
- return f"The organisation {orgs.org_name} is not on the roster list."
+ return f"The organisation {orgs.org_name} is not on the roster list."
elif len(orgs) == 0:
- return f"The organisation {search} is not on the roster list."
+ return f"The organisation {search} is not on the roster list."
else:
blob = "Your search had multiple results; please pick an org:
"
for org in orgs:
blob += f'[{self.text.make_chatcmd("Remove", f"/tell orgs remove {org.org_id}")}]' \
f'[{self.text.make_chatcmd("More", f"/tell org info {org.org_id}")}]' \
- f' {org.org_name} ({org.org_id}) ' \
- f'<{org.faction.lower()}>{org.faction} [{org.member_count} members]' \
+ f' {org.org_name} ({org.org_id}) ' \
+ f'<{org.faction.lower()}>{org.faction}{org.faction.lower()}> [{org.member_count} members]' \
f'
'
return ChatBlob("Pick an Org", blob)
@command(command="orgs", params=[Const("list", is_optional=True)], access_level="member",
description="View all orgs on the online list", sub_command="online_info")
def orgs_list(self, sender: CommandRequest, _):
- head = "Organisations registered as Members"
+ head = "Organisations registered as Members"
blob = ""
for org in self.db.query("SELECT o.*, a.*, oa.org_alias from orgs o "
"left join all_orgs a on o.org_id = a.org_id "
"left join org_alias oa on o.org_id = oa.org_id order by a.org_name"):
org = DictObject(org)
- blob += "- %s%s%s%s (%d) with %d members\n" % (
- "[" + self.text.make_chatcmd("Info", "/tell orgs info %d" % org.org_id,
+ blob += "- %s%s%s%s (%d) with %d members\n" % (
+ "[" + self.text.make_chatcmd("Info", f"/tell orgs info {org.org_id}",
style="style='text-decoration:none'") + "] ",
- "[" + self.text.make_chatcmd("Remove", "/tell orgs rem %d" % org.org_id,
+ "[" + self.text.make_chatcmd("Remove", f"/tell orgs rem {org.org_id}",
style="style='text-decoration:none'") + "] " if
sender.sender.access_level["level"] <= 10 else "",
f"[{self.org_alias.get_alias(org.org_id)}] ",
diff --git a/modules/onlinebot/raids/raid_controller.py b/modules/onlinebot/raids/raid_controller.py
index 9be9b11..675edb8 100644
--- a/modules/onlinebot/raids/raid_controller.py
+++ b/modules/onlinebot/raids/raid_controller.py
@@ -203,7 +203,7 @@ class RaidController:
continue
if prof != i.profession:
info += "\n\n
"
- info += "\n" + f"
{i.profession}\n"
+ info += "\n" + f"
{i.profession}\n"
info += "
"
prof = i.profession
diff --git a/modules/orgbot/notify/notify_controller.py b/modules/orgbot/notify/notify_controller.py
index cdd27bf..b503145 100644
--- a/modules/orgbot/notify/notify_controller.py
+++ b/modules/orgbot/notify/notify_controller.py
@@ -53,11 +53,11 @@ class NotifyController:
logs = self.get_log(alts, limit or 20)
blob = ""
if len(logs) == 0:
- return "No data for %s recorded." % char.name
+ return f"No data for {char.name} recorded."
for log in logs:
- blob += f"[{self.util.format_datetime(log.time)}] {log.name} -> " \
+ blob += f"[{self.util.format_datetime(log.time)}] {log.name} -> " \
f"{'logged on' if log.status == 1 else 'logged off'}.\n"
- return f"{char.name} was last seen at " \
+ return f"{char.name} was last seen at " \
f"{self.util.format_date(logs[0].time)}. {self.text.format_page('More', blob)}"
def get_log(self, char_list, length=16):
diff --git a/modules/raidbot/raid/preset_controller.py b/modules/raidbot/raid/preset_controller.py
index 1273759..5f362a0 100644
--- a/modules/raidbot/raid/preset_controller.py
+++ b/modules/raidbot/raid/preset_controller.py
@@ -50,11 +50,11 @@ class PresetController:
count = self.db.query_single("SELECT COUNT(*) AS count FROM points_presets WHERE name = ?", [name]).count
if count > 0:
- return "A preset already exists with the name %s." % name
+ return f"A preset already exists with the name {name}."
sql = "INSERT INTO points_presets (name, points) VALUES (?,?)"
if self.db.exec(sql, [name, points]) > 0:
- return f"A preset with the name {name} was added, worth {points:d} points."
+ return f"A preset with the name {name} was added, worth {points} points."
return "Failed to insert new preset in DB."
@@ -62,9 +62,9 @@ class PresetController:
description="Delete preset", sub_command="mod")
def presets_rem_cmd(self, _1, _2, preset_id: int):
if self.db.exec("DELETE FROM points_presets WHERE preset_id = ?", [preset_id]) > 0:
- return "Successfully removed preset with ID %d." % preset_id
+ return f"Successfully removed preset with ID {preset_id}."
- return "No preset with given ID %d." % preset_id
+ return f"No preset with given ID {preset_id}."
@command(command="presets",
params=[Const("alter"), Int("preset_id"), Int("new_points")],
@@ -75,10 +75,10 @@ class PresetController:
if preset:
if self.db.exec("UPDATE points_presets SET points = ? WHERE preset_id = ?", [new_points, preset_id]) > 0:
- return f"Successfully updated the preset, {preset.name}, " \
- f"to dish out {new_points:d} points instead of {preset.points:d}."
+ return f"Successfully updated the preset, {preset.name}, " \
+ f"to dish out {new_points} points instead of {preset.points}."
- return "Failed to update preset with ID %d." % preset_id
+ return f"Failed to update preset with ID {preset_id}."
@command(command="presets", params=[], access_level="admin",
description="See list of points presets")
@@ -94,11 +94,11 @@ class PresetController:
for preset in presets:
add_points_link = self.text.make_chatcmd("Add pts", f"/tell raid addpts {preset.name}")
- delete_link = self.text.make_chatcmd("Delete", f"/tell presets rem {preset.preset_id:d}")
- blob += f"{preset.name} worth {preset.points:d} points " \
- f"[id: {preset.preset_id:d}]\n | [{add_points_link}] [{delete_link}]\n\n"
+ delete_link = self.text.make_chatcmd("Delete", f"/tell presets rem {preset.preset_id}")
+ blob += f"{preset.name} worth {preset.points} points " \
+ f"[id: {preset.preset_id}]\n | [{add_points_link}] [{delete_link}]\n\n"
return blob
return "No presets available. " \
- "To add new presets use presets add preset_name preset_points."
+ "To add new presets use presets add preset_name preset_points."
diff --git a/modules/raidbot/raid/raidbot_controller.py b/modules/raidbot/raid/raidbot_controller.py
index fe4a00a..75fb199 100644
--- a/modules/raidbot/raid/raidbot_controller.py
+++ b/modules/raidbot/raid/raidbot_controller.py
@@ -92,27 +92,27 @@ class RaidbotController(BaseModule):
t = int(time.time())
blob = ""
- blob += f"Name: {self.raid.desc}\n"
+ blob += f"Name: {self.raid.desc}\n"
blob += f"Minimum Level: {self.raid.level}\n"
- blob += f"Started By: {self.raid.started_by.name}\n"
+ blob += f"Started By: {self.raid.started_by.name}\n"
blob += f"Raidleader: " \
f"" \
- f"{self.leader.leader.name if self.leader.leader else 'not set - use !leader set'}" \
- f"\n"
- blob += f"Started At: {self.util.format_datetime(self.raid.started_at)} " \
+ f"{self.leader.leader.name if self.leader.leader else 'not set - use !leader set'}" \
+ f"\n"
+ blob += f"Started At: {self.util.format_datetime(self.raid.started_at)} " \
f"({self.util.time_to_readable(t - self.raid.started_at)} ago)\n"
if self.raid.is_open:
- blob += f"Status: Open [{self.text.make_chatcmd('Join', '/tell raid join')}] " \
- f"[{self.text.make_chatcmd('Lock', '/tell raid lock')}]"
+ blob += f"Status: Open [{self.text.make_chatcmd('Join', '/tell raid join')}] " \
+ f"[{self.text.make_chatcmd('Lock', '/tell raid lock')}]"
else:
- blob += f"Status: Closed " \
- f"[{self.text.make_chatcmd('Unlock', '/tell raid open')}]"
+ blob += f"Status: Closed " \
+ f"[{self.text.make_chatcmd('Unlock', '/tell raid open')}]"
blob += "\n\n"
if self.raid.raid_orders:
- blob += "Orders\n"
+ blob += "Orders\n"
blob += self.raid.raid_orders + "\n\n"
- blob += "Raiders\n"
+ blob += "Raiders\n"
for raider in self.raid.raiders:
if raider.is_active:
blob += self.format_row(raider.get_active_char())
@@ -132,7 +132,7 @@ class RaidbotController(BaseModule):
description="Start new raid", access_level="leader", sub_command="manage")
def raid_start_cmd(self, request: CommandRequest, _, raid_name: str):
if self.raid:
- return "The %s raid is already running." % self.raid.raid_name
+ return "The %s raid is already running." % self.raid.raid_name
self.raid = Raid(raid_name, request.sender)
@@ -141,11 +141,11 @@ class RaidbotController(BaseModule):
join_link = self.get_raid_join_blob("Click here")
msg = "\n" \
- f"────────[ Raid starting ]────────\n" \
- f"Initiator: {request.sender.name}\n" \
- f"Raid Name: {raid_name}\n" \
+ f"────────[ Raid starting ]────────\n" \
+ f"Initiator: {request.sender.name}\n" \
+ f"Raid Name: {raid_name}\n" \
f"{join_link} to join\n" \
- f"────────[ Raid starting ]────────"
+ f"────────[ Raid starting ]────────"
self.leader.leader = None
self.leader.set_raid_leader(request.sender, request.sender)
# self.bot.send_org_message(msg)
@@ -154,10 +154,10 @@ class RaidbotController(BaseModule):
f"[STARTED] Raid with desc: {raid_name}",
request.sender.char_id)
if request.channel == "msg":
- return "You have been set as the active Raidleader. " \
- "Set another Raidleader by using !leader set <name>"
+ return "You have been set as the active Raidleader. " \
+ "Set another Raidleader by using !leader set <name>"
else:
- return f"{request.sender.name} has been set as the active Raidleader automatically."
+ return f"{request.sender.name} has been set as the active Raidleader automatically."
@command(command="raid",
params=[Const("desc"), Any("description")],
@@ -198,7 +198,7 @@ class RaidbotController(BaseModule):
if in_raid is not None:
if in_raid.active_id == char.char_id:
if in_raid.is_active:
- return f"The Character {char.name} is already participating in the Raid."
+ return f"The Character {char.name} is already participating in the Raid."
else:
in_raid.is_active = True
in_raid.was_kicked = None
@@ -213,8 +213,8 @@ class RaidbotController(BaseModule):
f"{request.sender.name}")
elif in_raid.is_active:
former_active_name = self.character_service.resolve_char_to_name(in_raid.active_id)
- return f"{char.name} is already participating in the raid with the char " \
- f"{former_active_name}"
+ return f"{char.name} is already participating in the raid with the char " \
+ f"{former_active_name}"
else:
alts = self.account_service.get_alts(char.char_id)
self.raid.raiders.append(Raider(alts, char.char_id))
@@ -284,7 +284,7 @@ class RaidbotController(BaseModule):
request.sender.char_id)
self.send_raid_msg("JOIN", f"{request.sender.name}")
- # self.bot.send_private_channel_message("%s joined the raid." % request.sender.name)
+ # self.bot.send_private_channel_message("%s joined the raid." % request.sender.name)
else:
return "Raid is closed."
@@ -302,7 +302,7 @@ class RaidbotController(BaseModule):
f"[LEAVE] Raid: {self.raid.raid_name}",
request.sender.char_id)
self.send_raid_msg("LEAVE", f"{request.sender.name}")
- # self.bot.send_private_channel_message("%s left the raid." % request.sender.name)
+ # self.bot.send_private_channel_message("%s left the raid." % request.sender.name)
else:
return "You are not in the raid."
@@ -357,7 +357,7 @@ class RaidbotController(BaseModule):
warn_link = self.text.make_chatcmd("Warn",
f"/tell cmd {raider_name} missed active check, "
f"please give notice.")
- blob += "%s [%s] [%s]\n" % (raider_name, akick_link, warn_link)
+ blob += f"{raider_name} [{akick_link}] [{warn_link}]\n"
raider_names.append(raider_name)
active_check_names = "/assist "
active_check_names += "\\n /assist ".join(raider_names)
@@ -377,7 +377,7 @@ class RaidbotController(BaseModule):
if in_raid is not None:
if not in_raid.is_active:
- return "%s is not an active participant of the raid." % char.name
+ return f"{char.name} is not an active participant of the raid."
in_raid.is_active = False
in_raid.was_kicked = int(time.time())
@@ -399,7 +399,7 @@ class RaidbotController(BaseModule):
self.bot.get_char_id())
self.send_raid_msg("KICKED", f"{name} for: {reason}")
else:
- return "%s is not participating." % char.name
+ return f"{char.name} is not participating."
@command(command="raid",
params=[Options(["unlock", "open", "lock", "close"])],
@@ -455,7 +455,7 @@ class RaidbotController(BaseModule):
self.raid = None
self.leader.set_raid_leader(self.leader.leader, None)
- return "Raid has ended, logs got saved. Raidleader cleared."
+ return "Raid has ended, logs got saved. Raidleader cleared."
else:
return "Failed to end raid. Try again."
@@ -481,21 +481,21 @@ class RaidbotController(BaseModule):
if not log_entry:
return "No such log entry."
- blob = f"Raid name: {log_entry[0].raid_name}\n"
- blob += f"Started by: {self.character_service.resolve_char_to_name(log_entry[0].started_by)}\n"
- blob += f"Start time: {self.util.format_datetime(log_entry[0].raid_start)}\n"
- blob += f"End time: {self.util.format_datetime(log_entry[0].raid_end)}\n"
+ blob = f"Raid name: {log_entry[0].raid_name}\n"
+ blob += f"Started by: {self.character_service.resolve_char_to_name(log_entry[0].started_by)}\n"
+ blob += f"Start time: {self.util.format_datetime(log_entry[0].raid_start)}\n"
+ blob += f"End time: {self.util.format_datetime(log_entry[0].raid_end)}\n"
blob += f"Run time: " \
- f"{self.util.time_to_readable(log_entry[0].raid_end - log_entry[0].raid_start)}\n"
- blob += f"Total points: {pts_sum}\n\n"
+ f"{self.util.time_to_readable(log_entry[0].raid_end - log_entry[0].raid_start)}\n"
+ blob += f"Total points: {pts_sum}\n\n"
if char and log_entry_spec:
raider_name = self.character_service.resolve_char_to_name(log_entry_spec.raider_id)
main_info = self.account_service.get_main(log_entry_spec.raider_id)
alt_link = f"Alt of {main_info.name}" if main_info.char_id != log_entry_spec.raider_id else "Alts"
alt_link = self.text.make_chatcmd(alt_link, f"/tell alts {main_info.name}")
- blob += f"Log entry for {raider_name}\n"
- blob += f"Raider: {raider_name} [{alt_link}]\n"
+ blob += f"Log entry for {raider_name}\n"
+ blob += f"Raider: {raider_name} [{alt_link}]\n"
blob += "Left raid: %s\n" % ("n/a"
if log_entry_spec.left_raid is None
else self.util.format_datetime(log_entry_spec.left_raid))
@@ -506,7 +506,7 @@ class RaidbotController(BaseModule):
if log_entry_spec.was_kicked_reason is None
else log_entry_spec.was_kicked_reason)
- blob += "Participants\n"
+ blob += "Participants\n"
for raider in log_entry:
raider_name = self.character_service.resolve_char_to_name(raider.raider_id)
main_info = self.account_service.get_main(raider.raider_id)
@@ -534,8 +534,8 @@ class RaidbotController(BaseModule):
participant_link = self.text.make_chatcmd("Log", "/tell raid logentry %d" % raid.raid_id)
timestamp = self.util.format_datetime(raid.raid_start)
leader_name = self.character_service.resolve_char_to_name(raid.started_by)
- blob += f"[{raid.raid_id:d}] [{timestamp}] {raid.raid_name} " \
- f"started by {leader_name} [{participant_link}]\n"
+ blob += f"[{raid.raid_id:d}] [{timestamp}] {raid.raid_name} " \
+ f"started by {leader_name} [{participant_link}]\n"
return ChatBlob("Raid history", blob)
@@ -551,21 +551,21 @@ class RaidbotController(BaseModule):
self.bot.send_private_channel_message(f"[Raid: {msg_type}] {msg}")
def get_raid_join_blob(self, link_txt: str):
- blob = "1. Join the raid\n" \
- "To join the current raid %s, send the following tell to \n" \
+ blob = "1. Join the raid\n" \
+ "To join the current raid %s, send the following tell to \n" \
"/tell raid join\n" \
"\n" \
- "2. Enable LFT\n" \
+ "2. Enable LFT\n" \
"When you have joined the raid, go lft with \"\" as description\n" \
- "/lft \n" \
+ "