-
Notifications
You must be signed in to change notification settings - Fork 0
/
file.faq.html
164 lines (111 loc) · 14.5 KB
/
file.faq.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
<!DOCTYPE html>
<html>
<head>
<link rel="shortcut icon" href="/favicon.png" />
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>
File: FAQ
— discorb v0.20.0 documentation
</title>
<link rel="stylesheet" href="css/style.css" type="text/css" />
<link rel="stylesheet" href="css/common.css" type="text/css" />
<script type="text/javascript">
pathId = "faq";
relpath = '';
</script>
<script type="text/javascript" charset="utf-8" src="js/jquery.js"></script>
<script type="text/javascript" charset="utf-8" src="js/app.js"></script>
</head>
<body>
<div class="nav_wrap">
<iframe id="nav" src="file_list.html?1"></iframe>
<div id="resizer"></div>
</div>
<div id="main" tabindex="-1">
<div id="header">
<div id="menu">
<a href="a_index.html">Index</a> »
<span class="title">File: FAQ</span>
</div>
<div id="search">
<a class="full_list_link" id="class_list_link"
href="class_list.html">
<svg width="24" height="24">
<rect x="0" y="4" width="24" height="4" rx="1" ry="1"></rect>
<rect x="0" y="12" width="24" height="4" rx="1" ry="1"></rect>
<rect x="0" y="20" width="24" height="4" rx="1" ry="1"></rect>
</svg>
</a>
</div>
<div class="clear"></div>
</div>
<div id="content"><div id='filecontents'>
<h1 id="label-Fequently+asked+questions">Fequently asked questions</h1>
<h2 id="label-What+is+...-3F">What is …?</h2>
<h3 id="label-What+is+Async-3A-3ATask-3F">What is <code>Async::Task</code>?</h3>
<p>Async::Task is an object for asynchronous tasks.</p>
<p><a href="https://socketry.github.io/async">socketry.github.io/async</a>/ for more information.</p>
<h3 id="label-What+is+Guild-3F">What is <code>Guild</code>?</h3>
<p>It means a <code>server</code> of Discord.</p>
<h3 id="label-What+is+difference+between+User+and+Member-3F">What is difference between <code>User</code> and <code>Member</code>?</h3>
<p><code>User</code> is an object for account, <code>Member</code> is an object for user in guild.</p>
<h2 id="label-How+can+I+...-3F">How can I …?</h2>
<h3 id="label-How+can+I+do+something+with+sent+messages-3F">How can I do something with sent messages?</h3>
<p>Use <code>Async::Task#wait</code> method.</p>
<pre class="code ruby"><code class="ruby"><span class='comment'># NG
</span><span class='id identifier rubyid_message'>message</span> <span class='op'>=</span> <span class='id identifier rubyid_channel'>channel</span><span class='period'>.</span><span class='id identifier rubyid_post'>post</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>Hello world!</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span> <span class='comment'># => Async::Task
</span><span class='id identifier rubyid_message'>message</span><span class='period'>.</span><span class='id identifier rubyid_pin'>pin</span> <span class='comment'># => NoMethodError
</span>
<span class='comment'># OK
</span><span class='id identifier rubyid_message'>message</span> <span class='op'>=</span> <span class='id identifier rubyid_channel'>channel</span><span class='period'>.</span><span class='id identifier rubyid_post'>post</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>Hello world!</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_wait'>wait</span> <span class='comment'># => Message
</span><span class='id identifier rubyid_message'>message</span><span class='period'>.</span><span class='id identifier rubyid_pin'>pin</span>
</code></pre>
<h3 id="label-How+can+I+send+DM+to+a+user-3F">How can I send DM to a user?</h3>
<p>Use <span class='object_link'><a href="Discorb/Messageable.html#post-instance_method" title="Discorb::Messageable#post (method)">Discorb::Messageable#post</a></span> method, <span class='object_link'><a href="Discorb/User.html" title="Discorb::User (class)">Discorb::User</a></span> includes <span class='object_link'><a href="Discorb/Messageable.html" title="Discorb::Messageable (module)">Discorb::Messageable</a></span>.</p>
<h3 id="label-How+can+I+edit+status-3F">How can I edit status?</h3>
<p>Use <span class='object_link'><a href="Discorb/Client.html#update_presence-instance_method" title="Discorb::Client#update_presence (method)">Discorb::Client#update_presence</a></span> method.</p>
<pre class="code ruby"><code class="ruby"><span class='qsymbols_beg'>%i[</span><span class='tstring_content'>standby</span><span class='words_sep'> </span><span class='tstring_content'>guild_join</span><span class='words_sep'> </span><span class='tstring_content'>guild_leave</span><span class='tstring_end'>]</span></span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_event'>event</span><span class='op'>|</span>
<span class='id identifier rubyid_client'>client</span><span class='period'>.</span><span class='id identifier rubyid_on'>on</span> <span class='id identifier rubyid_event'>event</span> <span class='kw'>do</span>
<span class='id identifier rubyid_client'>client</span><span class='period'>.</span><span class='id identifier rubyid_update_presence'>update_presence</span><span class='lparen'>(</span>
<span class='const'><span class='object_link'><a href="Discorb.html" title="Discorb (module)">Discorb</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="Discorb/Activity.html" title="Discorb::Activity (class)">Activity</a></span></span><span class='period'>.</span><span class='id identifier rubyid_new'><span class='object_link'><a href="Discorb/Activity.html#initialize-instance_method" title="Discorb::Activity#initialize (method)">new</a></span></span><span class='lparen'>(</span>
<span class='tstring'><span class='tstring_beg'>"</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_client'>client</span><span class='period'>.</span><span class='id identifier rubyid_guilds'>guilds</span><span class='period'>.</span><span class='id identifier rubyid_length'>length</span><span class='embexpr_end'>}</span><span class='tstring_content'> Servers</span><span class='tstring_end'>"</span></span>
<span class='rparen'>)</span><span class='comma'>,</span>
<span class='label'>status:</span> <span class='symbol'>:online</span>
<span class='rparen'>)</span>
<span class='kw'>end</span>
<span class='kw'>end</span>
<span class='id identifier rubyid_client'>client</span><span class='period'>.</span><span class='id identifier rubyid_on'>on</span> <span class='symbol'>:ready</span> <span class='kw'>do</span>
<span class='id identifier rubyid_client'>client</span><span class='period'>.</span><span class='id identifier rubyid_update_presence'>update_presence</span><span class='lparen'>(</span><span class='label'>status:</span> <span class='symbol'>:dnd</span><span class='rparen'>)</span>
<span class='kw'>end</span>
</code></pre>
<h3 id="label-How+can+I+send+attachments-3F">How can I send attachments?</h3>
<p>Use <span class='object_link'><a href="Discorb/Attachment.html" title="Discorb::Attachment (class)">Discorb::Attachment</a></span> class.</p>
<pre class="code ruby"><code class="ruby"><span class='comment'># Send an attachment
</span><span class='id identifier rubyid_message'>message</span><span class='period'>.</span><span class='id identifier rubyid_channel'>channel</span><span class='period'>.</span><span class='id identifier rubyid_post'>post</span> <span class='label'>attachment:</span> <span class='const'><span class='object_link'><a href="Discorb.html" title="Discorb (module)">Discorb</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="Discorb/Attachment.html" title="Discorb::Attachment (class)">Attachment</a></span></span><span class='period'>.</span><span class='id identifier rubyid_new'><span class='object_link'><a href="Discorb/Attachment.html#initialize-instance_method" title="Discorb::Attachment#initialize (method)">new</a></span></span><span class='lparen'>(</span><span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_open'>open</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>./README.md</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span><span class='rparen'>)</span>
<span class='comment'># Send some attachment with text
</span><span class='id identifier rubyid_message'>message</span><span class='period'>.</span><span class='id identifier rubyid_channel'>channel</span><span class='period'>.</span><span class='id identifier rubyid_post'>post</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>File!</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='label'>attachments:</span> <span class='lbracket'>[</span><span class='const'><span class='object_link'><a href="Discorb.html" title="Discorb (module)">Discorb</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="Discorb/Attachment.html" title="Discorb::Attachment (class)">Attachment</a></span></span><span class='period'>.</span><span class='id identifier rubyid_new'><span class='object_link'><a href="Discorb/Attachment.html#initialize-instance_method" title="Discorb::Attachment#initialize (method)">new</a></span></span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>./README.md</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span><span class='comma'>,</span> <span class='const'><span class='object_link'><a href="Discorb.html" title="Discorb (module)">Discorb</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="Discorb/Attachment.html" title="Discorb::Attachment (class)">Attachment</a></span></span><span class='period'>.</span><span class='id identifier rubyid_new'><span class='object_link'><a href="Discorb/Attachment.html#initialize-instance_method" title="Discorb::Attachment#initialize (method)">new</a></span></span><span class='lparen'>(</span><span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_open'>open</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>./License.txt</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span><span class='rparen'>)</span><span class='rbracket'>]</span>
<span class='comment'># Send a string as an attachment
</span><span class='id identifier rubyid_message'>message</span><span class='period'>.</span><span class='id identifier rubyid_channel'>channel</span><span class='period'>.</span><span class='id identifier rubyid_post'>post</span> <span class='label'>attachments:</span> <span class='const'><span class='object_link'><a href="Discorb.html" title="Discorb (module)">Discorb</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="Discorb/Attachment.html" title="Discorb::Attachment (class)">Attachment</a></span></span><span class='period'>.</span><span class='id identifier rubyid_from_string'><span class='object_link'><a href="Discorb/Attachment.html#from_string-class_method" title="Discorb::Attachment.from_string (method)">from_string</a></span></span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>Hello world!</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>hello.txt</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span>
</code></pre>
<h3 id="label-How+can+I+add+reactions-3F">How can I add reactions?</h3>
<p>Use <span class='object_link'><a href="Discorb/Message.html#add_reaction-instance_method" title="Discorb::Message#add_reaction (method)">Discorb::Message#add_reaction</a></span> method.</p>
<pre class="code ruby"><code class="ruby"><span class='id identifier rubyid_message'>message</span><span class='period'>.</span><span class='id identifier rubyid_add_reaction'>add_reaction</span> <span class='const'><span class='object_link'><a href="Discorb.html" title="Discorb (module)">Discorb</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="Discorb/UnicodeEmoji.html" title="Discorb::UnicodeEmoji (class)">UnicodeEmoji</a></span></span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>🤔</span><span class='tstring_end'>"</span></span><span class='rbracket'>]</span>
<span class='id identifier rubyid_message'>message</span><span class='period'>.</span><span class='id identifier rubyid_add_reaction'>add_reaction</span> <span class='const'><span class='object_link'><a href="Discorb.html" title="Discorb (module)">Discorb</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="Discorb/UnicodeEmoji.html" title="Discorb::UnicodeEmoji (class)">UnicodeEmoji</a></span></span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>thinking</span><span class='tstring_end'>"</span></span><span class='rbracket'>]</span>
</code></pre>
<h1 id="label-Not+fequently+asked+questions">Not fequently asked questions</h1>
<h2 id="label-How+can+I+pronounce+discorb-3F">How can I pronounce <code>discorb</code>?</h2>
<p>Discorb is pronounced <code>disco-R-B</code>.</p>
<h2 id="label-Why+did+you+make+discorb-3F">Why did you make <code>discorb</code>?</h2>
<p>There are many reasons – One is I didn't like <code>discordrb</code>'s <code>bot.message</code> – but the main reason is, “Just for Fun”.</p>
<h2 id="label-How+was+discorb+named-3F">How was <code>discorb</code> named?</h2>
<p><code>discord</code> and <code>.rb</code>.</p>
</div></div>
<div id="footer">
Generated on Sat Sep 3 22:19:57 2022 by
<a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
0.9.28 (ruby-3.0.2).
</div>
</div>
</body>
</html>