vigges.net Open in urlscan Pro
2606:4700:3034::ac43:a3b2  Public Scan

Submitted URL: https://vigges.net/qa/?qa=186574/c
Effective URL: https://vigges.net/qa/?qa=186574/c%23-dsharpplus-d%23-adding-reactions-to-messages-with-bot-for-game
Submission: On July 27 via api from US — Scanned from DE

Form analysis 8 forms found in the DOM

POST ./?qa=186574/c%23-dsharpplus-d%23-adding-reactions-to-messages-with-bot-for-game

<form method="post" action="./?qa=186574/c%23-dsharpplus-d%23-adding-reactions-to-messages-with-bot-for-game"> Welcome toVigges Developer Community-Open, Learning,Share <input name="notice_visitor" onclick="return qa_notice_click(this);"
    type="submit" value="X" class="qa-notice-close-button">
  <input name="code" type="hidden" value="0-1690468293-0610ec50dbd2e86d319bc6650e7f1d1048c8a581">
</form>

POST ./?qa=login&to=%3Fqa%3D186574%2Fc%2523-dsharpplus-d%2523-adding-reactions-to-messages-with-bot-for-game

<form action="./?qa=login&amp;to=%3Fqa%3D186574%2Fc%2523-dsharpplus-d%2523-adding-reactions-to-messages-with-bot-for-game" method="post">
  <input type="text" name="emailhandle" dir="auto" placeholder="Email or Username">
  <input type="password" name="password" dir="auto" placeholder="Password">
  <div><input type="checkbox" name="remember" id="qam-rememberme" value="1">
    <label for="qam-rememberme">Remember</label>
  </div>
  <input type="hidden" name="code" value="0-1690468293-7e0d038215ccb05e1439e6b525e6f3f753902549">
  <input type="submit" value="Login" class="qa-form-tall-button qa-form-tall-button-login" name="dologin">
</form>

GET ./?qa=search

<form method="get" action="./?qa=search">
  <input type="hidden" name="qa" value="search">
  <input type="text" placeholder="Search..." name="q" value="" class="qa-search-field">
  <input type="submit" value="Search" class="qa-search-button">
</form>

POST ./?qa=186574/c%23-dsharpplus-d%23-adding-reactions-to-messages-with-bot-for-game

<form method="post" action="./?qa=186574/c%23-dsharpplus-d%23-adding-reactions-to-messages-with-bot-for-game">
  <div class="qa-q-view-stats">
    <div class="qa-voting qa-voting-net" id="voting_186574">
      <div class="qa-vote-buttons qa-vote-buttons-net">
        <input title="Click to vote up" name="vote_186574_1_q186574" onclick="return qa_vote_click(this);" type="submit" value="+" class="qa-vote-first-button qa-vote-up-button">
        <input title="Click to vote down" name="vote_186574_-1_q186574" onclick="return qa_vote_click(this);" type="submit" value="–" class="qa-vote-second-button qa-vote-down-button">
      </div>
      <div class="qa-vote-count qa-vote-count-net">
        <span class="qa-netvote-count">
          <span class="qa-netvote-count-data">0</span><span class="qa-netvote-count-pad"> votes
            <meta itemprop="upvoteCount" content="0">
          </span>
        </span>
      </div>
      <div class="qa-vote-clear">
      </div>
    </div>
    <span class="qa-view-count">
      <span class="qa-view-count-data">383</span><span class="qa-view-count-pad"> views</span>
    </span>
  </div>
  <input name="code" type="hidden" value="0-1690468293-f01b1b790ad0ad1a6a05325084b9f3de780fc0d1">
</form>

POST ./?qa=186574/c%23-dsharpplus-d%23-adding-reactions-to-messages-with-bot-for-game

