disnake

Форк
0
899 строк · 39.0 Кб
1

2
msgid ""
3
msgstr ""
4
"Project-Id-Version:  discordpy\n"
5
"Report-Msgid-Bugs-To: \n"
6
"POT-Creation-Date: 2020-10-23 22:41-0400\n"
7
"PO-Revision-Date: 2020-10-24 02:41+0000\n"
8
"Last-Translator: \n"
9
"Language: ja_JP\n"
10
"Language-Team: Japanese\n"
11
"Plural-Forms: nplurals=1; plural=0\n"
12
"MIME-Version: 1.0\n"
13
"Content-Type: text/plain; charset=utf-8\n"
14
"Content-Transfer-Encoding: 8bit\n"
15
"Generated-By: Babel 2.5.3\n"
16

17
#: ../../ext/commands/commands.rst:6
18
msgid "Commands"
19
msgstr "コマンド"
20

21
#: ../../ext/commands/commands.rst:8
22
msgid ""
23
"One of the most appealing aspect of the command extension is how easy it "
24
"is to define commands and how you can arbitrarily nest groups and "
25
"commands to have a rich sub-command system."
26
msgstr "コマンド拡張の最も魅力的な機能の一つは、簡単にコマンドが定義でき、かつそのコマンドを好きなようにネスト状にして、豊富なサブコマンドを用意することができる点です。"
27

28
#: ../../ext/commands/commands.rst:11
29
msgid ""
30
"Commands are defined by attaching it to a regular Python function. The "
31
"command is then invoked by the user using a similar signature to the "
32
"Python function."
33
msgstr "コマンドは、Pythonの関数と関連付けすることによって定義され、同様のシグネチャを使用してユーザーに呼び出されます。"
34

35
#: ../../ext/commands/commands.rst:14
36
msgid "For example, in the given command definition:"
37
msgstr "例えば、指定されたコマンド定義を使うと次のようになります。"
38

39
#: ../../ext/commands/commands.rst:22
40
msgid "With the following prefix (``$``), it would be invoked by the user via:"
41
msgstr "Prefixを (``$``) としたとすると、このコマンドは次の用に実行できます。"
42

43
#: ../../ext/commands/commands.rst:28
44
msgid ""
45
"A command must always have at least one parameter, ``ctx``, which is the "
46
":class:`.Context` as the first one."
47
msgstr "コマンドには、少なくとも :class:`.Context` を渡すための引数 ``ctx`` が必要です。"
48

49
#: ../../ext/commands/commands.rst:30
50
msgid ""
51
"There are two ways of registering a command. The first one is by using "
52
":meth:`.Bot.command` decorator, as seen in the example above. The second "
53
"is using the :func:`~ext.commands.command` decorator followed by "
54
":meth:`.Bot.add_command` on the instance."
55
msgstr ""
56
"コマンドを登録するには二通りの方法があります。一つ目は :meth:`.Bot.command` を使用する方法で、二つ目が "
57
":func:`~ext.commands.command` デコレータを使用して :meth:`.Bot.add_command` "
58
"でインスタンスにコマンドを追加していく方法です。"
59

60
#: ../../ext/commands/commands.rst:34
61
msgid "Essentially, these two are equivalent: ::"
62
msgstr "本質的に、これら2つは同等になります: ::"
63

64
#: ../../ext/commands/commands.rst:52
65
msgid ""
66
"Since the :meth:`.Bot.command` decorator is shorter and easier to "
67
"comprehend, it will be the one used throughout the documentation here."
68
msgstr ":meth:`.Bot.command` が簡単かつ理解がしやすいので、ドキュメント上ではこちらを使っています。"
69

70
#: ../../ext/commands/commands.rst:55
71
msgid ""
72
"Any parameter that is accepted by the :class:`.Command` constructor can "
73
"be passed into the decorator. For example, to change the name to "
74
"something other than the function would be as simple as doing this:"
75
msgstr ""
76
":class:`.Command` "
77
"のコンストラクタの引数はデコレータに渡すことで利用できます。例えば、コマンドの名前を関数以外のものへと変更したい場合は以下のように簡単に設定することができます。"
78

79
#: ../../ext/commands/commands.rst:65
80
msgid "Parameters"
81
msgstr "パラメーター"
82

83
#: ../../ext/commands/commands.rst:67
84
msgid ""
85
"Since we define commands by making Python functions, we also define the "
86
"argument passing behaviour by the function parameters."
87
msgstr "Pythonの関数定義によって、同時にコマンドを定義するので、関数のパラメーターを設定することにより、コマンドの引数受け渡し動作も定義することができます。"
88

89
#: ../../ext/commands/commands.rst:70
90
msgid ""
91
"Certain parameter types do different things in the user side and most "
92
"forms of parameter types are supported."
93
msgstr "特定のパラメータタイプはユーザーサイドで異なる動作を行い、そしてほとんどの形式のパラメータタイプがサポートされています。"
94

95
#: ../../ext/commands/commands.rst:73
96
msgid "Positional"
97
msgstr "位置引数"
98

99
#: ../../ext/commands/commands.rst:75
100
msgid ""
101
"The most basic form of parameter passing is the positional parameter. "
102
"This is where we pass a parameter as-is:"
103
msgstr "最も基本的な引数は位置パラメーターです。与えられた値をそのまま渡します。"
104

