{"id":84,"date":"2024-05-30T13:56:35","date_gmt":"2024-05-30T17:56:35","guid":{"rendered":"https:\/\/theroyalscode.com\/students\/a_reynolds\/?p=84"},"modified":"2025-12-23T15:23:48","modified_gmt":"2025-12-23T20:23:48","slug":"free-friday-5-3-24-make-up","status":"publish","type":"post","link":"https:\/\/theroyalscode.com\/students\/a_reynolds\/2024\/05\/30\/free-friday-5-3-24-make-up\/","title":{"rendered":"Starting a Discord Bot (Free Friday 5\/3\/24) (Make Up)"},"content":{"rendered":"\n<p>Today I created a discord bot using discord.py. I started by going to the discord developer portal and creating an &#8220;app&#8221; (aka the bot) and getting the client token. Now that we have the client token we can use discord.py to program how the bot will behave. <\/p>\n\n\n\n<p>Here&#8217;s my code:<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img fetchpriority=\"high\" decoding=\"async\" width=\"1024\" height=\"915\" src=\"https:\/\/theroyalscode.com\/students\/a_reynolds\/wp-content\/uploads\/2024\/05\/code-1-1024x915.png\" alt=\"\" class=\"wp-image-86\" srcset=\"https:\/\/theroyalscode.com\/students\/a_reynolds\/wp-content\/uploads\/2024\/05\/code-1-1024x915.png 1024w, https:\/\/theroyalscode.com\/students\/a_reynolds\/wp-content\/uploads\/2024\/05\/code-1-300x268.png 300w, https:\/\/theroyalscode.com\/students\/a_reynolds\/wp-content\/uploads\/2024\/05\/code-1-768x687.png 768w, https:\/\/theroyalscode.com\/students\/a_reynolds\/wp-content\/uploads\/2024\/05\/code-1-1536x1373.png 1536w, https:\/\/theroyalscode.com\/students\/a_reynolds\/wp-content\/uploads\/2024\/05\/code-1.png 1602w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>I created a flip coin function that randomly decides between heads and tails. the bot awaits and detects a user saying the Command &#8220;*flip&#8221; and returns either Heads or Tails using the function. <\/p>\n\n\n\n<p>Here&#8217;s an example:<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" width=\"323\" height=\"626\" src=\"https:\/\/theroyalscode.com\/students\/a_reynolds\/wp-content\/uploads\/2024\/05\/Capture-1.png\" alt=\"\" class=\"wp-image-87\" srcset=\"https:\/\/theroyalscode.com\/students\/a_reynolds\/wp-content\/uploads\/2024\/05\/Capture-1.png 323w, https:\/\/theroyalscode.com\/students\/a_reynolds\/wp-content\/uploads\/2024\/05\/Capture-1-155x300.png 155w\" sizes=\"(max-width: 323px) 100vw, 323px\" \/><\/figure>\n\n\n\n<p>I plan on adding more commands soon and I had a lot of fun with this one!!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Today I created a discord bot using discord.py. I started by going to the discord developer portal and creating an &#8220;app&#8221; (aka the bot) and getting the client token. Now that we have the client token we can use discord.py to program how the bot will behave. Here&#8217;s my code: I created a flip coin [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-84","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/theroyalscode.com\/students\/a_reynolds\/wp-json\/wp\/v2\/posts\/84","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/theroyalscode.com\/students\/a_reynolds\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/theroyalscode.com\/students\/a_reynolds\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/theroyalscode.com\/students\/a_reynolds\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/theroyalscode.com\/students\/a_reynolds\/wp-json\/wp\/v2\/comments?post=84"}],"version-history":[{"count":2,"href":"https:\/\/theroyalscode.com\/students\/a_reynolds\/wp-json\/wp\/v2\/posts\/84\/revisions"}],"predecessor-version":[{"id":214,"href":"https:\/\/theroyalscode.com\/students\/a_reynolds\/wp-json\/wp\/v2\/posts\/84\/revisions\/214"}],"wp:attachment":[{"href":"https:\/\/theroyalscode.com\/students\/a_reynolds\/wp-json\/wp\/v2\/media?parent=84"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/theroyalscode.com\/students\/a_reynolds\/wp-json\/wp\/v2\/categories?post=84"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/theroyalscode.com\/students\/a_reynolds\/wp-json\/wp\/v2\/tags?post=84"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}