<form method="post" action="./?qa=186574/c%23-dsharpplus-d%23-adding-reactions-to-messages-with-bot-for-game" style="height: auto !important;">
  <span class="qa-q-view-avatar-meta">
    <span class="qa-q-view-avatar">
      <a href="./?qa=user/%E6%B7%B1%E8%93%9D" class="qa-avatar-link"><img src="./?qa=image&amp;qa_blobid=9497455313653366137&amp;qa_size=50" width="50" height="50" class="qa-avatar-image" alt=""></a>
    </span>
    <span class="qa-q-view-meta">
      <a href="./?qa=186574/c%23-dsharpplus-d%23-adding-reactions-to-messages-with-bot-for-game" class="qa-q-view-what" itemprop="url">asked</a>
      <span class="qa-q-view-when">
        <span class="qa-q-view-when-data"><time itemprop="dateCreated" datetime="2021-10-06T03:08:13+0000" title="2021-10-06T03:08:13+0000">Oct 6, 2021</time></span>
      </span>
      <span class="qa-q-view-where">
        <span class="qa-q-view-where-pad">in </span><span class="qa-q-view-where-data"><a href="./?qa=Technique" class="qa-category-link">Technique[技术]</a></span>
      </span>
      <span class="qa-q-view-who">
        <span class="qa-q-view-who-pad">by </span>
        <span class="qa-q-view-who-data"><span itemprop="author" itemscope="" itemtype="https://schema.org/Person"><a href="./?qa=user/%E6%B7%B1%E8%93%9D" class="qa-user-link" itemprop="url"><span itemprop="name">深蓝</span></a></span></span>
        <span class="qa-q-view-who-points">
          <span class="qa-q-view-who-points-pad">(</span><span class="qa-q-view-who-points-data">71.8m</span><span class="qa-q-view-who-points-pad"> points)</span>
        </span>
      </span>
    </span>
  </span>
  <h3>
    <span itemprop="name"> c# - DSharpPlus (D#+) Adding Reactions To Messages With Bot For Game </span>
  </h3>
  <div class="qa-q-view-content qa-post-content" style="height: auto !important;">
    <a name="186574"></a>
    <div itemprop="text" style="height: auto !important;">
      <p>I'm trying to make a bot that you can request to play rock paper scissors with another player. It asks the challenged player whether they want to play, if they accept, the bot then creates a message with 3 reactions that once reacted to by
        the relative player will delete itself and save the choice. Then it repeats for the other player. Then it says who won / drew.</p>
      <pre><code>public class Games : BaseCommandModule
{
    [Command("rps")]
    public async Task ReactionCommand(CommandContext ctx, DiscordMember member)
    {
        var emoji = DiscordEmoji.FromName(ctx.Client, ":scissors:");
        var challenger = ctx.Member;
        var opponent = member;
        var message = await ctx.RespondAsync($"{opponent.Mention}, react with {emoji} if you'd like to play Rock Paper Scissors with {challenger.DisplayName}?");
        await message.CreateReactionAsync(emoji);
        var result = await message.WaitForReactionAsync(opponent, emoji);
        if (!result.TimedOut)
        {
            var message2 = await ctx.RespondAsync($"{opponent.Mention}, react with your choice.");
            await message2.CreateReactionAsync(DiscordEmoji.FromName(ctx.Client, ":rock:"));
            await message2.CreateReactionAsync(DiscordEmoji.FromName(ctx.Client, ":scissors:"));
            await message2.CreateReactionAsync(DiscordEmoji.FromName(ctx.Client, ":roll_of_paper:"));
        }
    }

}
</code></pre>
      <div class="google-auto-placed ap_container" style="width: 100%; height: auto; clear: both; text-align: center;"><ins data-ad-format="auto" class="adsbygoogle adsbygoogle-noablate" data-ad-client="ca-pub-1416119137658217"
          data-adsbygoogle-status="done" style="display: block; margin: auto; background-color: transparent; height: 280px;" data-ad-status="filled">
          <div id="aswift_2_host" tabindex="0" title="Advertisement" aria-label="Advertisement"
            style="border: none; height: 280px; width: 814px; margin: 0px; padding: 0px; position: relative; visibility: visible; background-color: transparent; display: inline-block; overflow: visible;"><iframe id="aswift_2" name="aswift_2"
              style="left:0;position:absolute;top:0;border:0;width:814px;height:280px;" sandbox="allow-forms allow-popups allow-popups-to-escape-sandbox allow-same-origin allow-scripts allow-top-navigation-by-user-activation" width="814" height="280"
              frameborder="0" marginwidth="0" marginheight="0" vspace="0" hspace="0" allowtransparency="true" scrolling="no"
              src="https://googleads.g.doubleclick.net/pagead/ads?client=ca-pub-1416119137658217&amp;output=html&amp;h=280&amp;adk=3548209664&amp;adf=4156364004&amp;pi=t.aa~a.2421684978~i.3~rp.4&amp;w=814&amp;fwrn=4&amp;fwrnh=100&amp;lmt=1690468296&amp;num_ads=1&amp;rafmt=1&amp;armr=3&amp;sem=mc&amp;pwprc=3737280490&amp;ad_type=text_image&amp;format=814x280&amp;url=https%3A%2F%2Fvigges.net%2Fqa%2F%3Fqa%3D186574%2Fc%2523-dsharpplus-d%2523-adding-reactions-to-messages-with-bot-for-game&amp;fwr=0&amp;pra=3&amp;rh=200&amp;rw=813&amp;rpe=1&amp;resp_fmts=3&amp;wgl=1&amp;fa=27&amp;uach=WyIiLCIiLCIiLCIiLCIiLFtdLDAsbnVsbCwiIixbXSwwXQ..&amp;dt=1690468296134&amp;bpp=1&amp;bdt=2438&amp;idt=1&amp;shv=r20230725&amp;mjsv=m202307200101&amp;ptt=9&amp;saldr=aa&amp;abxe=1&amp;cookie=ID%3D596c6775b7df5c8f-22399bbf0ce300fd%3AT%3D1690468295%3ART%3D1690468295%3AS%3DALNI_MbUGIEHzJ1C7z0icAisX6H87djqag&amp;gpic=UID%3D00000c47c8f79d86%3AT%3D1690468295%3ART%3D1690468295%3AS%3DALNI_Mb9Fm2nHbOCNeY5McN8GB9bnyx0-g&amp;prev_fmts=0x0%2C1200x280&amp;nras=3&amp;correlator=5070745507162&amp;frm=20&amp;pv=1&amp;ga_vid=894022285.1690468295&amp;ga_sid=1690468296&amp;ga_hid=2007347567&amp;ga_fc=1&amp;u_tz=0&amp;u_his=2&amp;u_h=1200&amp;u_w=1600&amp;u_ah=1200&amp;u_aw=1600&amp;u_cd=24&amp;u_sd=1&amp;dmc=8&amp;adx=246&amp;ady=1290&amp;biw=1600&amp;bih=1200&amp;scr_x=0&amp;scr_y=0&amp;eid=44759876%2C44759927%2C44759842%2C31076445%2C44788441&amp;oid=2&amp;psts=ABnkTfCTD3SowyLQepFVC4-0BtZPq5VvRsmv3YXWVdeUjlg0s7vZ13wWL2Rs3FTBJPuhYAsJQVFpoQT84FVj&amp;pvsid=4077175212506158&amp;tmod=1215696640&amp;uas=0&amp;nvt=1&amp;fc=1408&amp;brdim=0%2C0%2C0%2C0%2C1600%2C0%2C1600%2C1200%2C1600%2C1200&amp;vis=1&amp;rsz=%7C%7Cs%7C&amp;abl=NS&amp;fu=128&amp;bc=31&amp;ifi=3&amp;uci=a!3&amp;btvi=1&amp;fsb=1&amp;xpc=BemwdQxoAm&amp;p=https%3A//vigges.net&amp;dtd=4"
              data-google-container-id="a!3" data-google-query-id="CK-6sJKNr4ADFdaFUAYd9hwLpQ" data-load-complete="true"></iframe></div>
        </ins></div>
      <p>It does not add the reactions to the message. I am also wondering how I would be able to tell what reaction the person did. So the whole thing works for the part where it asks to confirm whether I want to play. I react with the scissors,
        then it says the 'member, react with your choice' but with no reactions. Thank you.</p>
      <p>P.S. The console has no errors.</p> question
      from:<a href="https://stackoverflow.com/questions/66056222/dsharpplus-d-adding-reactions-to-messages-with-bot-for-game" rel="nofollow" target="_blank">https://stackoverflow.com/questions/66056222/dsharpplus-d-adding-reactions-to-messages-with-bot-for-game</a>
    </div><br>
    <div class="signature" style="font-size:14px;overflow:hidden;margin-bottom:10px;padding-top:20px;line-height:1.6em;background:url(https://www.dismall.com/static/image/common/sigline.gif) no-repeat 0 0;">与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…</div>
  </div>
  <div class="qa-q-view-tags">
    <ul class="qa-q-view-tag-list">
      <li class="qa-q-view-tag-item"><a href="./?qa=tag/%09c%23" rel="tag" class="qa-tag-link">	c#</a></li>
    </ul>
  </div>
  <div class="qa-q-view-buttons">
    <input name="q_doanswer" id="q_doanswer" onclick="return qa_toggle_element('anew')" value="answer" title="Answer this question" type="submit" class="qa-form-light-button qa-form-light-button-answer">
    <input name="q_docomment" onclick="return qa_toggle_element('c186574')" value="comment" title="Add a comment on this question" type="submit" class="qa-form-light-button qa-form-light-button-comment">
  </div>
  <input name="code" type="hidden" value="0-1690468293-249bc49db120f71d15efed2b9b91534f14f4dc26">
  <input name="qa_click" type="hidden" value="">