105
#: ../../ext/commands/commands.rst:84
106
msgid ""
107
"On the bot using side, you can provide positional arguments by just "
108
"passing a regular string:"
109
msgstr "Botの使用者側は、通常の文字列を渡すだけで位置引数に値を渡すことができます。"
110

111
#: ../../ext/commands/commands.rst:88
112
msgid "To make use of a word with spaces in between, you should quote it:"
113
msgstr "間に空白を含む文字列を渡す場合は、文字列を引用符で囲む必要があります。"
114

115
#: ../../ext/commands/commands.rst:92
116
msgid ""
117
"As a note of warning, if you omit the quotes, you will only get the first"
118
" word:"
119
msgstr "引用符を用いなかった場合、最初の文字列のみが渡されます。"
120

121
#: ../../ext/commands/commands.rst:96
122
msgid ""
123
"Since positional arguments are just regular Python arguments, you can "
124
"have as many as you want:"
125
msgstr "位置引数は、Pythonの引数と同じものなので、好きなだけ設定することが可能です。"
126

127
#: ../../ext/commands/commands.rst:105
128
msgid "Variable"
129
msgstr "可変長引数"
130

131
#: ../../ext/commands/commands.rst:107
132
msgid ""
133
"Sometimes you want users to pass in an undetermined number of parameters."
134
" The library supports this similar to how variable list parameters are "
135
"done in Python:"
136
msgstr "場合によっては、可変長のパラメーターを設定したい場合もあるでしょう。このライブラリはPythonの可変長パラメーターと同様にこれをサポートしています。"
137

138
#: ../../ext/commands/commands.rst:116
139
msgid ""
140
"This allows our user to accept either one or many arguments as they "
141
"please. This works similar to positional arguments, so multi-word "
142
"parameters should be quoted."
143
msgstr "これによって一つ、あるいは複数の引数を受け取ることができます。ただし、引数を渡す際の挙動は位置引数と同様のため、複数の単語を含む文字列は引用符で囲む必要があります。"
144

145
#: ../../ext/commands/commands.rst:119
146
msgid "For example, on the bot side:"
147
msgstr "例えば、Bot側ではこのように動きます。"
148

149
#: ../../ext/commands/commands.rst:123
150
msgid ""
151
"If the user wants to input a multi-word argument, they have to quote it "
152
"like earlier:"
153
msgstr "複数単語の文字列を渡す際は、引用符で囲んでください。"
154

155
#: ../../ext/commands/commands.rst:127
156
msgid ""
157
"Do note that similar to the Python function behaviour, a user can "
158
"technically pass no arguments at all:"
159
msgstr "Pythonの振る舞いと同様に、ユーザーは引数なしの状態を技術的に渡すことができます。"
160

161
#: ../../ext/commands/commands.rst:132
162
msgid ""
163
"Since the ``args`` variable is a :class:`py:tuple`, you can do anything "
164
"you would usually do with one."
165
msgstr ""
166

167
#: ../../ext/commands/commands.rst:136
168
msgid "Keyword-Only Arguments"
169
msgstr "キーワード引数"
170

171
#: ../../ext/commands/commands.rst:138
172
msgid ""
173
"When you want to handle parsing of the argument yourself or do not feel "
174
"like you want to wrap multi-word user input into quotes, you can ask the "
175
"library to give you the rest as a single argument. We do this by using a "
176
"**keyword-only argument**, seen below:"
177
msgstr "引数の構文解析を自分で行う場合や、複数単語の入力を引用符で囲む必要のないようにしたい場合は、渡された値を単一の引数として受け取るようにライブラリに求めることができます。以下のコードのようにキーワード引数のみを使用することでこれが可能になります。"
178

179
#: ../../ext/commands/commands.rst:150
180
msgid "You can only have one keyword-only argument due to parsing ambiguities."
181
msgstr "解析が曖昧になるため、一つのキーワードのみの引数しか扱えません。"
182

183
#: ../../ext/commands/commands.rst:152
184
msgid "On the bot side, we do not need to quote input with spaces:"
185
msgstr "Bot側では、スペースを含む入力を引用符で囲む必要がありません:"
186

187
#: ../../ext/commands/commands.rst:156
188
msgid "Do keep in mind that wrapping it in quotes leaves it as-is:"
189
msgstr "引用符で囲んだ場合、消えずに残るので注意してください:"
190

191
#: ../../ext/commands/commands.rst:160
192
msgid ""
193
"By default, the keyword-only arguments are stripped of white space to "
194
"make it easier to work with. This behaviour can be toggled by the "
195
":attr:`.Command.rest_is_raw` argument in the decorator."
196
msgstr ""
197
"通常、キーワード引数は利便性のために空白文字で分割されます。この動作はデコレータの引数として "
198
":attr:`.Command.rest_is_raw` を使うことで切り替えることが可能です。"
199

200
#: ../../ext/commands/commands.rst:166
201
msgid "Invocation Context"
202
msgstr "呼び出しコンテクスト"
203

204
#: ../../ext/commands/commands.rst:168
205
msgid ""
206
"As seen earlier, every command must take at least a single parameter, "
207
"called the :class:`~ext.commands.Context`."
208
msgstr "前述の通り、すべてのコマンドは必ず :class:`~ext.commands.Context` と呼ばれるパラメータを受け取らなければいけません。"
209

210
#: ../../ext/commands/commands.rst:170
211
msgid ""
212
"This parameter gives you access to something called the \"invocation "
213
"context\". Essentially all the information you need to know how the "
214
"command was executed. It contains a lot of useful information:"
215
msgstr "このパラメータにより、「呼び出しコンテクスト」というものにアクセスできます。言うなればコマンドがどのように実行されたのかを知るのに必要な基本的情報です。これにはたくさんの有用な情報が含まれています。"
216

