Initial Release of IGNCore version 2.5
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
Our Home: <a href='chatcmd:///start https://www.aoalliance.org/'>https://www.aoalliance.org/</a>
|
||||
Gitlab Repository: <a href='chatcmd:///start https://gitlab.com/CynderGames/igncore'>https://gitlab.com/CynderGames/igncore</a>
|
||||
|
||||
IGNCore is a performance oriented fork of Tyrbot based on version 0.5,
|
||||
and is being maintained by a group <highlight>Volunteers</highlight>.
|
||||
|
||||
At this point, we'd like to send a special "thank you" to the following people, which in one way or another, contributed to IGNCore/IGNCom:
|
||||
» <highlight>Zetabyte & its Network</highlight>, for many feature ideas,
|
||||
and the heavy assistance with knowledge.
|
||||
» <highlight>Chrisax</highlight> for hosting the !history mirror.
|
||||
» Everyone who participated in test runs,
|
||||
» sent us ideas for bot improvements,
|
||||
» helped us by sending bug reports our way,
|
||||
» or just by keeping us busy during a long night of development.
|
||||
|
||||
aswell as the initial developers of Tyrbot, on which IGNCore is based:
|
||||
» <highlight>Tyrence</highlight>
|
||||
» <highlight>Teeko</highlight> for all the time he spent testing new features,
|
||||
reporting bugs, and making suggestions
|
||||
» <highlight>nepherius/wafflespower</highlight> who was critical during the
|
||||
early parts of development in testing and suggesting changes
|
||||
» <highlight>minidodo</highlight> for his significant contributions and fixes
|
||||
to Tyrbot, and his willingness to assist other users in the Discord channel
|
||||
» <highlight>hughp135</highlight>
|
||||
» <highlight>jroovers</highlight>
|
||||
» <highlight>dustify</highlight>
|
||||
» <highlight>equinitry</highlight>
|
||||
» <highlight>Ilon Sjögren</highlight>
|
||||
|
||||
If you'd like to know more, feel free to contact us on the toons listed in <highlight>!admins</highlight> - Administrators.
|
||||
@@ -0,0 +1,10 @@
|
||||
{
|
||||
"no_help": {
|
||||
"en_US": "Could not find help on <highlight>{topic}</highlight>",
|
||||
"de_DE": "Zu dem Thema <highlight>{topic}</highlight> konnte keine Hilfe gefunden werden."
|
||||
},
|
||||
"about_title": {
|
||||
"en_US": "About {version}",
|
||||
"de_DE": "Über <highlight>{version}</highlight>"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,85 @@
|
||||
import os
|
||||
|
||||
import hjson
|
||||
|
||||
from core.chat_blob import ChatBlob
|
||||
from core.command_param_types import Any, NamedFlagParameters
|
||||
from core.decorators import instance, command
|
||||
from core.translation_service import TranslationService
|
||||
|
||||
|
||||
@instance()
|
||||
class HelpController:
|
||||
def inject(self, registry):
|
||||
self.bot = registry.get_instance("bot")
|
||||
self.text = registry.get_instance("text")
|
||||
self.db = registry.get_instance("db")
|
||||
self.access_service = registry.get_instance("access_service")
|
||||
self.command_service = registry.get_instance("command_service")
|
||||
self.command_alias_service = registry.get_instance("command_alias_service")
|
||||
self.ts: TranslationService = registry.get_instance("translation_service")
|
||||
self.getresp = self.ts.get_response
|
||||
|
||||
def start(self):
|
||||
self.ts.register_translation("module/help", self.load_help_msg)
|
||||
self.command_alias_service.add_alias("version", "about")
|
||||
|
||||
def load_help_msg(self):
|
||||
with open("modules/core/help/help.msg", mode="r", encoding="UTF-8") as f:
|
||||
return hjson.load(f)
|
||||
|
||||
@command(command="about", params=[], access_level="member",
|
||||
description="Show information about the development of this bot")
|
||||
def about_cmd(self, _):
|
||||
with open(os.path.dirname(os.path.realpath(__file__)) + os.sep + "about.txt", mode="r", encoding="UTF-8") as f:
|
||||
return ChatBlob(self.getresp("module/help", "about_title",
|
||||
{"version": f"{self.bot.major_version}.{self.bot.minor_version}"}), f.read())
|
||||
|
||||
@command(command="help", params=[], access_level="member",
|
||||
description="Show a list of commands to get help with")
|
||||
def help_list_cmd(self, request):
|
||||
data = self.db.query("SELECT command, module, access_level FROM command_config "
|
||||
"WHERE enabled = 1 "
|
||||
"ORDER BY module, command")
|
||||
blob = ""
|
||||
current_group = ""
|
||||
current_module = ""
|
||||
current_command = ""
|
||||
access_level = self.access_service.get_access_level(request.sender.char_id)
|
||||
for row in data:
|
||||
if access_level["level"] > self.access_service.get_access_level_by_label(row.access_level)["level"]:
|
||||
continue
|
||||
|
||||
parts = row.module.split(".")
|
||||
group = parts[0]
|
||||
module = parts[1]
|
||||
if group != current_group:
|
||||
current_group = group
|
||||
blob += "\n\n<header2>" + current_group + "</header2>"
|
||||
|
||||
if module != current_module:
|
||||
current_module = module
|
||||
blob += "\n" + module + ":"
|
||||
|
||||
if row.command != current_command:
|
||||
current_command = row.command
|
||||
blob += " " + self.text.make_tellcmd(row.command, "help " + row.command)
|
||||
|
||||
return ChatBlob("Help (main)", blob)
|
||||
|
||||
@command(command="help", params=[Any("command"), NamedFlagParameters(["show_regex"])], access_level="member",
|
||||
description="Show help for a specific command")
|
||||
def help_detail_cmd(self, request, help_topic, named_params):
|
||||
help_topic = help_topic.lower()
|
||||
|
||||
# check for alias
|
||||
alias = self.command_alias_service.check_for_alias(help_topic)
|
||||
if alias:
|
||||
help_topic = alias
|
||||
|
||||
help_text = self.command_service.get_help_text(request.sender.char_id, help_topic,
|
||||
request.channel, named_params.show_regex)
|
||||
if help_text:
|
||||
return self.command_service.format_help_text(help_topic, help_text)
|
||||
else:
|
||||
return self.getresp("module/help", "no_help", {"topic": help_topic})
|
||||
Reference in New Issue
Block a user