</form>

POST ./?qa=186574/c%23-dsharpplus-d%23-adding-reactions-to-messages-with-bot-for-game

<form method="post" action="./?qa=186574/c%23-dsharpplus-d%23-adding-reactions-to-messages-with-bot-for-game">
  <div class="qa-voting qa-voting-net" id="voting_186575">
    <div class="qa-vote-buttons qa-vote-buttons-net">
      <input title="Click to vote up" name="vote_186575_1_a186575" onclick="return qa_vote_click(this);" type="submit" value="+" class="qa-vote-first-button qa-vote-up-button">
      <input title="Click to vote down" name="vote_186575_-1_a186575" onclick="return qa_vote_click(this);" type="submit" value="–" class="qa-vote-second-button qa-vote-down-button">
    </div>
    <div class="qa-vote-count qa-vote-count-net">
      <span class="qa-netvote-count">
        <span class="qa-netvote-count-data">0</span><span class="qa-netvote-count-pad"> votes
          <meta itemprop="upvoteCount" content="0">
        </span>
      </span>
    </div>
    <div class="qa-vote-clear">
    </div>
  </div>
  <input name="code" type="hidden" value="0-1690468293-f01b1b790ad0ad1a6a05325084b9f3de780fc0d1">
</form>

POST ./?qa=186574/c%23-dsharpplus-d%23-adding-reactions-to-messages-with-bot-for-game

<form method="post" action="./?qa=186574/c%23-dsharpplus-d%23-adding-reactions-to-messages-with-bot-for-game">
  <span class="qa-a-item-avatar-meta">
    <span class="qa-a-item-avatar">
      <a href="./?qa=user/%E6%B7%B1%E8%93%9D" class="qa-avatar-link"><img src="./?qa=image&amp;qa_blobid=9497455313653366137&amp;qa_size=40" width="40" height="40" class="qa-avatar-image" alt=""></a>
    </span>
    <span class="qa-a-item-meta">
      <a href="./?qa=186574/c%23-dsharpplus-d%23-adding-reactions-to-messages-with-bot-for-game&amp;show=186575#a186575" class="qa-a-item-what" itemprop="url">answered</a>
      <span class="qa-a-item-when">
        <span class="qa-a-item-when-data"><time itemprop="dateCreated" datetime="2021-10-06T03:08:13+0000" title="2021-10-06T03:08:13+0000">Oct 6, 2021</time></span>
      </span>
      <span class="qa-a-item-who">
        <span class="qa-a-item-who-pad">by </span>
        <span class="qa-a-item-who-data"><span itemprop="author" itemscope="" itemtype="https://schema.org/Person"><a href="./?qa=user/%E6%B7%B1%E8%93%9D" class="qa-user-link" itemprop="url"><span itemprop="name">深蓝</span></a></span></span>
        <span class="qa-a-item-who-points">
          <span class="qa-a-item-who-points-pad">(</span><span class="qa-a-item-who-points-data">71.8m</span><span class="qa-a-item-who-points-pad"> points)</span>
        </span>
      </span>
    </span>
  </span>
  <div class="qa-a-selection">
  </div>
  <div class="qa-a-item-content qa-post-content">
    <a name="186575"></a>
    <div itemprop="text">Waitting for answers</div><br>
    <div class="signature" style="font-size:14px;overflow:hidden;margin-bottom:10px;padding-top:20px;line-height:1.6em;background:url(https://www.dismall.com/static/image/common/sigline.gif) no-repeat 0 0;">与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…</div>
  </div>
  <div class="qa-a-item-buttons">
    <input name="a186575_dofollow" value="ask related question" title="Ask a new question relating to this answer" type="submit" class="qa-form-light-button qa-form-light-button-follow">
    <input name="a186575_docomment" onclick="return qa_toggle_element('c186575')" value="comment" title="Add a comment on this answer" type="submit" class="qa-form-light-button qa-form-light-button-comment">
  </div>
  <input name="code" type="hidden" value="0-1690468293-36e54faafec94dee97b41a086884b748a2284589">
  <input name="qa_click" type="hidden" value="">
