-
Notifications
You must be signed in to change notification settings - Fork 0
/
intro.html
237 lines (224 loc) · 13.1 KB
/
intro.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>소개</title>
<!-- end extra head -->
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
<link rel="stylesheet" href="_static/style.css" type="text/css" />
<link rel="stylesheet" href="_static/codeblocks.css" type="text/css" />
<link rel="stylesheet" href="_static/icons.css" type="text/css" />
<script id="documentation_options" data-url_root="./" src="_static/documentation_options.js"></script>
<script src="_static/jquery.js"></script>
<script src="_static/underscore.js"></script>
<script src="_static/doctools.js"></script>
<script src="_static/language_data.js"></script>
<script src="_static/custom.js"></script>
<script src="_static/settings.js"></script>
<script src="_static/copy.js"></script>
<script src="_static/sidebar.js"></script>
<script src="_static/translations.js"></script>
<link rel="shortcut icon" href="_static/discord_py_logo.ico"/>
<link rel="index" title="색인" href="genindex.html" />
<link rel="search" title="검색" href="search.html" />
</head>
<body>
<div class="main-grid">
<header class="grid-item">
<nav>
<a href="index.html" class="main-heading">discord.py</a>
<a href="https://github.com/Rapptz/discord.py" title="GitHub"><span class="material-icons custom-icons">github</span></a>
<a href="https://discord.gg/YbfbxpX" title="Discord"><span class="material-icons custom-icons">discord</span></a>
<a href="faq.html" title="FAQ"><span class="material-icons">help_center</span></a>
<a onclick="mobileSearch.open();" title="검색" id="open-search" class="mobile-only"><span class="material-icons">search</span></a>
<a onclick="mobileSearch.close();" title="Close" id="close-search" class="mobile-only" hidden><span class="material-icons">close</span></a>
</nav>
<nav class="mobile-only">
<form role="search" class="search" action="search.html" method="get">
<div class="search-wrapper">
<input type="search" name="q" placeholder="Search documentation" />
<button type="submit">
<span class="material-icons">search</span>
</button>
</div>
</form>
</nav>
</header>
<div class="sub-header grid-item">
<label for="documentation_select">View Documentation For</label>
<select id="documentation_select" onchange="window.location = this.value;">
<option value="#" selected>discord</option>
<option value="ext/commands/index.html" >discord.ext.commands</option>
<option value="ext/tasks/index.html" >discord.ext.tasks</option>
</select>
<form role="search" class="search" action="search.html" method="get">
<div class="search-wrapper">
<input type="search" name="q" placeholder="Search documentation" />
<button type="submit">
<span class="material-icons">search</span>
</button>
</div>
</form>
<a accesskey="S" class="settings" onclick="settingsModal.open();"><span class="material-icons">settings</span></a>
</div>
<aside class="grid-item">
<span id="hamburger-toggle">
<span class="material-icons">menu</span>
</span>
<span id="settings-toggle" class="settings" onclick="settingsModal.open();">
<span class="material-icons">settings</span>
</span>
<div id="sidebar">
<h3><a href="index.html">목차</a></h3>
<ul>
<li><a class="reference internal" href="#">소개</a><ul>
<li><a class="reference internal" href="#prerequisites">요구 조건</a></li>
<li><a class="reference internal" href="#installing">설치</a><ul>
<li><a class="reference internal" href="#virtual-environments">가상 환경</a></li>
</ul>
</li>
<li><a class="reference internal" href="#basic-concepts">기본 개념</a></li>
</ul>
</li>
</ul>
</div>
</aside>
<main class="grid-item" role="main">
<section id="introduction">
<span id="intro"></span><h1>소개<a class="headerlink" href="#introduction" title="제목 주소">¶</a></h1>
<p>이 문서는 디스코드 API를 이용한 애플리케이션을 생성하는 데 도움을 주는 discord.py의 문서입니다.</p>
<section id="prerequisites">
<h2>요구 조건<a class="headerlink" href="#prerequisites" title="제목 주소">¶</a></h2>
<p>discord.py는 Python 3.5.3 버전 이상에서 동작합니다. 그 이하 혹은 Python 2.7 이하에서는 지원되지 않습니다. Python 3.4 이하에서는 discord.py에 필요한 (<a class="reference external" href="https://docs.aiohttp.org/en/stable/index.html" title="(in aiohttp v3.7)"><span class="xref std std-doc">aiohttp</span></a>)가 지원되지 않습니다.</p>
</section>
<section id="installing">
<span id="id1"></span><h2>설치<a class="headerlink" href="#installing" title="제목 주소">¶</a></h2>
<p>PyPI에서 이 라이브러리를 바로 가져올 수 있습니다:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">python3</span> <span class="o">-</span><span class="n">m</span> <span class="n">pip</span> <span class="n">install</span> <span class="o">-</span><span class="n">U</span> <span class="n">discord</span><span class="o">.</span><span class="n">py</span>
</pre></div>
</div>
<p>만약 윈도우를 사용하신다면, 다음의 코드를 사용하셔야 합니다:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">py</span> <span class="o">-</span><span class="mi">3</span> <span class="o">-</span><span class="n">m</span> <span class="n">pip</span> <span class="n">install</span> <span class="o">-</span><span class="n">U</span> <span class="n">discord</span><span class="o">.</span><span class="n">py</span>
</pre></div>
</div>
<p>음성 기능을 사용하기 위해서는 <code class="docutils literal notranslate"><span class="pre">discord.py</span></code> 대신 <code class="docutils literal notranslate"><span class="pre">discord.py[voice]</span></code> 를 사용하셔야 합니다. 예를 들어:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">python3</span> <span class="o">-</span><span class="n">m</span> <span class="n">pip</span> <span class="n">install</span> <span class="o">-</span><span class="n">U</span> <span class="n">discord</span><span class="o">.</span><span class="n">py</span><span class="p">[</span><span class="n">voice</span><span class="p">]</span>
</pre></div>
</div>
<p>리눅스 환경에서 음성 기능을 사용하기 위해서는 아래의 모듈들이 필요합니다:</p>
<ul class="simple">
<li><p><a class="reference external" href="https://github.com/libffi/libffi">libffi</a></p></li>
<li><p><a class="reference external" href="https://github.com/saltstack/libnacl">libnacl</a></p></li>
<li><p><a class="reference external" href="https://packages.debian.org/python3-dev">python3-dev</a></p></li>
</ul>
<p>데비안 기반 시스템에서는 다음 명령어로 필요한 모듈들을 설치할 수 있습니다:</p>
<div class="highlight-shell notranslate"><div class="highlight"><pre><span></span>$ apt install libffi-dev libnacl-dev python3-dev
</pre></div>
</div>
<p>시스템 권한을 가졌는지 확인하세요!</p>
<section id="virtual-environments">
<h3>가상 환경<a class="headerlink" href="#virtual-environments" title="제목 주소">¶</a></h3>
<p>Sometimes you want to keep libraries from polluting system installs or use a different version of
libraries than the ones installed on the system. You might also not have permissions to install libraries system-wide.
For this purpose, the standard library as of Python 3.3 comes with a concept called 《Virtual Environment》s to
help maintain these separate versions.</p>
<p><a class="reference external" href="https://docs.python.org/ko/3/tutorial/venv.html" title="(in Python v3.9)"><span>가상 환경 및 패키지</span></a> 에서 더 많은 정보를 확인하세요.</p>
<p>다만 빠르게 진행하고 싶다면:</p>
<ol class="arabic">
<li><p>당신의 프로젝트 폴더로 가세요:</p>
<blockquote>
<div><div class="highlight-shell notranslate"><div class="highlight"><pre><span></span>$ <span class="nb">cd</span> your-bot-source
$ python3 -m venv bot-env
</pre></div>
</div>
</div></blockquote>
</li>
<li><p>가상 환경을 활성화하세요:</p>
<blockquote>
<div><div class="highlight-shell notranslate"><div class="highlight"><pre><span></span>$ <span class="nb">source</span> bot-env/bin/activate
</pre></div>
</div>
<p>윈도우에서 활성화하시려면:</p>
<div class="highlight-shell notranslate"><div class="highlight"><pre><span></span>$ bot-env<span class="se">\S</span>cripts<span class="se">\a</span>ctivate.bat
</pre></div>
</div>
</div></blockquote>
</li>
<li><p>평소와 같이 pip를 이용하세요:</p>
<blockquote>
<div><div class="highlight-shell notranslate"><div class="highlight"><pre><span></span>$ pip install -U discord.py
</pre></div>
</div>
</div></blockquote>
</li>
</ol>
<p>축하합니다. 이제 가상 환경 설정을 모두 끝냈습니다.</p>
</section>
</section>
<section id="basic-concepts">
<h2>기본 개념<a class="headerlink" href="#basic-concepts" title="제목 주소">¶</a></h2>
<p>discord.py는 <a class="reference internal" href="api.html#discord-api-events"><span class="std std-ref">events</span></a> 개념을 중심으로 진행됩니다. 이벤트는 봇이 감지하고 응답하는 것입니다. 예를 들어, 메시지가 발생하면 이벤트가 수신됩니다.</p>
<p>이벤트의 작동 방법을 보여주는 예:</p>
<div class="highlight-python3 notranslate"><div class="highlight"><pre><span></span><span class="kn">import</span> <span class="nn">discord</span>
<span class="k">class</span> <span class="nc">MyClient</span><span class="p">(</span><span class="n">discord</span><span class="o">.</span><span class="n">Client</span><span class="p">):</span>
<span class="k">async</span> <span class="k">def</span> <span class="nf">on_ready</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
<span class="nb">print</span><span class="p">(</span><span class="s1">'Logged on as </span><span class="si">{0}</span><span class="s1">!'</span><span class="o">.</span><span class="n">format</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">user</span><span class="p">))</span>
<span class="k">async</span> <span class="k">def</span> <span class="nf">on_message</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">message</span><span class="p">):</span>
<span class="nb">print</span><span class="p">(</span><span class="s1">'Message from </span><span class="si">{0.author}</span><span class="s1">: </span><span class="si">{0.content}</span><span class="s1">'</span><span class="o">.</span><span class="n">format</span><span class="p">(</span><span class="n">message</span><span class="p">))</span>
<span class="n">client</span> <span class="o">=</span> <span class="n">MyClient</span><span class="p">()</span>
<span class="n">client</span><span class="o">.</span><span class="n">run</span><span class="p">(</span><span class="s1">'my token goes here'</span><span class="p">)</span>
</pre></div>
</div>
</section>
</section>
</main>
<footer class="grid-item">
© Copyright 2015-2020, Rapptz.
Created using <a href="https://www.sphinx-doc.org/">Sphinx</a> 3.2.1.
</footer>
</div>
<div id="settings" class="modal" onclick="if (event.target == this){ settingsModal.close(); }" hidden>
<div class="modal-content">
<span class="close" onclick="settingsModal.close();" title="Close">
<span class="material-icons">close</span>
</span>
<h1>Settings</h1>
<h2>Font</h2>
<div class="setting">
<h3>Use a serif font:
<label class="toggle"
title="Use a serif font? Your system font will be used, falling back to serif.">
<input type="checkbox" name="useSerifFont" onclick="updateSetting(this);">
<span class="toggle-slider"></span>
</label>
</h3>
</div>
<h2>Theme</h2>
<div class="setting">
<h3>
<label class="toggle" title="Set your theme based on your system preferences">
<input type="radio" name="setTheme" onclick="updateSetting(this);" value="automatic" checked>
</label>
Automatic
</h3>
<h3>
<label class="toggle" title="Set your theme to light theme">
<input type="radio" name="setTheme" onclick="updateSetting(this);" value="light">
</label>
Light
</h3>
<h3>
<label class="toggle" title="Set your theme to dark theme">
<input type="radio" name="setTheme" onclick="updateSetting(this);" value="dark">
</label>
Dark
</h3>
</div>
</div>
</div>
<div id="to-top" onclick="scrollToTop()" hidden>
<span><span class="material-icons">arrow_upward</span> to top</span>
</div>
</body>
</html>