3
"Project-Id-Version: discordpy\n"
4
"Report-Msgid-Bugs-To: \n"
5
"POT-Creation-Date: 2019-06-22 09:35-0400\n"
6
"PO-Revision-Date: 2020-10-24 02:41\n"
8
"Language-Team: Japanese\n"
10
"Content-Type: text/plain; charset=UTF-8\n"
11
"Content-Transfer-Encoding: 8bit\n"
12
"Plural-Forms: nplurals=1; plural=0;\n"
13
"X-Crowdin-Project: discordpy\n"
14
"X-Crowdin-Project-ID: 362783\n"
15
"X-Crowdin-Language: ja\n"
16
"X-Crowdin-File: /ext/commands/cogs.pot\n"
17
"X-Crowdin-File-ID: 60\n"
20
#: ../../ext/commands/cogs.rst:6
24
#: ../../ext/commands/cogs.rst:8
25
msgid "There comes a point in your bot's development when you want to organize a collection of commands, listeners, and some state into one class. Cogs allow you to do just that."
26
msgstr "Bot開発においてコマンドやリスナー、いくつかの状態を一つのクラスにまとめてしまいたい場合があるでしょう。コグはそれを実現したものです。"
28
#: ../../ext/commands/cogs.rst:10
32
#: ../../ext/commands/cogs.rst:12
33
msgid "Each cog is a Python class that subclasses :class:`.commands.Cog`."
34
msgstr "すべてのコグは :class:`.commands.Cog` を継承したPythonクラスです。"
36
#: ../../ext/commands/cogs.rst:13
37
msgid "Every command is marked with the :func:`.commands.command` decorator."
38
msgstr "すべてのコマンドは :func:`.commands.command` デコレータでデコレートされます。"
40
#: ../../ext/commands/cogs.rst:14
41
msgid "Every listener is marked with the :meth:`.commands.Cog.listener` decorator."
42
msgstr "すべてのリスナーは :meth:`.commands.Cog.listener` デコレータでデコレートされます。"
44
#: ../../ext/commands/cogs.rst:15
45
msgid "Cogs are then registered with the :meth:`.Bot.add_cog` call."
46
msgstr "コグは :meth:`.Bot.add_cog` を呼び出して登録します。"
48
#: ../../ext/commands/cogs.rst:16
49
msgid "Cogs are subsequently removed with the :meth:`.Bot.remove_cog` call."
50
msgstr "コグは :meth:`.Bot.remove_cog` の呼び出しで削除されます。"
52
#: ../../ext/commands/cogs.rst:18
53
msgid "It should be noted that cogs are typically used alongside with :ref:`ext_commands_extensions`."
54
msgstr "コグは :ref:`ext_commands_extensions` とともに使用されるのが一般的であることを覚えておきましょう。"
56
#: ../../ext/commands/cogs.rst:21
60
#: ../../ext/commands/cogs.rst:23
61
msgid "This example cog defines a ``Greetings`` category for your commands, with a single :ref:`command <ext_commands_commands>` named ``hello`` as well as a listener to listen to an :ref:`Event <disnake-api-events>`."
62
msgstr "この例で紹介するコグは ``hello`` という名前の :ref:`command <ext_commands_commands>` と、 :ref:`Event <disnake-api-events>` をリッスンするリスナーを実装した ``Greetings`` という名前のコマンドカテゴリを定義しています。"
64
#: ../../ext/commands/cogs.rst:48
65
msgid "A couple of technical notes to take into consideration:"
66
msgstr "考慮すべき二つのテクニカルノート:"
68
#: ../../ext/commands/cogs.rst:50
69
msgid "All listeners must be explicitly marked via decorator, :meth:`~.commands.Cog.listener`."
70
msgstr "すべてのリスナーは :meth:`~.commands.Cog.listener` で明示的にデコレートする必要があります。"
72
#: ../../ext/commands/cogs.rst:51
73
msgid "The name of the cog is automatically derived from the class name but can be overridden. See :ref:`ext_commands_cogs_meta_options`."
74
msgstr "コグの名前は、自動的にクラスの名前が引用されますが、上書きも可能です。 :ref:`ext_commands_cogs_meta_options` を参照してください。"
76
#: ../../ext/commands/cogs.rst:52
77
msgid "All commands must now take a ``self`` parameter to allow usage of instance attributes that can be used to maintain state."
78
msgstr "すべてのコマンドは状態を保持するインスタンスの属性を使用するために ``self`` パラメータを持つ必要があります。"
80
#: ../../ext/commands/cogs.rst:55
81
msgid "Cog Registration"
84
#: ../../ext/commands/cogs.rst:57
85
msgid "Once you have defined your cogs, you need to tell the bot to register the cogs to be used. We do this via the :meth:`~.commands.Bot.add_cog` method."
86
msgstr "コグを定義したら、Botにコグを登録する処理が必要になります。 :meth:`~.commands.Bot.add_cog` メソッドを用いて登録ができます。"
88
#: ../../ext/commands/cogs.rst:63
89
msgid "This binds the cog to the bot, adding all commands and listeners to the bot automatically."
90
msgstr "これはコグとBotを紐づけ、すべてのコマンドとリスナーを自動的にBotに追加します。"
92
#: ../../ext/commands/cogs.rst:65
93
msgid "Note that we reference the cog by name, which we can override through :ref:`ext_commands_cogs_meta_options`. So if we ever want to remove the cog eventually, we would have to do the following."
94
msgstr "コグを名前で参照している点に注意してください。これは :ref:`ext_commands_cogs_meta_options` でオーバーライドが可能です。そのため、最終的にコグを削除したい場合は、次の処理を行う必要があります。"
96
#: ../../ext/commands/cogs.rst:72
100
#: ../../ext/commands/cogs.rst:74
101
msgid "Just as we remove a cog by its name, we can also retrieve it by its name as well. This allows us to use a cog as an inter-command communication protocol to share data. For example:"
102
msgstr "コグを名前で削除するのと同様に、名前でコグを検索することもできます。これによってコグをデータ共有のためのコマンド間通信プロトコルとして使うことができます。例えば:"
104
#: ../../ext/commands/cogs.rst:109
105
msgid "Special Methods"
108
#: ../../ext/commands/cogs.rst:111
109
msgid "As cogs get more complicated and have more commands, there comes a point where we want to customise the behaviour of the entire cog or bot."
110
msgstr "コグが複雑化し、多くのコマンドを持つようになるにつれ、コグあるいはBot全体の挙動をカスタマイズしたくなることがあります。"
112
#: ../../ext/commands/cogs.rst:113
113
msgid "They are as follows:"
114
msgstr "そのための特殊なメソッドは以下のとおりです:"
116
#: ../../ext/commands/cogs.rst:115
117
msgid ":meth:`.Cog.cog_unload`"
118
msgstr ":meth:`.Cog.cog_unload`"
120
#: ../../ext/commands/cogs.rst:116
121
msgid ":meth:`.Cog.cog_check`"
122
msgstr ":meth:`.Cog.cog_check`"
124
#: ../../ext/commands/cogs.rst:117
125
msgid ":meth:`.Cog.cog_command_error`"
126
msgstr ":meth:`.Cog.cog_command_error`"
128
#: ../../ext/commands/cogs.rst:118
129
msgid ":meth:`.Cog.cog_before_invoke`"
130
msgstr ":meth:`.Cog.cog_before_invoke`"
132
#: ../../ext/commands/cogs.rst:119
133
msgid ":meth:`.Cog.cog_after_invoke`"
134
msgstr ":meth:`.Cog.cog_after_invoke`"
136
#: ../../ext/commands/cogs.rst:120
137
msgid ":meth:`.Cog.bot_check`"
138
msgstr ":meth:`.Cog.bot_check`"
140
#: ../../ext/commands/cogs.rst:121
141
msgid ":meth:`.Cog.bot_check_once`"
142
msgstr ":meth:`.Cog.bot_check_once`"
144
#: ../../ext/commands/cogs.rst:123
145
msgid "You can visit the reference to get more detail."
146
msgstr "詳細はリファレンスを参照してください。"
148
#: ../../ext/commands/cogs.rst:128
152
#: ../../ext/commands/cogs.rst:130
153
msgid "At the heart of a cog resides a metaclass, :class:`.commands.CogMeta`, which can take various options to customise some of the behaviour. To do this, we pass keyword arguments to the class definition line. For example, to change the cog name we can pass the ``name`` keyword argument as follows:"
154
msgstr "コグの中核にはメタクラスである :class:`.commands.CogMeta` が存在します。これにはいくつかの挙動を変更ができる様々なオプションが用意されています。オプションを使用する際はキーワード引数をクラス定義の行で渡します。例えば、コグの名前を変更する場合はキーワード引数 ``name`` を次のように渡します。"
156
#: ../../ext/commands/cogs.rst:137
157
msgid "To see more options that you can set, see the documentation of :class:`.commands.CogMeta`."
158
msgstr "設定可能な他のオプションについては :class:`.commands.CogMeta` のドキュメントを参照してください。"
160
#: ../../ext/commands/cogs.rst:140
164
#: ../../ext/commands/cogs.rst:142
165
msgid "Since cogs ultimately are classes, we have some tools to help us inspect certain properties of the cog."
166
msgstr "コグは究極的にはクラスのため、コグの特定のプロパティを調べるのに役立つツールがいくつか用意されています。"
168
#: ../../ext/commands/cogs.rst:145
169
msgid "To get a :class:`list` of commands, we can use :meth:`.Cog.get_commands`. ::"
170
msgstr ":meth:`.Cog.get_commands` を使うことで、コマンドの :class:`list` を取得できます。"
172
#: ../../ext/commands/cogs.rst:151
173
msgid "If we want to get the subcommands as well, we can use the :meth:`.Cog.walk_commands` generator. ::"
174
msgstr "サブコマンドを取得したい場合は :meth:`.Cog.walk_commands` ジェネレータを使うことができます。"
176
#: ../../ext/commands/cogs.rst:155
177
msgid "To do the same with listeners, we can query them with :meth:`.Cog.get_listeners`. This returns a list of tuples -- the first element being the listener name and the second one being the actual function itself. ::"
178
msgstr "これ同様の処理をリスナーで行う場合は、 :meth:`.Cog.get_listeners` が使用できます。これはタプルのリストを返します -- 最初の要素がリスナーの名前で、二つ目の要素が関数そのものです。"