</form>

GET ./?qa=search

<form method="get" action="./?qa=search">
  <input type="hidden" name="qa" value="search">
  <input type="text" placeholder="Search..." name="q" value="" class="qa-search-field">
  <input type="submit" value="Search" class="qa-search-button">
</form>

Text Content

Welcome toVigges Developer Community-Open, Learning,Share
Login
Remember
 * Register



 * Ask
 * Q&A
 * All Activity
 * Hot!
 * Unanswered
 * Tags
 * Users
 * Ask a Question



Ask a Question






CATEGORIES

All categories
Topic[话题] (13)
Life[生活] (4)
Technique[技术] (2.1m)
Idea[创意] (3)
Jobs[工作] (2)
Others[杂七杂八] (18)
Code Example[编程示例] (0)


C# - DSHARPPLUS (D#+) ADDING REACTIONS TO MESSAGES WITH BOT FOR GAME

0 votes

383 views
asked Oct 6, 2021 in Technique[技术] by 深蓝 (71.8m points)


C# - DSHARPPLUS (D#+) ADDING REACTIONS TO MESSAGES WITH BOT FOR GAME

I'm trying to make a bot that you can request to play rock paper scissors with
another player. It asks the challenged player whether they want to play, if they
accept, the bot then creates a message with 3 reactions that once reacted to by
the relative player will delete itself and save the choice. Then it repeats for
the other player. Then it says who won / drew.

public class Games : BaseCommandModule
{
    [Command("rps")]
    public async Task ReactionCommand(CommandContext ctx, DiscordMember member)
    {
        var emoji = DiscordEmoji.FromName(ctx.Client, ":scissors:");
        var challenger = ctx.Member;
        var opponent = member;
        var message = await ctx.RespondAsync($"{opponent.Mention}, react with {emoji} if you'd like to play Rock Paper Scissors with {challenger.DisplayName}?");
        await message.CreateReactionAsync(emoji);
        var result = await message.WaitForReactionAsync(opponent, emoji);
        if (!result.TimedOut)
        {
            var message2 = await ctx.RespondAsync($"{opponent.Mention}, react with your choice.");
            await message2.CreateReactionAsync(DiscordEmoji.FromName(ctx.Client, ":rock:"));
            await message2.CreateReactionAsync(DiscordEmoji.FromName(ctx.Client, ":scissors:"));
            await message2.CreateReactionAsync(DiscordEmoji.FromName(ctx.Client, ":roll_of_paper:"));
        }
    }

}




It does not add the reactions to the message. I am also wondering how I would be
able to tell what reaction the person did. So the whole thing works for the part
where it asks to confirm whether I want to play. I react with the scissors, then
it says the 'member, react with your choice' but with no reactions. Thank you.

P.S. The console has no errors.

question
from:https://stackoverflow.com/questions/66056222/dsharpplus-d-adding-reactions-to-messages-with-bot-for-game

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
 * c#





PLEASE LOG IN OR REGISTER TO ADD A COMMENT.






PLEASE LOG IN OR REGISTER TO ANSWER THIS QUESTION.


1 ANSWER

0 votes

answered Oct 6, 2021 by 深蓝 (71.8m points)

Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…




PLEASE LOG IN OR REGISTER TO ADD A COMMENT.



Welcome to Vigges Developer Community for programmer and developer-Open,
Learning and Share


JUST BROWSING BROWSING

[1] functional programming - Reversing list vs non tail recursion when
traversing lists
[2] AttributeError: 'function' object has no attribute 'HTML'
[3] console.log打印和对象属性改变哪个在前????
[4] python - How to log a django view
[5] 如何基于相同字符串上锁?
[6] vue 项目打包后多出几个worker文件,他们是干什么的
[7] sdk - iOS - Get device's WIFI IP Address
[8] 为什么 StatefulWidget 被分成 StatefulWidget 和 State 两部分?
[9] python - Can magic command %run accepts dynamic path in Azure Databricks?
[10] Lodash isLength源码

2.1m questions

2.1m answers

35 comments

52.5k users


MOST POPULAR TAGS

javascript python c# java How android c++ php ios html sql r c node.js .net
iphone asp.net css reactjs jquery ruby What Android objective mysql linux Is git
Python windows Why regex angular swift amazon excel algorithm macos Java visual
how bash Can multithreading PHP Using scala angularjs typescript apache spring
performance postgresql database flutter json rust arrays C# dart vba django wpf
xml vue.js In go Get google jQuery xcode jsf http Google mongodb string shell
oop powershell SQL C++ security assembly docker Javascript Android: Does haskell
Convert azure debugging delphi vb.net Spring datetime pandas oracle math Django

   
   
   联盟问答网站-Union QA website

   --------------------------------------------------------------------------------

 * Xstack问答社区
 * 生活宝问答社区
 * OverStack问答社区
 * Ostack问答社区
 * 在这了问答社区
 * 在哪了问答社区
 * Xstack问答社区
 * 无极谷问答社区
 * TouSu问答社区
 * SQlite问答社区
 * Qi-U问答社区
 * MLink问答社区
 * Jonic问答社区
 * Jike问答社区
 * 16892问答社区
 * Vigges问答社区
 * 55276问答社区
 * OGeek问答社区
 * 深圳家问答社区
 * 深圳家问答社区
 * 深圳家问答社区
 * Vigges问答社区
 * Vigges问答社区
 * 在这了问答社区

   --------------------------------------------------------------------------------

 * Xstack问答社区
 * 生活宝问答社区
 * OverStack问答社区
 * Ostack问答社区
 * 在这了问答社区
 * 在哪了问答社区
 * Xstack问答社区
 * 无极谷问答社区
 * TouSu问答社区
 * SQlite问答社区
 * Qi-U问答社区
 * MLink问答社区
 * Jonic问答社区
 * Jike问答社区
 * 16892问答社区
 * Vigges问答社区
 * 55276问答社区
 * OGeek问答社区
 * 深圳家问答社区
 * 深圳家问答社区
 * 深圳家问答社区
 * Vigges问答社区
 * Vigges问答社区
 * 在这了问答社区
 * 在这了问答社区

   --------------------------------------------------------------------------------

 * Xstack问答社区
 * 生活宝问答社区
 * OverStack问答社区
 * Ostack问答社区
 * 在这了问答社区
 * 在哪了问答社区
 * Xstack问答社区
 * 无极谷问答社区
 * TouSu问答社区
 * SQlite问答社区
 * Qi-U问答社区
 * MLink问答社区
 * Jonic问答社区
 * Jike问答社区
 * 16892问答社区
 * Vigges问答社区
 * 55276问答社区
 * OGeek问答社区
 * 深圳家问答社区
 * 深圳家问答社区
 * 深圳家问答社区
 * Vigges问答社区
 * Vigges问答社区
 * 在这了问答社区

   --------------------------------------------------------------------------------

   广告位招租

 * Send feedback
 * 深圳家
 * 深圳家
 * 极客中国
 * 搜外友链
 * Ostack Developer QA ZONE
 * CC BY-SA 3.0
 * Contact with WebMaster by Email: jeky_zhao@qq.com


Snow Theme by Q2A Market
Powered by Question2Answer

...