Hello everyone! This is my first contribution after changing my account from @rodus to @rodux due to some difficulties. I've been working on this for some time. I started this bot while creating tutorials. In tutorials, I created commands but I wanted to improve it and here I am after improving it. If you don't know about this then here's a brief introduction for you.
Github Repository
https://github.com/Rodux7/DiscordSteem
Introduction
DiscordSteem is a bot built in Python language, using two main libraries. The first one is "Beem" and the second one is "Discord.py". This bot has many cool commands that you can use to get quick access to posts, comments, or even specifically contributions.
Commands
Here are commands that bot has at the moment. I will be adding more commands in the future but these are the ones that are present at the moment.
- Blog Command
- Feed Command
- Comments Command
- Contributions Command
- Info Command
- Ticker Command
- Notes Commands
Blog Command
The first command is Blog Command. You will be able to get blog posts of any user using this command. Usage of this command is !blog <user> <amount>
. There is one required parameter and the other one is optional. The required parameter is the "user", and this will be the username of any Steemit user whose blog you want. The second parameter which is optional is "amount" which is going to be the amount of posts you want. By default, this amount is set to 3. Here's how it looks like when it is working!
Clicking on "Check out this post!" will take you to the original post on Steemit. You can also assign the amount of post like down in the below image.
Feed Command
You will be able to get feed of any user using this command. Usage of this command is very similar to the last command. You can use this command by typing !feed <user> <amount>
. Again, there are two parameters that you can assign and out of those two parameters, one is required while other is not. Amount is set to 3 by default like last one. Here's how it looks when it is working.
Here's how it looks when we assign the custom amount.
Comments Command
Using this command you will be able to get last comments of any user. Usage of this command is also very similar to last ones. Usage of this command is !comments <user> <amount>
. User will be any Steem user and it is required. The amount is optional and is set to 3 by default. Here's how it works!
Since comments don't actually have it's own title and I can't show full comment due to character limit, I used the title of the post in which comment was made. Here's how it works when we assign the amount.
Contributions Command
Using this command, user will be able to check anyone's contributions that they have submitted through Utopian. This command will also be used like other commands !contributions <user> <amount>
. User will be any Steem username and amount will be any number. By default, is is 3.
Shoutout to @scipio for making awesome tutorials!
Info Command
This command will give general information about any account like how many followers it has, how many people is account following, how many witnesses is account voting for and more. You can use this command by typing !info <user>
. User will be any Steem username and this is required. Here's how it works.
Ticker Command
This command can be used to get price of different coins in different currencies. You can use this command by typing !ticker <coin> <currency>
. Coin is necessary, while currency is set to USD by default. These currencies are supported at the moment.
"AUD", "BRL", "CAD", "CHF", "CLP", "CNY", "CZK", "DKK", "EUR", "GBP", "HKD", "HUF", "IDR", "ILS", "INR", "JPY", "KRW", "MXN", "MYR", "NOK", "NZD", "PHP", "PKR", "PLN", "RUB", "SEK", "SGD", "THB", "TRY", "TWD", "ZAR"
Here's how command looks when it working and correct parameters are assigned. As you can see in the below image, there should be full name of the coin. Short forms won't work.
You can assign different currencies and coins like done in the image below.
Notes Commands
Notes commands are actually three commands that you can use to add, recall or delete notes. I have used PyMongo to store the notes in case the script stops. The three commands are !addnote "<note>"
, !note
and !delnote
. When you add note, make sure that it is in quotation marks.!note
will recall notes and !delnote
will delete all the notes.
How To Set It Up To Be Used In Server
First of all open the terminal and type git clone https://github.com/Rodux7/DiscordSteem
. This will clone the github repository, make sure you have the "git" installed.
After cloning the repository, run this command in the terminal sudo apt-get install build-essential libssl-dev python-dev
. This is necessary for the installation of Beem which is required for the bot to function properly. Now proceed to the directory by typing cd DiscordSteem
. Inside it type pip install -r requirements.txt
. This will install other necessary things.
Now go to Discord Developer Page and login. Create a new application and get the token. You can learn in depth from here. Replace the token in the DiscordSteem file. Add the bot to the discord server which is also present in this link. You can now run the bot by typing python DiscordSteem.py
and this will make the bot online and commands will be working!
Tutorials
If anyone of you are curious into looking how basic commands of this bot were made, you should look into the tutorials that are present below.
Very cool to see you make this bot! I like it :D I got some feedback for you anyways.
I would probably make the info command show a lot more information. For one part I do think that you should display at least one more digit to the reputation as especially when you are in the higher range, your reputation doesn't change for a long time, and it would be disappointing to only see the full number ;)
Also, I would highly recommend you to show the SBD and STEEM in the savings as well for the info command. You could make this for example by making it like that (as a return to
?info steemit
in the STEEM Balance field): 2,000,000.580 (2,806,644.632) STEEMI think the vested balance is also a very important piece of information on the steem blockchain that should be included in an info command. e.g. @utopian-io doesn't really look that "good" if you only see it's balance, but not it's SP :P
Now a little coding advice for you, that you could make use of in the future. Consider using the logging module (documentation) instead of printing the different things to the console. That makes it way more flexible and you'll just have a more convenient experince with logging stuff in the execution of your program.
Also, as far as I know, it's recommended to use other string formatting methods as they are easier to read and maybe have some other advantages as well. Instead of
"These are last %s comments of %s" % (amount, username)
you could just make it look that way:f"These are last {amount} comments of {username}"
. I think this is way more readable and highly improves your code look. @scipio made a tutorial on that way of formatting strings, and there is plenty of documentation for it as well if you want to look into it more. :)On a final note: why did you change your name? "Some difficulties" isn't that much information ;)
Thank you for reading that wall of text,
Schwein
PS: I'm not a professional developer, and if any of the information I provided is wrong, please forgive me. :)
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit
Thanks for writing this feedback. I just added another commit, bot now uses F-Strings. I have also added that you can now see SP using the !info command as well. I haven't used logging yet because I don't have that much experience in it but I will consider it in future. Thanks again : )
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit
Hey @flugschwein
Here's a tip for your valuable feedback! @Utopian-io loves and incentivises informative comments.
Contributing on Utopian
Learn how to contribute on our website.
Want to chat? Join us on Discord https://discord.gg/h52nFrV.
Vote for Utopian Witness!
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit
@rodux, I gave you a vote!
If you follow me, I will also follow you in return!
Enjoy some !popcorn courtesy of @nextgencrypto!
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit
Congratulations @rodux! You have completed the following achievement on the Steem blockchain and have been rewarded with new badge(s) :
Award for the number of upvotes received
Click on the badge to view your Board of Honor.
If you no longer want to receive notifications, reply to this comment with the word
STOP
To support your work, I also upvoted your post!
Do not miss the last post from @steemitboard:
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit
Wow, this looks like a really cool bot. I would love to use that for the 1UP platform that I am building and include our communties there. They are usually based on tags which should be simple to pull the data from. Why don't why talk about this on Discord? Come over to our 1UP channel if you have time. You might earn some UP bounties . :)
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit
@rodux, First of all it's unfortunate to hear that you faced difficulties in your previous account because, we put so much effort to develop our profile in an competitive Economy.
Congratulations and want to appreciate your work regrading the DiscordSteem and it sounds really effective Bot so i wish that this Bot will bring the Productive results.
And the list of Commands which we are reading in this post, is reflecting as really important aspects when we talk about the Discord and good to hear that you are working on more.
And the Tutorial of commands is really appreciable because in that way people can understand in what respect these Commands will work.
Wishing you an great day and stay blessed. 🙂
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit
Congratulations @rodux! You have completed the following achievement on the Steem blockchain and have been rewarded with new badge(s) :
You made your First Comment
Award for the number of upvotes received
Click on the badge to view your Board of Honor.
If you no longer want to receive notifications, reply to this comment with the word
STOP
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit
Congratulations @rodux! You have completed the following achievement on the Steem blockchain and have been rewarded with new badge(s) :
You got your First payout
Award for the total payout received
Click on the badge to view your Board of Honor.
If you no longer want to receive notifications, reply to this comment with the word
STOP
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit