Skip to content

Commit

Permalink
feat use en lang
Browse files Browse the repository at this point in the history
  • Loading branch information
a3510377 committed May 28, 2023
1 parent a3c1472 commit 410c443
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions plugins/discord/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,14 +110,14 @@ async def send_join_channel(
@Plugin.listener
async def on_player_joined(self, ctx: Context, player_name: str):
await self.send_join_channel(
f"{back_msg(player_name)} 加入了 {back_msg(ctx.display_name)}",
f"{back_msg(player_name)} joined {back_msg(ctx.display_name)}",
ctx=ctx,
)

@Plugin.listener
async def on_player_left(self, ctx: Context, player_name: str):
await self.send_join_channel(
f"{back_msg(player_name)} 離開了 {back_msg(ctx.display_name)}",
f"{back_msg(player_name)} left {back_msg(ctx.display_name)}",
ctx=ctx,
)

Expand Down
4 changes: 2 additions & 2 deletions server/base_plugin/commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,9 @@ async def on_command_plugin_add(self, name: str = MISSING):
try:
self.server.load_extension(f"{self.server.plugins_dir}.{name}")
except ExtensionAlreadyLoaded:
log.error("插劍已經加載, 若要重新加載請使用 plugin reload")
log.error("插件已經加載, 若要重新加載請使用 plugin reload")
except NoEntryPointError:
log.error("未找到插劍")
log.error("未找到插件")

@Plugin.listener
async def on_command_plugin_reload(self, name: str = MISSING):
Expand Down
8 changes: 4 additions & 4 deletions server/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ def _inject(self, server: "BaseServer") -> "Plugin":
for method_name in method_names:
server.add_listener(getattr(self, method_name), name)
finally:
server.log.info(f"加載插劍: [{self.__module__}] {self.__plugin_name__}")
server.log.info(f"加載插件: [{self.__module__}] {self.__plugin_name__}")
try:
self.on_load()
except Exception:
Expand All @@ -94,7 +94,7 @@ def _eject(self, server: "BaseServer") -> None:
try:
self.on_unload_before()
except Exception as e:
log.error(f"插劍 {self.__plugin_name__} on_unload_before 出錯: {e}")
log.error(f"插件 {self.__plugin_name__} on_unload_before 出錯: {e}")
pass

try:
Expand All @@ -105,7 +105,7 @@ def _eject(self, server: "BaseServer") -> None:
try:
self.on_unload()
except Exception as e:
log.error(f"插劍 {self.__plugin_name__} on_unload 出錯: {e}")
log.error(f"插件 {self.__plugin_name__} on_unload 出錯: {e}")
pass

def on_load(self) -> None:
Expand Down Expand Up @@ -160,7 +160,7 @@ def add_plugin(self, plugin: Plugin, *, override: bool = False) -> None:

if self.get_plugin(name) is not None:
if not override:
log.error(f"加載到相同名稱的插劍 {name}")
log.error(f"加載到相同名稱的插件 {name}")
raise ExtensionAlreadyLoaded(name)
self.remove_plugin(name)

Expand Down

0 comments on commit 410c443

Please sign in to comment.