<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: 12944qwerty</title>
    <description>The latest articles on DEV Community by 12944qwerty (@12944qwerty).</description>
    <link>https://dev.to/12944qwerty</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F149343%2F1fd3b14c-f3e1-4d81-8b50-09cb687cacea.png</url>
      <title>DEV Community: 12944qwerty</title>
      <link>https://dev.to/12944qwerty</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/12944qwerty"/>
    <language>en</language>
    <item>
      <title>Hosting a Discord.py Bot with Repl.it</title>
      <dc:creator>12944qwerty</dc:creator>
      <pubDate>Mon, 08 Jun 2020 23:29:11 +0000</pubDate>
      <link>https://dev.to/12944qwerty/hosting-a-discord-py-bot-with-repl-it-3l5a</link>
      <guid>https://dev.to/12944qwerty/hosting-a-discord-py-bot-with-repl-it-3l5a</guid>
      <description>&lt;p&gt;I know that hosting a discord bot with &lt;a href="https://repl.it" rel="noopener noreferrer"&gt;Repl.it&lt;/a&gt; isn't very conventional. I've gotten multiple remarks about hosting it there. But I didn't really have any alternative ways of hosting a bot there.&lt;/p&gt;

&lt;p&gt;However, hosting a python discord bot with repl.it was quite hard. I had scraped the internet for quite some time before finding a solution.&lt;/p&gt;

&lt;p&gt;I just had to make a keep alive script and use &lt;a href="https://uptimerobot.com" rel="noopener noreferrer"&gt;Uptime Robot&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;The keep alive script is very simple and isn't very long. You just need to include flask in requirements.txt and use threads.&lt;br&gt;
&lt;code&gt;keep_alive.py&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;flask&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;Flask&lt;/span&gt;
&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;threading&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;Thread&lt;/span&gt;

&lt;span class="n"&gt;app&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;Flask&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;''&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="nd"&gt;@app.route&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;/&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;home&lt;/span&gt;&lt;span class="p"&gt;():&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Bot is online&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;

&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;run&lt;/span&gt;&lt;span class="p"&gt;():&lt;/span&gt;
  &lt;span class="n"&gt;app&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;run&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;host&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;0.0.0.0&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="n"&gt;port&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;8080&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;keep_alive&lt;/span&gt;&lt;span class="p"&gt;():&lt;/span&gt;  
    &lt;span class="n"&gt;t&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;Thread&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;target&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;run&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="n"&gt;t&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;start&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then on your main python file, import the &lt;code&gt;keep_alive()&lt;/code&gt; function. Then, right before you run your bot, include &lt;code&gt;keep_alive()&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;This code, in summary, makes a website that just says "Bot is online"&lt;/p&gt;

&lt;p&gt;However, repl.it doesn't keep this code on 24/7. You need to make a GET request to this site every so often for it to run constantly. This is where Uptime Robot comes in.&lt;/p&gt;

&lt;p&gt;Go to &lt;a href="https://uptimerobot.com" rel="noopener noreferrer"&gt;&lt;/a&gt;&lt;a href="https://uptimerobot.com" rel="noopener noreferrer"&gt;https://uptimerobot.com&lt;/a&gt; and sign up with a free plan. Then create a monitor by clicking the button.&lt;/p&gt;

&lt;p&gt;You should see a screen like this: &lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fi.ibb.co%2FHgyrd4q%2Fimage.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fi.ibb.co%2FHgyrd4q%2Fimage.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;For &lt;code&gt;monitor type&lt;/code&gt;, put Http(s). Put whatever unique name you want in &lt;code&gt;Friendly Name&lt;/code&gt;. For &lt;code&gt;URL (or IP)&lt;/code&gt; you want to put the URL that the flask shows up on. Once you run the discord bot on repl, a box appears on the top-right of the interface with the URL.&lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fh8g2vvbfw4a9ifkkgrcm.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fh8g2vvbfw4a9ifkkgrcm.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;That's it! It's done. Just click run on repl.it and you can close the tab. It works!&lt;/p&gt;