217
#: ../../ext/commands/commands.rst:173
218
msgid ":attr:`.Context.guild` to fetch the :class:`Guild` of the command, if any."
219
msgstr "存在する場合に限り、コマンドの :class:`Guild` を取得できる :attr:`.Context.guild` 。"
220

221
#: ../../ext/commands/commands.rst:174
222
msgid ":attr:`.Context.message` to fetch the :class:`Message` of the command."
223
msgstr "コマンドの :class:`Message` を取得できる :attr:`.Context.message` 。"
224

225
#: ../../ext/commands/commands.rst:175
226
msgid ""
227
":attr:`.Context.author` to fetch the :class:`Member` or :class:`User` "
228
"that called the command."
229
msgstr ""
230
"コマンドを実行した :class:`Member` あるいは :class:`User` を取得できる "
231
":attr:`.Context.author` 。"
232

233
#: ../../ext/commands/commands.rst:176
234
msgid ""
235
":meth:`.Context.send` to send a message to the channel the command was "
236
"used in."
237
msgstr "コマンドが実行されたチャンネルにメッセージを送信する :meth:`.Context.send` 。"
238

239
#: ../../ext/commands/commands.rst:178
240
msgid ""
241
"The context implements the :class:`abc.Messageable` interface, so "
242
"anything you can do on a :class:`abc.Messageable` you can do on the "
243
":class:`~ext.commands.Context`."
244
msgstr ""
245
"コンテクストは :class:`abc.Messageable` インタフェースを実装しているため、 "
246
":class:`abc.Messageable` 上でできることは :class:`~ext.commands.Context` "
247
"上でも行うことが可能です。"
248

249
#: ../../ext/commands/commands.rst:182
250
msgid "Converters"
251
msgstr "コンバータ"
252

253
#: ../../ext/commands/commands.rst:184
254
msgid ""
255
"Adding bot arguments with function parameters is only the first step in "
256
"defining your bot's command interface. To actually make use of the "
257
"arguments, we usually want to convert the data into a target type. We "
258
"call these :ref:`ext_commands_api_converters`."
259
msgstr ""
260
"Botの引数を関数のパラメータとして設定するのは、Botのコマンドインタフェースを定義する第一歩です。引数を実際に扱うには、大抵の場合、データを目的の型へとと変換する必要があります。私達はこれを"
261
" :ref:`ext_commands_api_converters` と呼んでいます。"
262

263
#: ../../ext/commands/commands.rst:188
264
msgid "Converters come in a few flavours:"
265
msgstr "コンバータにはいくつかの種類があります:"
266

267
#: ../../ext/commands/commands.rst:190
268
msgid ""
269
"A regular callable object that takes an argument as a sole parameter and "
270
"returns a different type."
271
msgstr "引数を一つのパラメータとして受け取り、異なる型として返す、通常の呼び出し可能オブジェクト。"
272

273
#: ../../ext/commands/commands.rst:192
274
msgid ""
275
"These range from your own function, to something like :class:`bool` or "
276
":class:`int`."
277
msgstr "これらにはあなたの作った関数、 :class:`bool` や :class:`int` といったものまで含まれます。"
278

279
#: ../../ext/commands/commands.rst:194
280
msgid "A custom class that inherits from :class:`~ext.commands.Converter`."
281
msgstr ":class:`~ext.commands.Converter` を継承したカスタムクラス。"
282

283
#: ../../ext/commands/commands.rst:197
284
msgid "Basic Converters"
285
msgstr "基本的なコンバーター"
286

287
#: ../../ext/commands/commands.rst:199
288
msgid ""
289
"At its core, a basic converter is a callable that takes in an argument "
290
"and turns it into something else."
291
msgstr "基本的なコンバーターは、中核をなすものであり、受け取った引数を別のものへと変換します。"
292

293
#: ../../ext/commands/commands.rst:201
294
msgid ""
295
"For example, if we wanted to add two numbers together, we could request "
296
"that they are turned into integers for us by specifying the converter:"
297
msgstr "例えば、二つの値を加算したい場合、コンバーターを指定することにより、受け取った値を整数型へ変換するように要求できます。"
298

299
#: ../../ext/commands/commands.rst:210
300
msgid ""
301
"We specify converters by using something called a **function "
302
"annotation**. This is a Python 3 exclusive feature that was introduced in"
303
" :pep:`3107`."
304
msgstr ""
305
"コンバーターの指定には関数アノテーションというもの用います。これは :pep:`3107` にて追加された Python 3 "
306
"にのみ実装されている機能です。"
307

308
#: ../../ext/commands/commands.rst:213
309
msgid ""
310
"This works with any callable, such as a function that would convert a "
311
"string to all upper-case:"
312
msgstr "これは、文字列をすべて大文字に変換する関数などといった、任意の呼び出し可能関数でも動作します。"
313

314
#: ../../ext/commands/commands.rst:225
315
msgid "bool"
316
msgstr "論理型"
317

318
#: ../../ext/commands/commands.rst:227
319
#, fuzzy
320
msgid ""
321
"Unlike the other basic converters, the :class:`bool` converter is treated"
322
" slightly different. Instead of casting directly to the :class:`bool` "
323
"type, which would result in any non-empty argument returning ``True``, it"
324
" instead evaluates the argument as ``True`` or ``False`` based on its "
325
"given content:"
326
msgstr ""
327
"他の基本的なコンバーターとは異なり、 :class:`bool` のコンバーターは若干異なる扱いになります。 :class:`bool` "
328
"型に直接キャストする代わりに、与えられた値に基づいて ``True`` か ``False`` を返します。"
329

330
#: ../../ext/commands/commands.rst:239
331
msgid "Advanced Converters"
332
msgstr "応用的なコンバータ"
333

334
#: ../../ext/commands/commands.rst:241
335
msgid ""
336
"Sometimes a basic converter doesn't have enough information that we need."
337
" For example, sometimes we want to get some information from the "
338
":class:`Message` that called the command or we want to do some "
339
"asynchronous processing."
340
msgstr ""
341
"場合によっては、基本的なコンバータを動かすのに必要な情報が不足していることがあります。例えば、実行されたコマンドの "
342
":class:`Message` から情報を取得したい場合や、非同期処理を行いたい場合です。"
343

344
#: ../../ext/commands/commands.rst:244
345
msgid ""
346
"For this, the library provides the :class:`~ext.commands.Converter` "
347
"interface. This allows you to have access to the :class:`.Context` and "
348
"have the callable be asynchronous. Defining a custom converter using this"
349
" interface requires overriding a single method, "
350
":meth:`.Converter.convert`."
351
msgstr ""
352
"そういった用途のために、このライブラリは :class:`~ext.commands.Converter` "
353
"インタフェースを提供します。これによって :class:`.Context` "
354
"にアクセスが可能になり、また、呼び出し可能関数を非同期にもできるようになります。このインタフェースを使用して、カスタムコンバーターを定義したい場合は"
355
" :meth:`.Converter.convert` をオーバーライドしてください。"
356

357
#: ../../ext/commands/commands.rst:248
358
msgid "An example converter:"
359
msgstr "コンバーターの例"
360

361
#: ../../ext/commands/commands.rst:263
362
msgid ""
363
"The converter provided can either be constructed or not. Essentially "
364
"these two are equivalent:"
365
msgstr "コンバーターはインスタンス化されていなくても構いません。以下の例の二つのは同じ処理になります。"
366

367
#: ../../ext/commands/commands.rst:277
368
msgid ""
369
"Having the possibility of the converter be constructed allows you to set "
370
"up some state in the converter's ``__init__`` for fine tuning the "
371
"converter. An example of this is actually in the library, "
372
":class:`~ext.commands.clean_content`."
373
msgstr ""
374
"コンバーターをインスタンス化する可能性がある場合、コンバーターの調整を行うために ``__init__`` "
375
"で何かしらの状態を設定することが出来ます。この例としてライブラリに実際に存在する "
376
":class:`~ext.commands.clean_content` があります。"
377

378
#: ../../ext/commands/commands.rst:293
379
msgid ""
380
"If a converter fails to convert an argument to its designated target "
381
"type, the :exc:`.BadArgument` exception must be raised."
382
msgstr "コンバーターが渡された引数を指定の型に変換できなかった場合は :exc:`.BadArgument` を発生させてください。"
383

384
#: ../../ext/commands/commands.rst:297
385
msgid "Inline Advanced Converters"
386
msgstr "埋込み型の応用的なコンバーター"
387

388
#: ../../ext/commands/commands.rst:299
389
msgid ""
390
"If we don't want to inherit from :class:`~ext.commands.Converter`, we can"
391
" still provide a converter that has the advanced functionalities of an "
392
"advanced converter and save us from specifying two types."
393
msgstr ""
394
":class:`~ext.commands.Converter` "
395
"を継承したくない場合のために、応用的なコンバータの高度な機能を備えたコンバータを提供しています。これを使用することで2つのクラスを作成する必要がなくなります。"
396

397
#: ../../ext/commands/commands.rst:302
398
msgid ""
399
"For example, a common idiom would be to have a class and a converter for "
400
"that class:"
401
msgstr "例えば、一般的な書き方だと、クラスとそのクラスへのコンバーターを定義します:"
402

403
#: ../../ext/commands/commands.rst:328
404
msgid ""
405
"This can get tedious, so an inline advanced converter is possible through"
406
" a ``classmethod`` inside the type:"
407
msgstr ""
408
"これでは面倒に感じてしまうこともあるでしょう。しかし、埋込み型の応用的なコンバーターは ``classmethod`` "
409
"としてクラスへ埋め込むことが可能です:"
410

411
#: ../../ext/commands/commands.rst:355
412
msgid "Discord Converters"
413
msgstr "Discord コンバーター"
414

415
#: ../../ext/commands/commands.rst:357
416
msgid ""
417
"Working with :ref:`discord_api_models` is a fairly common thing when "
418
"defining commands, as a result the library makes working with them easy."
419
msgstr ""
420
":ref:`discord_api_models` "
421
"を使用して作業を行うのは、コマンドを定義する際には一般的なことです。そのため、このライブラリでは簡単に作業が行えるようになっています。"
422

423
#: ../../ext/commands/commands.rst:360
424
msgid ""
425
"For example, to receive a :class:`Member` you can just pass it as a "
426
"converter:"
427
msgstr "例えば、 :class:`Member` を受け取るには、これをコンバーターとして渡すだけです。"
428

