diff --git a/bots/discord/slash/arcaea.py b/bots/discord/slash/arcaea.py index 0a50364488..14d1cf8954 100644 --- a/bots/discord/slash/arcaea.py +++ b/bots/discord/slash/arcaea.py @@ -6,12 +6,12 @@ arcaea = client.create_group("arcaea", "Queries about Arcaea.") -@arcaea.command(description="Get the latest version of game apk.") +@arcaea.command(name="download", description="Get the latest version of game apk.") async def download(ctx: discord.ApplicationContext): await slash_parser(ctx, "download") -@arcaea.command(description="Random a song.") +@arcaea.command(name="random", description="Random a song.") async def random(ctx: discord.ApplicationContext): await slash_parser(ctx, "random") @@ -19,11 +19,11 @@ async def random(ctx: discord.ApplicationContext): rank = arcaea.create_subgroup("rank", "View the current daily rank of Arcaea songs.") -@rank.command(description="View the current rank of the free packs.") +@rank.command(name="free", description="View the current rank of the free packs.") async def free(ctx: discord.ApplicationContext): await slash_parser(ctx, "rank free") -@rank.command(description="View the current rank of the paid packs.") +@rank.command(name="paid", description="View the current rank of the paid packs.") async def paid(ctx: discord.ApplicationContext): await slash_parser(ctx, "rank paid") diff --git a/bots/discord/slash/ask.py b/bots/discord/slash/ask.py index 4cd3fefec9..143c3e5efe 100644 --- a/bots/discord/slash/ask.py +++ b/bots/discord/slash/ask.py @@ -4,7 +4,7 @@ from bots.discord.slash_parser import slash_parser -@client.slash_command(description="Answer your question via ChatGPT.") +@client.slash_command(name="ask", description="Answer your question via ChatGPT.") @discord.option(name="question", description="Ask ChatGPT.") async def ask(ctx: discord.ApplicationContext, question: str): await slash_parser(ctx, question) \ No newline at end of file diff --git a/bots/discord/slash/bugtracker.py b/bots/discord/slash/bugtracker.py index c874fac882..10db5cdf8e 100644 --- a/bots/discord/slash/bugtracker.py +++ b/bots/discord/slash/bugtracker.py @@ -9,7 +9,7 @@ async def auto_search(ctx: discord.AutocompleteContext): return ['BDS-', 'MCPE-', 'MCD-', 'MCL-', 'MCLG-', 'REALMS-', 'MC-', 'WEB-'] -@client.command(description="Query the corresponding ticket on Mojira.") +@client.command(name="bugtracker", description="Query the corresponding ticket on Mojira.") @discord.option(name="mojiraid", autocomplete=auto_search) async def bugtracker(ctx: discord.ApplicationContext, mojiraid: str): await slash_parser(ctx, mojiraid) diff --git a/bots/discord/slash/color.py b/bots/discord/slash/color.py index f9905bc61b..d46ac39d95 100644 --- a/bots/discord/slash/color.py +++ b/bots/discord/slash/color.py @@ -9,7 +9,7 @@ async def auto_complete(ctx: discord.AutocompleteContext): return ['#123456', 'rgb(12,34,56)', 'hsl(123,45%,67%)'] -@client.slash_command(description="Get color information.") +@client.slash_command(name="color", description="Get color information.") @discord.option(name="color", default="", autocomplete=auto_complete, description="Color information. Support for Hex, RGB, HSL color code, or name in CSS and Material Design.") async def color(ctx: discord.ApplicationContext, color: str): diff --git a/bots/discord/slash/core.py b/bots/discord/slash/core.py index aca679a95b..2b508febc0 100644 --- a/bots/discord/slash/core.py +++ b/bots/discord/slash/core.py @@ -2,40 +2,53 @@ from bots.discord.client import client from bots.discord.slash_parser import slash_parser +from core.loader import ModulesManager +from core.utils.i18n import get_available_locales -@client.slash_command(description="View details of a module.") -@discord.option(name="module", default="", description="The module you want to know about.") -async def help(ctx: discord.ApplicationContext, module: str): - await slash_parser(ctx, module) +async def auto_get_module_list(ctx: discord.AutocompleteContext): + module_list = ModulesManager.return_modules_list() + module_ = [] + for x in module_list: + if x[0] == '_': + continue + if module_list[x].required_superuser or module_list[x].required_base_superuser: + continue + module_.append(module_list[x]) + return module_ + + +async def auto_get_lang(ctx: discord.AutocompleteContext): + if not ctx.options["lang"]: + return get_available_locales() -@client.slash_command(description="Set the bot running languages.") -@discord.option(name="lang", default="", description="Supported language codes.") +@client.slash_command(name="locale", description="Set the bot running languages.") +@discord.option(name="lang", default="", description="Supported language codes.", autocomplete=auto_get_lang) async def locale(ctx: discord.ApplicationContext, lang: str): await slash_parser(ctx, lang) -@client.slash_command(description="Make the bot stop sending message.") +@client.slash_command(name="mute", description="Make the bot stop sending message.") async def mute(ctx: discord.ApplicationContext): await slash_parser(ctx, "") -@client.slash_command(description="Get bot status.") +@client.slash_command(name="ping", description="Get bot status.") async def ping(ctx: discord.ApplicationContext): await slash_parser(ctx, "") -@client.slash_command(description="Get the number of petals in the current channel.") +@client.slash_command(name="petal", description="Get the number of petals in the current channel.") async def petal(ctx: discord.ApplicationContext): await slash_parser(ctx, "") -@client.slash_command(description="View bot version.") +@client.slash_command(name="version", description="View bot version.") async def version(ctx: discord.ApplicationContext): await slash_parser(ctx, "") -@client.slash_command(description="Get the ID of the user account that sent the command inside the bot.") +@client.slash_command(name="whoami", description="Get the ID of the user account that sent the command inside the bot.") async def whoami(ctx: discord.ApplicationContext): await slash_parser(ctx, "") @@ -43,30 +56,30 @@ async def whoami(ctx: discord.ApplicationContext): admin = client.create_group("admin", "Commands available to bot administrators.") -@admin.command(description="Set members as bot administrators.") +@admin.command(name="add", description="Set members as bot administrators.") @discord.option(name="userid", description="The user ID.") async def add(ctx: discord.ApplicationContext, userid: str): await slash_parser(ctx, f"add {userid}") -@admin.command(description="Remove bot administrator from member.") +@admin.command(name="remove", description="Remove bot administrator from member.") @discord.option(name="userid", description="The user ID.") async def remove(ctx: discord.ApplicationContext, userid: str): await slash_parser(ctx, f"remove {userid}") -@admin.command(description="View all bot administrators.") -async def list(ctx: discord.ApplicationContext): +@admin.command(name="list", description="View all bot administrators.") +async def lst(ctx: discord.ApplicationContext): await slash_parser(ctx, "list") -@admin.command(description="Limit someone to use bot in the channel.") +@admin.command(name="ban", description="Limit someone to use bot in the channel.") @discord.option(name="userid", description="The user ID.") async def ban(ctx: discord.ApplicationContext, userid: str): await slash_parser(ctx, f"ban {userid}") -@admin.command(description="Remove limit someone to use bot in the channel.") +@admin.command(name="unban", description="Remove limit someone to use bot in the channel.") @discord.option(name="userid", description="The user ID.") async def unban(ctx: discord.ApplicationContext, userid: str): await slash_parser(ctx, f"unban {userid}") @@ -75,50 +88,90 @@ async def unban(ctx: discord.ApplicationContext, userid: str): ali = client.create_group("alias", "Set custom command alias.") -@ali.command(description="Add custom command alias.") +@ali.command(name="add", description="Add custom command alias.") @discord.option(name="alias", description="The custom alias.") @discord.option(name="command", description="The command you want to refer to.") async def add(ctx: discord.ApplicationContext, alias: str, command: str): await slash_parser(ctx, f"add {alias} {command}") -@ali.command(description="Remove custom command alias.") +@ali.command(name="remove", description="Remove custom command alias.") @discord.option(name="alias", description="The custom alias.") async def remove(ctx: discord.ApplicationContext, alias: str): await slash_parser(ctx, f"remove {alias}") -@ali.command(description="View custom command alias.") -async def list(ctx: discord.ApplicationContext): - await slash_parser(ctx, "list") +@ali.command(name="list", description="View custom command alias.") +@discord.option(name="legacy", choices=['false', 'true'], description="Whether to use legacy mode.") +async def lst(ctx: discord.ApplicationContext, legacy: str): + legacy = "legacy" if legacy == "true" else "" + await slash_parser(ctx, f"list {legacy}") -@ali.command(description="Reset custom command alias.") +@ali.command(name="reset", description="Reset custom command alias.") async def reset(ctx: discord.ApplicationContext): await slash_parser(ctx, "reset") +hlp = client.create_group("help", "Get bot help.") + + +@hlp.command(name="list", description="View help list.") +@discord.option(name="legacy", choices=['false', 'true'], description="Whether to use legacy mode.") +async def lst(ctx: discord.ApplicationContext, legacy: str): + legacy = "legacy" if legacy == "true" else "" + await slash_parser(ctx, legacy) + + +@hlp.command(name="detail", description="View details of a module.") +@discord.option(name="module", description="The module you want to know about.", autocomplete=auto_get_module_list) +async def detail(ctx: discord.ApplicationContext, module: str): + await slash_parser(ctx, module) + + +m = client.create_group("module", "Set about modules.") + + +@m.command(name="enable", description="Enable module(s).") +@discord.option(name="module", description="The modules you want to enable.", autocomplete=auto_get_module_list) +async def add(ctx: discord.ApplicationContext, module: str): + await slash_parser(ctx, f"enable {module}") + + +@m.command(name="disable", description="Disable module(s).") +@discord.option(name="module", description="The modules you want to disable.", autocomplete=auto_get_module_list) +async def add(ctx: discord.ApplicationContext, module: str): + await slash_parser(ctx, f"disable {module}") + + +@m.command(name="list", description="View all available modules.") +@discord.option(name="legacy", choices=['false', 'true'], description="Whether to use legacy mode.") +async def lst(ctx: discord.ApplicationContext, legacy: str): + legacy = "legacy" if legacy == "true" else "" + await slash_parser(ctx, f"list {legacy}") + + p = client.create_group("prefix", "Set custom command prefix.") -@p.command(description="Add custom command prefix.") +@p.command(name="add", description="Add custom command prefix.") @discord.option(name="prefix", description="The custom prefix.") async def add(ctx: discord.ApplicationContext, prefix: str): await slash_parser(ctx, f"add {prefix}") -@p.command(description="Remove custom command prefix.") +@p.command(name="remove", description="Remove custom command prefix.") @discord.option(name="prefix", description="The custom prefix.") async def remove(ctx: discord.ApplicationContext, prefix: str): await slash_parser(ctx, f"remove {prefix}") -@p.command(description="View custom command prefix.") -async def list(ctx: discord.ApplicationContext): +@p.command(name="list", description="View custom command prefix.") +async def lst(ctx: discord.ApplicationContext): await slash_parser(ctx, "list") -@p.command(description="Reset custom command prefix.") +@p.command(name="reset", description="Reset custom command prefix.") async def reset(ctx: discord.ApplicationContext): await slash_parser(ctx, "reset") @@ -126,12 +179,12 @@ async def reset(ctx: discord.ApplicationContext): setup = client.create_group("setup", "Set up bot actions.") -@setup.command(description="Set up whether to display input prompts.") +@setup.command(name="typing", description="Set up whether to display input prompts.") async def typing(ctx: discord.ApplicationContext): await slash_parser(ctx, "typing") -@setup.command(description="Set the time offset.") +@setup.command(name="timeoffset", description="Set the time offset.") @discord.option(name="offset", description="The timezone offset.") async def offset(ctx: discord.ApplicationContext, offset: str): await slash_parser(ctx, f"timeoffset {offset}") diff --git a/bots/discord/slash/cytoid.py b/bots/discord/slash/cytoid.py index f0bc3b8c61..df5f276caa 100644 --- a/bots/discord/slash/cytoid.py +++ b/bots/discord/slash/cytoid.py @@ -6,27 +6,27 @@ cytoid = client.create_group("cytoid", "Query about Cytoid.") -@cytoid.command(description="Query the Best 30 list.") +@cytoid.command(name="b30", description="Query the Best 30 list.") async def b30(ctx: discord.ApplicationContext): await slash_parser(ctx, "b30") -@cytoid.command(description="Query the Recent 30 list.") +@cytoid.command(name="r30", description="Query the Recent 30 list.") async def r30(ctx: discord.ApplicationContext): await slash_parser(ctx, "r30") -@cytoid.command(description="Query user profile.") +@cytoid.command(name="profile", description="Query user profile.") async def profile(ctx: discord.ApplicationContext): await slash_parser(ctx, "profile") -@cytoid.command(description="Bind user.") +@cytoid.command(name="bind", description="Bind user.") @discord.option(name="username", description="Your Cytoid username.") async def bind(ctx: discord.ApplicationContext, username: str): await slash_parser(ctx, f"bind {username}") -@cytoid.command(description="Unbind user.") +@cytoid.command(name="unbind", description="Unbind user.") async def unbind(ctx: discord.ApplicationContext): await slash_parser(ctx, "unbind") diff --git a/bots/discord/slash/dice.py b/bots/discord/slash/dice.py index e61abdb35e..dc6961f9a8 100644 --- a/bots/discord/slash/dice.py +++ b/bots/discord/slash/dice.py @@ -12,13 +12,13 @@ async def auto_complete(ctx: discord.AutocompleteContext): dice = client.create_group("dice", "Random dice.") -@dice.command(description="Roll the specified dice.") +@dice.command(name="roll", description="Roll the specified dice.") @discord.option(name="dices", autocomplete=auto_complete, description="Dice expression.") @discord.option(name="dc", default="", description="Difficulty class.") async def roll(ctx: discord.ApplicationContext, dices: str, dc: str): await slash_parser(ctx, f'{dices} {dc}') -@dice.command(description="Modify the checking rule of dc.") +@dice.command(name="rule", description="Modify the checking rule of dc.") async def rule(ctx: discord.ApplicationContext): await slash_parser(ctx, 'rule') diff --git a/bots/discord/slash/exchange_rate.py b/bots/discord/slash/exchange_rate.py index 04dd9f432d..061e5228f1 100644 --- a/bots/discord/slash/exchange_rate.py +++ b/bots/discord/slash/exchange_rate.py @@ -3,9 +3,9 @@ from bots.discord.client import client from bots.discord.slash_parser import slash_parser -@client.slash_command(description="Convert currency prices according to the exchange rate of the day.") +@client.slash_command(name="exchange_rate", description="Convert currency prices according to the exchange rate of the day.") @discord.option(name="amount", description="The amount of base currency.") @discord.option(name="base", description="The base currency unit.") @discord.option(name="target", description="The target currency unit.") -async def exchange_rate(ctx: discord.ApplicationContext, amount: float, base: str, target: str): +async def excr(ctx: discord.ApplicationContext, amount: float, base: str, target: str): await slash_parser(ctx, f"{amount}{base} {target}") diff --git a/bots/discord/slash/github.py b/bots/discord/slash/github.py index e3d11e191d..27fd349bcb 100644 --- a/bots/discord/slash/github.py +++ b/bots/discord/slash/github.py @@ -7,25 +7,25 @@ github = client.create_group("github", "Github query tool.") -@github.command(description="Trying to automatically identifying and distinguishing repo/user.") +@github.command(name="get", description="Trying to automatically identifying and distinguishing repo/user.") @discord.option(name="name", description="GitHub user or repository name.") async def get(ctx: discord.ApplicationContext, name: str): await slash_parser(ctx, name) -@github.command(description="Get GitHub repository information.") +@github.command(name="repo", description="Get GitHub repository information.") @discord.option(name="name", description="GitHub repository name.") async def repo(ctx: discord.ApplicationContext, name: str): await slash_parser(ctx, f'repo {name}') -@github.command(description="Get GitHub user or organization information.") +@github.command(name="user", description="Get GitHub user or organization information.") @discord.option(name="name", description="GitHub user name.") async def user(ctx: discord.ApplicationContext, name: str): await slash_parser(ctx, f'user {name}') -@github.command(description="Search repositories on GitHub.") +@github.command(name="search", description="Search repositories on GitHub.") @discord.option(name="query", description="Search keywords.") async def search(ctx: discord.ApplicationContext, query: str): await slash_parser(ctx, f'search {keyword}') diff --git a/bots/discord/slash/idlist.py b/bots/discord/slash/idlist.py deleted file mode 100644 index acb5fecc2f..0000000000 --- a/bots/discord/slash/idlist.py +++ /dev/null @@ -1,28 +0,0 @@ -import urllib.parse - -import discord - -from bots.discord.client import client -from bots.discord.slash_parser import slash_parser -from core.utils.http import get_url - -api = 'https://ca.projectxero.top/idlist/search' - - -async def auto_search(ctx: discord.AutocompleteContext): - title = ctx.options["keywords"] - query_options = {'q': title, 'limit': '5'} - query_url = api + '?' + urllib.parse.urlencode(query_options) - resp = await get_url(query_url, 200, fmt='json') - result_ = resp['data']['result'] - results = [title] - if result_: - for x in result_: - results.append(f'{x["enumName"]} {x["key"]}') - return results - - -@client.slash_command(description="查询MCBEID表") -@discord.option(name="keywords", description="关键词", autocomplete=auto_search) -async def idlist(ctx: discord.ApplicationContext, keywords: str): - await slash_parser(ctx, keywords) diff --git a/bots/discord/slash/ip.py b/bots/discord/slash/ip.py index 2c6932ddb3..a6ccce477f 100644 --- a/bots/discord/slash/ip.py +++ b/bots/discord/slash/ip.py @@ -4,7 +4,7 @@ from bots.discord.slash_parser import slash_parser -@client.slash_command(description="Query the information of IP.") +@client.slash_command(name="ip", description="Query the information of IP.") @discord.option(name="ip_address", description="The IP address.") async def ip(ctx: discord.ApplicationContext, ip_address: str): await slash_parser(ctx, ip_address) diff --git a/bots/discord/slash/mcplayer.py b/bots/discord/slash/mcplayer.py index babaeed3d8..665f5a1823 100644 --- a/bots/discord/slash/mcplayer.py +++ b/bots/discord/slash/mcplayer.py @@ -4,7 +4,7 @@ from bots.discord.slash_parser import slash_parser -@client.slash_command(description="Get Minecraft player information.") +@client.slash_command(name="mcplayer", description="Get Minecraft player information.") @discord.option(name="username_or_uuid", description="The name or UUID of Minecraft player.") async def mcplayer(ctx: discord.ApplicationContext, username_or_uuid: str): await slash_parser(ctx, username_or_uuid) diff --git a/bots/discord/slash/mcv.py b/bots/discord/slash/mcv.py index b41cd91a98..bd00978845 100644 --- a/bots/discord/slash/mcv.py +++ b/bots/discord/slash/mcv.py @@ -4,26 +4,26 @@ from bots.discord.slash_parser import slash_parser -@client.slash_command(description="Get the latest version of Minecraft: Java Edition in the launcher.") +@client.slash_command(name="mcv", description="Get the latest version of Minecraft: Java Edition in the launcher.") async def mcv(ctx: discord.ApplicationContext): await slash_parser(ctx, '') -@client.slash_command(description="Get the latest version of Minecraft: Bedrock Edition on Mojira.") +@client.slash_command(name="mcbv", description="Get the latest version of Minecraft: Bedrock Edition on Mojira.") async def mcbv(ctx: discord.ApplicationContext): await slash_parser(ctx, '') -@client.slash_command(description="Get the latest version of Minecraft Dungeons on Mojira.") +@client.slash_command(name="mcdv", description="Get the latest version of Minecraft Dungeons on Mojira.") async def mcdv(ctx: discord.ApplicationContext): await slash_parser(ctx, '') -@client.slash_command(description="Get the latest version of Minecraft: Education Edition in Windows Edition.") +@client.slash_command(name="mcev", description="Get the latest version of Minecraft: Education Edition in Windows Edition.") async def mcev(ctx: discord.ApplicationContext): await slash_parser(ctx, '') -@client.slash_command(description="Get the latest version of Minecraft Legends on Mojira.") +@client.slash_command(name="mclgv", description="Get the latest version of Minecraft Legends on Mojira.") async def mclgv(ctx: discord.ApplicationContext): await slash_parser(ctx, '') \ No newline at end of file diff --git a/bots/discord/slash/server.py b/bots/discord/slash/server.py index 02ea118c1d..8846884d73 100644 --- a/bots/discord/slash/server.py +++ b/bots/discord/slash/server.py @@ -10,7 +10,7 @@ async def auto_search(ctx: discord.AutocompleteContext): return [ctx.options["address"]] -@client.slash_command(description="Get Minecraft: Java/Bedrock Edition server motd.") +@client.slash_command(name="server", description="Get Minecraft: Java/Bedrock Edition server motd.") @discord.option(name="address", description="The server address.", autocomplete=auto_search) async def server(ctx: discord.ApplicationContext, address: str): await slash_parser(ctx, address) diff --git a/bots/discord/slash/tweet.py b/bots/discord/slash/tweet.py index fb1ccdf7f2..ff037e8845 100644 --- a/bots/discord/slash/tweet.py +++ b/bots/discord/slash/tweet.py @@ -3,7 +3,7 @@ from bots.discord.client import client from bots.discord.slash_parser import slash_parser -@client.slash_command(description="Get tweet image from tweet ID or link.") -@discord.option(name="tweet", description="The tweet ID or tweet link.") +@client.slash_command(name="tweet", description="Get tweet image from tweet ID or link.") +@discord.option(name="tweetid", description="The tweet ID or tweet link.") async def tweet(ctx: discord.ApplicationContext, tweetid: str): await slash_parser(ctx, tweet) diff --git a/bots/discord/slash/whois.py b/bots/discord/slash/whois.py index 24385d99ed..f58af5533d 100644 --- a/bots/discord/slash/whois.py +++ b/bots/discord/slash/whois.py @@ -4,7 +4,7 @@ from bots.discord.slash_parser import slash_parser -@client.slash_command(description="Query the information of WHOIS.") +@client.slash_command(name="whois", description="Query the information of WHOIS.") @discord.option(name="domain", description="The domain.") async def whois(ctx: discord.ApplicationContext, domain: str): await slash_parser(ctx, domain) diff --git a/bots/discord/slash/wiki.py b/bots/discord/slash/wiki.py index a09c1557fd..d2df9cf9ab 100644 --- a/bots/discord/slash/wiki.py +++ b/bots/discord/slash/wiki.py @@ -59,7 +59,7 @@ async def default_wiki(ctx: discord.AutocompleteContext): return ['https://zh.minecraft.wiki/'] -@wiki.command(description="Query a wiki page.") +@wiki.command(name="query", description="Query a wiki page.") @discord.option(name="pagename", description="The title of wiki page.", autocomplete=auto_search) async def query(ctx: discord.ApplicationContext, pagename: str): await slash_parser(ctx, pagename) @@ -71,7 +71,7 @@ async def byid(ctx: discord.ApplicationContext, pageid: str): await slash_parser(ctx, f'id {pageid}') -@wiki.command(description="Search a wiki page.") +@wiki.command(name="search", description="Search a wiki page.") @discord.option(name="pagename", description="The title of wiki page.", autocomplete=auto_search) async def search(ctx: discord.ApplicationContext, pagename: str): await slash_parser(ctx, f'search {pagename}') @@ -100,12 +100,13 @@ async def iwremove(ctx: discord.ApplicationContext, interwiki: str): @iw.command(name="list", description="Lists the currently configured Interwiki.") -@discord.option(name="legacy", choices=[('true', 'legacy'), ('false', '')], description="Whether to use legacy mode.") +@discord.option(name="legacy", choices=['false', 'true'], description="Whether to use legacy mode.") async def iw_list(ctx: discord.ApplicationContext, legacy: str): + legacy = "legacy" if legacy == "true" else "" await slash_parser(ctx, f'iw list {legacy}') -@iw.command(name="show", description="Get the API address corresponding to the set Interwiki.") +@iw.command(name="get", description="Get the API address corresponding to the set Interwiki.") @discord.option(name="interwiki", description="The custom Interwiki.", autocomplete=auto_get_custom_iw_list) async def get(ctx: discord.ApplicationContext, interwiki: str): await slash_parser(ctx, f'iw get {interwiki}') @@ -150,11 +151,11 @@ async def reset_prefix(ctx: discord.ApplicationContext): await slash_parser(ctx, 'prefix reset') -@wiki.command(description="Toggle whether to use Fandom global Interwiki queries.") +@wiki.command(name="fandom", description="Toggle whether to use Fandom global Interwiki queries.") async def fandom(ctx: discord.ApplicationContext): await slash_parser(ctx, 'fandom') -@wiki.command(description="Toggle whether to return the edit link when the page does not exist.") +@wiki.command(name="redlink", description="Toggle whether to return the edit link when the page does not exist.") async def redlink(ctx: discord.ApplicationContext): await slash_parser(ctx, 'redlink') diff --git a/bots/discord/slash/wolframalpha.py b/bots/discord/slash/wolframalpha.py index 33651d9bac..768cf2da26 100644 --- a/bots/discord/slash/wolframalpha.py +++ b/bots/discord/slash/wolframalpha.py @@ -6,13 +6,13 @@ wolframalpha = client.create_group("wolframalpha", "Use WolframAlpha.") -@wolframalpha.command(description="Input a question or formula to search for WolframAlpha.") +@wolframalpha.command(name="query", description="Input a question or formula to search for WolframAlpha.") @discord.option(name="query", description="Enter what you want to calculate.") async def query(ctx: discord.ApplicationContext, query: str): await slash_parser(ctx, query) -@wolframalpha.command(description="Answer the question via WolframAlpha.") +@wolframalpha.command(name="ask", description="Answer the question via WolframAlpha.") @discord.option(name="question", description="Ask WolframAlpha.") async def ask(ctx: discord.ApplicationContext, question: str): await slash_parser(ctx, f"ask {question}") \ No newline at end of file diff --git a/modules/core/alias.py b/modules/core/alias.py index c007cd1941..40300724fe 100644 --- a/modules/core/alias.py +++ b/modules/core/alias.py @@ -1,4 +1,4 @@ -from core.builtins import Bot, Image, command_prefix +from core.builtins import Bot, Image from core.component import module from core.utils.image_table import image_table_render, ImageTable @@ -25,7 +25,7 @@ async def set_alias(msg: Bot.MessageSession): break if not has_prefix: await msg.finish(msg.locale.t("core.message.alias.add.invalid_prefix")) - command = command_prefix[0] + command[1:] + command = msg.prefixes[0] + command[1:] aliases[alias] = command msg.data.edit_option('command_alias', aliases) await msg.finish(msg.locale.t("core.message.alias.add.success", alias=alias, command=command)) diff --git a/modules/core/utils.py b/modules/core/utils.py index e185e1f9cb..bd2b286aa1 100644 --- a/modules/core/utils.py +++ b/modules/core/utils.py @@ -132,7 +132,7 @@ async def config_ban(msg: Bot.MessageSession): async def _(msg: Bot.MessageSession): avaliable_lang = msg.locale.t("message.delimiter").join(get_available_locales()) await msg.finish( - f"{msg.locale.t('core.message.locale')}{msg.locale.t('language')}\n{msg.locale.t('core.message.locale.set.prompt', langlist=avaliable_lang, prefix=command_prefix[0])}") + f"{msg.locale.t('core.message.locale')}{msg.locale.t('language')}\n{msg.locale.t('core.message.locale.set.prompt', langlist=avaliable_lang, prefix=msg.prefixes[0])}") @locale.command(' {{core.help.locale.set}}', required_admin=True) diff --git a/modules/maimai/__init__.py b/modules/maimai/__init__.py index 05855f30a9..e25e7db4a6 100644 --- a/modules/maimai/__init__.py +++ b/modules/maimai/__init__.py @@ -2,7 +2,7 @@ import traceback from config import Config -from core.builtins import Bot, command_prefix, Plain, Image as BImage +from core.builtins import Bot, Plain, Image as BImage from core.scheduler import CronTrigger from core.utils.image import msgchain2image from modules.maimai.libraries.maimai_best_50 import generate @@ -454,7 +454,7 @@ async def _(msg: Bot.MessageSession, diff: str, sid: str, score: float): b2t_2000_great=b2t_2000_great, b2t_2000_great_prop=b2t_2000_great_prop)}''') except ValueError: - await msg.finish(msg.locale.t('maimai.message.scoreline.error', prefix=command_prefix[0])) + await msg.finish(msg.locale.t('maimai.message.scoreline.error', prefix=msg.prefixes[0])) @mai.command('rating {{maimai.help.rating}}') diff --git a/modules/wiki/locales/en_us.json b/modules/wiki/locales/en_us.json index 70386d5652..1e4564d61e 100644 --- a/modules/wiki/locales/en_us.json +++ b/modules/wiki/locales/en_us.json @@ -4,11 +4,11 @@ "wiki.help": "Query a wiki page.", "wiki.help.ab": "Get recent abuse logs for the default wiki.", "wiki.help.ab.legacy": "Get recent abuse logs for the default wiki. (Legacy)", - "wiki.help.fandom": "Toggles whether to use Fandom global Interwiki queries.", + "wiki.help.fandom": "Toggle whether to use Fandom global Interwiki queries.", "wiki.help.headers.remove": "Remove custom request headers.", "wiki.help.headers.reset": "Reset custom request headers.", "wiki.help.headers.add": "Add custom request headers.", - "wiki.help.headers.show": "Lists the currently set request headers.", + "wiki.help.headers.show": "View the currently set request headers.", "wiki.help.id": "Query a Wiki page based on page ID.", "wiki.help.iw.add": "Add custom Interwiki.", "wiki.help.iw.get": "Get the API address corresponding to the set Interwiki.",