&lt;p&gt;If you have any questions, let me know :D&lt;/p&gt;

</description>
      <category>replit</category>
      <category>python</category>
    </item>
    <item>
      <title>How do you make arguments in bash with python?</title>
      <dc:creator>12944qwerty</dc:creator>
      <pubDate>Fri, 30 Aug 2019 12:43:09 +0000</pubDate>
      <link>https://dev.to/12944qwerty/how-do-you-make-arguments-in-bash-with-python-21l6</link>
      <guid>https://dev.to/12944qwerty/how-do-you-make-arguments-in-bash-with-python-21l6</guid>
      <description>&lt;p&gt;I've recently used django to make websites, and while making them, I found that I could enter arguments into python files. I used &lt;code&gt;python manage.py &amp;lt;arg&amp;gt;&lt;/code&gt; and it would do the specific things that it's supposed to do. I tried looking into &lt;code&gt;manage.py&lt;/code&gt; to see how this was possible, but there was nothing there that would allow me to customize these args. (these arguments are honestly hard for me to remember)&lt;/p&gt;

&lt;p&gt;So, my question for everyone, is how to make my own arguments? Or how to customize them?&lt;/p&gt;

</description>
      <category>python</category>
      <category>bash</category>
    </item>
    <item>
      <title>Repl.it - Pros &amp; Cons</title>
      <dc:creator>12944qwerty</dc:creator>
      <pubDate>Thu, 29 Aug 2019 19:16:38 +0000</pubDate>
      <link>https://dev.to/12944qwerty/repl-it-pros-cons-fj7</link>
      <guid>https://dev.to/12944qwerty/repl-it-pros-cons-fj7</guid>
      <description>&lt;p&gt;&lt;em&gt;This is my first post, so hopefully it will turn out well&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;I've used &lt;a href="//repl.it"&gt;repl.it&lt;/a&gt; multiple times in the past because I used a chromebook and didn't want to convert it to crouton. I found that it was a really good way for coding, in any language. I've used this for a couple months to code my discord bot, &lt;a href="https://github.com/12944qwerty/Ratchet" rel="noopener noreferrer"&gt;Ratchet&lt;/a&gt;. I've mainly used python for this, but all of the pros and cons should apply for many languages.&lt;/p&gt;

&lt;p&gt;All of the languages in these categories are included:&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fthepracticaldev.s3.amazonaws.com%2Fi%2Fv1z2ef5ffdkj3c83ns67.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fthepracticaldev.s3.amazonaws.com%2Fi%2Fv1z2ef5ffdkj3c83ns67.png" alt="Categories for languages img"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;&lt;em&gt;Pros&lt;/em&gt;&lt;/th&gt;
&lt;th&gt;&lt;em&gt;Cons&lt;/em&gt;&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;This is a web browser application. You don't need to download anything.&lt;/td&gt;
&lt;td&gt;You need to be connected to the internet for your code to run at all.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Addons are easy to 'download'. Just write their names.&lt;/td&gt;
&lt;td&gt;I only know of this for python&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;This can run for a really long time&lt;/td&gt;
&lt;td&gt;Not forever though. If you close your computer, it will stop.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Auto Saving onto Cloud. You can also download all of the files if you're offline&lt;/td&gt;
&lt;td&gt;Doesn't save onto cloud. So, if you refresh....&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Debugging&lt;/td&gt;
&lt;td&gt;I've never tried this feature, so, I don't know any cons...&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Real Time Collaborating&lt;/td&gt;
&lt;td&gt;Currently in Beta&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;A community. You can ask any questions for problems you have with repl or coding&lt;/td&gt;
&lt;td&gt;It is not as fast as stack overflow.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;It also has a console and uses linux&lt;/td&gt;
&lt;td&gt;This console is really hard to use, (for me). I couldn't understand how to do bash commands and etc.&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;I'll keep updating as I find more. (Or leave a comment for things you find)&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Let me know for anything I can improve on in the future with writing posts. As I said, it is my first post.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>replit</category>
      <category>pros</category>
      <category>cons</category>
    </item>
  </channel>
</rss>