429
#: ../../ext/commands/commands.rst:368
430
msgid ""
431
"When this command is executed, it attempts to convert the string given "
432
"into a :class:`Member` and then passes it as a parameter for the "
433
"function. This works by checking if the string is a mention, an ID, a "
434
"nickname, a username + discriminator, or just a regular username. The "
435
"default set of converters have been written to be as easy to use as "
436
"possible."
437
msgstr ""
438
"このコマンドが実行されると、与えられた文字列を :class:`Member` "
439
"に変換して、それを関数のパラメーターとして渡します。これは文字列がメンション、ID、ニックネーム、ユーザー名 + "
440
"Discordタグ、または普通のユーザー名かどうかをチェックすることで機能しています。デフォルトで定義されているコンバーターは、できるだけ簡単に使えるように作られています。"
441

442
#: ../../ext/commands/commands.rst:372
443
msgid "A lot of disnake models work out of the gate as a parameter:"
444
msgstr "Discordモデルの多くがコンバーターとして動作します。"
445

446
#: ../../ext/commands/commands.rst:374 ../../ext/commands/commands.rst:396
447
msgid ":class:`Member`"
448
msgstr ":class:`Member`"
449

450
#: ../../ext/commands/commands.rst:375 ../../ext/commands/commands.rst:400
451
msgid ":class:`User`"
452
msgstr ":class:`User`"
453

454
#: ../../ext/commands/commands.rst:376 ../../ext/commands/commands.rst:402
455
msgid ":class:`TextChannel`"
456
msgstr ":class:`TextChannel`"
457

458
#: ../../ext/commands/commands.rst:377 ../../ext/commands/commands.rst:404
459
msgid ":class:`VoiceChannel`"
460
msgstr ":class:`VoiceChannel`"
461

462
#: ../../ext/commands/commands.rst:378 ../../ext/commands/commands.rst:406
463
msgid ":class:`CategoryChannel`"
464
msgstr ":class:`CategoryChannel`"
465

466
#: ../../ext/commands/commands.rst:379 ../../ext/commands/commands.rst:408
467
msgid ":class:`Role`"
468
msgstr ":class:`Role`"
469

470
#: ../../ext/commands/commands.rst:380
471
msgid ":class:`Message` (since v1.1)"
472
msgstr ":class:`Message` (v1.1 から)"
473

474
#: ../../ext/commands/commands.rst:381 ../../ext/commands/commands.rst:410
475
msgid ":class:`Invite`"
476
msgstr ":class:`Invite`"
477

478
#: ../../ext/commands/commands.rst:382 ../../ext/commands/commands.rst:412
479
msgid ":class:`Game`"
480
msgstr ":class:`Game`"
481

482
#: ../../ext/commands/commands.rst:383 ../../ext/commands/commands.rst:414
483
msgid ":class:`Emoji`"
484
msgstr ":class:`Emoji`"
485

486
#: ../../ext/commands/commands.rst:384 ../../ext/commands/commands.rst:416
487
msgid ":class:`PartialEmoji`"
488
msgstr ":class:`PartialEmoji`"
489

490
#: ../../ext/commands/commands.rst:385 ../../ext/commands/commands.rst:418
491
msgid ":class:`Colour`"
492
msgstr ":class:`Colour`"
493

494
#: ../../ext/commands/commands.rst:387
495
msgid ""
496
"Having any of these set as the converter will intelligently convert the "
497
"argument to the appropriate target type you specify."
498
msgstr "これらをコンバーターとして設定すると、引数を指定した型へとインテリジェントに変換します。"
499

500
#: ../../ext/commands/commands.rst:390
501
msgid ""
502
"Under the hood, these are implemented by the "
503
":ref:`ext_commands_adv_converters` interface. A table of the equivalent "
504
"converter is given below:"
505
msgstr ""
506
"これらは :ref:`ext_commands_adv_converters` "
507
"インタフェースによって実装されています。コンバーターとクラスの関係は以下の通りです。"
508

509
#: ../../ext/commands/commands.rst:394
510
msgid "Discord Class"
511
msgstr "Discord クラス"
512

513
#: ../../ext/commands/commands.rst:394
514
msgid "Converter"
515
msgstr "コンバーター"
516

517
#: ../../ext/commands/commands.rst:396
518
msgid ":class:`~ext.commands.MemberConverter`"
519
msgstr ":class:`~ext.commands.MemberConverter`"
520

521
#: ../../ext/commands/commands.rst:398
522
msgid ":class:`Message`"
523
msgstr ":class:`Message`"
524

525
#: ../../ext/commands/commands.rst:398
526
msgid ":class:`~ext.commands.MessageConverter`"
527
msgstr ":class:`~ext.commands.MessageConverter`"
528

529
#: ../../ext/commands/commands.rst:400
530
msgid ":class:`~ext.commands.UserConverter`"
531
msgstr ":class:`~ext.commands.UserConverter`"
532

533
#: ../../ext/commands/commands.rst:402
534
msgid ":class:`~ext.commands.TextChannelConverter`"
535
msgstr ":class:`~ext.commands.TextChannelConverter`"
536

537
#: ../../ext/commands/commands.rst:404
538
msgid ":class:`~ext.commands.VoiceChannelConverter`"
539
msgstr ":class:`~ext.commands.VoiceChannelConverter`"
540

541
#: ../../ext/commands/commands.rst:406
542
msgid ":class:`~ext.commands.CategoryChannelConverter`"
543
msgstr ":class:`~ext.commands.CategoryChannelConverter`"
544

545
#: ../../ext/commands/commands.rst:408
546
msgid ":class:`~ext.commands.RoleConverter`"
547
msgstr ":class:`~ext.commands.RoleConverter`"
548

549
#: ../../ext/commands/commands.rst:410
550
msgid ":class:`~ext.commands.InviteConverter`"
551
msgstr ":class:`~ext.commands.InviteConverter`"
552

553
#: ../../ext/commands/commands.rst:412
554
msgid ":class:`~ext.commands.GameConverter`"
555
msgstr ":class:`~ext.commands.GameConverter`"
556

557
#: ../../ext/commands/commands.rst:414
558
msgid ":class:`~ext.commands.EmojiConverter`"
559
msgstr ":class:`~ext.commands.EmojiConverter`"
560

561
#: ../../ext/commands/commands.rst:416
562
msgid ":class:`~ext.commands.PartialEmojiConverter`"
563
msgstr ":class:`~ext.commands.PartialEmojiConverter`"
564

565
#: ../../ext/commands/commands.rst:418
566
msgid ":class:`~ext.commands.ColourConverter`"
567
msgstr ":class:`~ext.commands.ColourConverter`"
568

569
#: ../../ext/commands/commands.rst:421
570
msgid ""
571
"By providing the converter it allows us to use them as building blocks "
572
"for another converter:"
573
msgstr "コンバーターを継承することで、他のコンバーターの一部として使うことができます:"
574

575
#: ../../ext/commands/commands.rst:438
576
msgid "Special Converters"
577
msgstr "特殊なコンバーター"
578

579
#: ../../ext/commands/commands.rst:440
580
msgid ""
581
"The command extension also has support for certain converters to allow "
582
"for more advanced and intricate use cases that go beyond the generic "
583
"linear parsing. These converters allow you to introduce some more relaxed"
584
" and dynamic grammar to your commands in an easy to use manner."
585
msgstr "コマンド拡張機能は一般的な線形解析を超える、より高度で複雑なユースケースに対応するため、特殊なコンバータをサポートしています。これらのコンバータは、簡単な方法でコマンドに更に容易で動的な文法の導入を可能にします。"
586

587
#: ../../ext/commands/commands.rst:445
588
msgid "typing.Union"
589
msgstr "typing.Union"
590

591
#: ../../ext/commands/commands.rst:447
592
msgid ""
593
"A :data:`typing.Union` is a special type hint that allows for the command"
594
" to take in any of the specific types instead of a singular type. For "
595
"example, given the following:"
596
msgstr ":data:`typing.Union` はコマンドが単数の型の代わりに、複数の特定の型を取り込める特殊な型ヒントです。例えば:"
597

598
#: ../../ext/commands/commands.rst:459
599
msgid ""
600
"The ``what`` parameter would either take a :class:`disnake.TextChannel` "
601
"converter or a :class:`disnake.Member` converter. The way this works is "
602
"through a left-to-right order. It first attempts to convert the input to "
603
"a :class:`disnake.TextChannel`, and if it fails it tries to convert it to"
604
" a :class:`disnake.Member`. If all converters fail, then a special error "
605
"is raised, :exc:`~ext.commands.BadUnionArgument`."
606
msgstr ""
607
"``what`` パラメータには :class:`disnake.TextChannel` コンバーターか "
608
":class:`disnake.Member` "
609
"コンバーターのいずれかが用いられます。これは左から右の順で変換できるか試行することになります。最初に渡された値を "
610
":class:`disnake.TextChannel` へ変換しようと試み、失敗した場合は :class:`disnake.Member` "
611
"に変換しようとします。すべてのコンバーターで失敗した場合は :exc:`~ext.commands.BadUnionArgument` "
612
"というエラーが発生します。"
613

614
#: ../../ext/commands/commands.rst:464
615
msgid ""
616
"Note that any valid converter discussed above can be passed in to the "
617
"argument list of a :data:`typing.Union`."
618
msgstr "以前に説明した有効なコンバーターは、すべて :data:`typing.Union` にわたすことが可能です。"
619

620
#: ../../ext/commands/commands.rst:467
621
msgid "typing.Optional"
622
msgstr "typing.Optional"
623

624
#: ../../ext/commands/commands.rst:469
625
msgid ""
626
"A :data:`typing.Optional` is a special type hint that allows for \"back-"
627
"referencing\" behaviour. If the converter fails to parse into the "
628
"specified type, the parser will skip the parameter and then either "
629
"``None`` or the specified default will be passed into the parameter "
630
"instead. The parser will then continue on to the next parameters and "
631
"converters, if any."
632
msgstr ""
633
":data:`typing.Optional` "
634
"は「後方参照」のような動作をする特殊な型ヒントです。コンバーターが指定された型へのパースに失敗した場合、パーサーは代わりに ``None`` "
635
"または指定されたデフォルト値をパラメータに渡したあと、そのパラメータをスキップします。次のパラメータまたはコンバータがあれば、そちらに進みます。"
636

637
#: ../../ext/commands/commands.rst:473 ../../ext/commands/commands.rst:500
638
msgid "Consider the following example:"
639
msgstr "次の例をみてください:"
640

641
#: ../../ext/commands/commands.rst:486
642
msgid ""
643
"In this example, since the argument could not be converted into an "
644
"``int``, the default of ``99`` is passed and the parser resumes handling,"
645
" which in this case would be to pass it into the ``liquid`` parameter."
646
msgstr ""
647
"この例では引数を ``int`` に変換することができなかったので、デフォルト値である ``99`` "
648
"を代入し、パーサーは処理を続行しています。この場合、先程の変換に失敗した引数は ``liquid`` パラメータに渡されます。"
649

650
#: ../../ext/commands/commands.rst:491
651
msgid ""
652
"This converter only works in regular positional parameters, not variable "
653
"parameters or keyword-only parameters."
654
msgstr "このコンバーターは位置パラメータでのみ動作し、可変長パラメータやキーワードパラメータでは機能しません。"
655

656
#: ../../ext/commands/commands.rst:494
657
msgid "Greedy"
658
msgstr "Greedy"
659

660
#: ../../ext/commands/commands.rst:496
661
msgid ""
662
"The :data:`~ext.commands.Greedy` converter is a generalisation of the "
663
":data:`typing.Optional` converter, except applied to a list of arguments."
664
" In simple terms, this means that it tries to convert as much as it can "
665
"until it can't convert any further."
666
msgstr ""
667
":data:`~ext.commands.Greedy` コンバータは引数にリストが適用される以外は "
668
":data:`typing.Optional` "
669
"を一般化したものです。簡単に言うと、与えられた引数を変換ができなくなるまで指定の型に変換しようと試みます。"
670

671
#: ../../ext/commands/commands.rst:509
672
msgid "When invoked, it allows for any number of members to be passed in:"
673
msgstr "これが呼び出されると、任意の数のメンバーを渡すことができます:"
674

675
#: ../../ext/commands/commands.rst:513
676
msgid ""
677
"The type passed when using this converter depends on the parameter type "
678
"that it is being attached to:"
679
msgstr ""
680

681
#: ../../ext/commands/commands.rst:515
682
msgid ""
683
"Positional parameter types will receive either the default parameter or a"
684
" :class:`list` of the converted values."
685
msgstr ""
686

687
#: ../../ext/commands/commands.rst:516
688
msgid "Variable parameter types will be a :class:`tuple` as usual."
689
msgstr ""
690

691
#: ../../ext/commands/commands.rst:517
692
msgid ""
693
"Keyword-only parameter types will be the same as if "
694
":data:`~ext.commands.Greedy` was not passed at all."
695
msgstr ""
696

697
#: ../../ext/commands/commands.rst:519
698
msgid ""
699
":data:`~ext.commands.Greedy` parameters can also be made optional by "
700
"specifying an optional value."
701
msgstr ""
702

703
#: ../../ext/commands/commands.rst:521
704
msgid ""
705
"When mixed with the :data:`typing.Optional` converter you can provide "
706
"simple and expressive command invocation syntaxes:"
707
msgstr ""
708

709
#: ../../ext/commands/commands.rst:536
710
msgid "This command can be invoked any of the following ways:"
711
msgstr ""
712

713
#: ../../ext/commands/commands.rst:546
714
msgid ""
715
"The usage of :data:`~ext.commands.Greedy` and :data:`typing.Optional` are"
716
" powerful and useful, however as a price, they open you up to some "
717
"parsing ambiguities that might surprise some people."
718
msgstr ""
719

720
#: ../../ext/commands/commands.rst:549
721
msgid ""
722
"For example, a signature expecting a :data:`typing.Optional` of a "
723
":class:`disnake.Member` followed by a :class:`int` could catch a member "
724
"named after a number due to the different ways a "
725
":class:`~ext.commands.MemberConverter` decides to fetch members. You "
726
"should take care to not introduce unintended parsing ambiguities in your "
727
"code. One technique would be to clamp down the expected syntaxes allowed "
728
"through custom converters or reordering the parameters to minimise "
729
"clashes."
730
msgstr ""
731

732
#: ../../ext/commands/commands.rst:555
733
msgid ""
734
"To help aid with some parsing ambiguities, :class:`str`, ``None``, "
735
":data:`typing.Optional` and :data:`~ext.commands.Greedy` are forbidden as"
736
" parameters for the :data:`~ext.commands.Greedy` converter."
737
msgstr ""
738

739
#: ../../ext/commands/commands.rst:561
740
msgid "Error Handling"
741
msgstr "エラーハンドリング"
742

743
#: ../../ext/commands/commands.rst:563
744
#, fuzzy
745
msgid ""
746
"When our commands fail to parse we will, by default, receive a noisy "
747
"error in ``stderr`` of our console that tells us that an error has "
748
"happened and has been silently ignored."
749
msgstr ""
750
"コマンドの解析に失敗したとき、通常では煩わしいエラーはエラーの発生を伝えるためにコンソールの ``stderr`` "
751
"で受け取られ、無視されていました。"
752

753
#: ../../ext/commands/commands.rst:566
754
msgid ""
755
"In order to handle our errors, we must use something called an error "
756
"handler. There is a global error handler, called :func:`on_command_error`"
757
" which works like any other event in the :ref:`disnake-api-events`. This "
758
"global error handler is called for every error reached."
759
msgstr ""
760

761
#: ../../ext/commands/commands.rst:570
762
msgid ""
763
"Most of the time however, we want to handle an error local to the command"
764
" itself. Luckily, commands come with local error handlers that allow us "
765
"to do just that. First we decorate an error handler function with "
766
":meth:`.Command.error`:"
767
msgstr ""
768

769
#: ../../ext/commands/commands.rst:586
770
msgid ""
771
"The first parameter of the error handler is the :class:`.Context` while "
772
"the second one is an exception that is derived from "
773
":exc:`~ext.commands.CommandError`. A list of errors is found in the "
774
":ref:`ext_commands_api_errors` page of the documentation."
775
msgstr ""
776

777
#: ../../ext/commands/commands.rst:590
778
msgid "Checks"
779
msgstr "チェック"
780

781
#: ../../ext/commands/commands.rst:592
782
msgid ""
783
"There are cases when we don't want a user to use our commands. They don't"
784
" have permissions to do so or maybe we blocked them from using our bot "
785
"earlier. The commands extension comes with full support for these things "
786
"in a concept called a :ref:`ext_commands_api_checks`."
787
msgstr ""
788
"コマンドをユーザーに使ってほしくない場合などがあります。例えば、使用者が権限を持っていない場合や、Botをブロックしている場合などです。コマンド拡張ではこのような機能を"
789
" :ref:`ext_commands_api_checks` と呼び、完全にサポートしています。"
790

791
#: ../../ext/commands/commands.rst:596
792
msgid ""
793
"A check is a basic predicate that can take in a :class:`.Context` as its "
794
"sole parameter. Within it, you have the following options:"
795
msgstr ""
796

797
#: ../../ext/commands/commands.rst:599
798
msgid "Return ``True`` to signal that the person can run the command."
799
msgstr ""
800

801
#: ../../ext/commands/commands.rst:600
802
msgid "Return ``False`` to signal that the person cannot run the command."
803
msgstr ""
804

805
#: ../../ext/commands/commands.rst:601
806
msgid ""
807
"Raise a :exc:`~ext.commands.CommandError` derived exception to signal the"
808
" person cannot run the command."
809
msgstr ""
810

811
#: ../../ext/commands/commands.rst:603
812
msgid ""
813
"This allows you to have custom error messages for you to handle in the "
814
":ref:`error handlers <ext_commands_error_handler>`."
815
msgstr ""
816

817
#: ../../ext/commands/commands.rst:606
818
msgid ""
819
"To register a check for a command, we would have two ways of doing so. "
820
"The first is using the :meth:`~ext.commands.check` decorator. For "
821
"example:"
822
msgstr ""
823

824
#: ../../ext/commands/commands.rst:620
825
msgid ""
826
"This would only evaluate the command if the function ``is_owner`` returns"
827
" ``True``. Sometimes we re-use a check often and want to split it into "
828
"its own decorator. To do that we can just add another level of depth:"
829
msgstr ""
830

831
#: ../../ext/commands/commands.rst:637
832
msgid ""
833
"Since an owner check is so common, the library provides it for you "
834
"(:func:`~ext.commands.is_owner`):"
835
msgstr ""
836

837
#: ../../ext/commands/commands.rst:647
838
msgid "When multiple checks are specified, **all** of them must be ``True``:"
839
msgstr ""
840

841
#: ../../ext/commands/commands.rst:663
842
msgid ""
843
"If any of those checks fail in the example above, then the command will "
844
"not be run."
845
msgstr ""
846

847
#: ../../ext/commands/commands.rst:665
848
msgid ""
849
"When an error happens, the error is propagated to the :ref:`error "
850
"handlers <ext_commands_error_handler>`. If you do not raise a custom "
851
":exc:`~ext.commands.CommandError` derived exception, then it will get "
852
"wrapped up into a :exc:`~ext.commands.CheckFailure` exception as so:"
853
msgstr ""
854

855
#: ../../ext/commands/commands.rst:683
856
msgid ""
857
"If you want a more robust error system, you can derive from the exception"
858
" and raise it instead of returning ``False``:"
859
msgstr ""
860

861
#: ../../ext/commands/commands.rst:708
862
msgid ""
863
"Since having a ``guild_only`` decorator is pretty common, it comes built-"
864
"in via :func:`~ext.commands.guild_only`."
865
msgstr ""
866

867
#: ../../ext/commands/commands.rst:711
868
msgid "Global Checks"
869
msgstr "グローバルチェック"
870

871
#: ../../ext/commands/commands.rst:713
872
msgid ""
873
"Sometimes we want to apply a check to **every** command, not just certain"
874
" commands. The library supports this as well using the global check "
875
"concept."
876
msgstr ""
877

878
#: ../../ext/commands/commands.rst:716
879
msgid ""
880
"Global checks work similarly to regular checks except they are registered"
881
" with the :func:`.Bot.check` decorator."
882
msgstr ""
883

884
#: ../../ext/commands/commands.rst:718
885
msgid "For example, to block all DMs we could do the following:"
886
msgstr ""
887

888
#: ../../ext/commands/commands.rst:728
889
msgid ""
890
"Be careful on how you write your global checks, as it could also lock you"
891
" out of your own bot."
892
msgstr ""
893

894
#~ msgid ""
895
#~ "To help aid with some parsing "
896
#~ "ambiguities, :class:`str`, ``None`` and "
897
#~ ":data:`~ext.commands.Greedy` are forbidden as "
898
#~ "parameters for the :data:`~ext.commands.Greedy` "
899
#~ "converter."
900
#~ msgstr ""
901

Использование cookies

Мы используем файлы cookie в соответствии с Политикой конфиденциальности и Политикой использования cookies.

Нажимая кнопку «Принимаю», Вы даете АО «СберТех» согласие на обработку Ваших персональных данных в целях совершенствования нашего веб-сайта и Сервиса GitVerse, а также повышения удобства их использования.

Запретить использование cookies Вы можете самостоятельно в настройках Вашего браузера.