Some of you were interested in what I was learning code wise.
So a lot of you were asking what I've been doing code wise, and how I've been getting on. It has been quite the discussion on discord and over twitter. Funnily enough I was hit by my own community that none of them care that I'm learning -- which I mean is fair, to get really good at this they will probably have to wait several years for me.
But it's a skill worth having so I thought I'd hook myself up with visual studio code and some node.js. Thankfully @klye has been there with me holding my hand. He's a pretty good helper.
One thing I wanted to do was to learn how to connect discord bots to the blockchain. I had achieved a lot of discord coding in the past when I did some jobs for @neoxian but it seems I could never ever work out the connection between blockchain and web2.
@klye showed me, and I realised it was far too complicated for my little mind to handle right now so I decided to give myself a smaller project and build it out from there.
First of all I decided to make a small discord bot that would reply to my pings in chat. I've done this before so it wasn't particularly hard.
I'm not going to show you this code because it's pretty silly showing a market full of coders my ping / pong attempts. It's like the first thing you learn after "Hello world!" - or at least at the same time.
Anyway, my next attempt was to get my bot to insult random people on my test discord as a way to teach myself how to get working with the modules part. Believe it or not I want to be a tidy coder, and part of that would be to not have my index.js file full of crap so that it takes me hours to find what I'm looking for if I'm ever needing to search for something.
So my index.js file looks something a bit like this. Bear in mind that I had help from an assistant that hooks onto my visual studio code.
If you inspect this code you will see that it does several things:
My bot waits for a message containing the phrase that it recognizes and switches the read to lower-case so that there are no mistakes. I opted to just go for a simple !insult instead of putting my operator in the .env file because I've already learned how to do that and my focus wasn't on that.
So you'll notice that the code recognises the username that is mentioned along with the prefix and action word and stores it.
Then it checks my other .js file to see if there is anything it can use here:
Then it takes these phrases (I was planning for more but I was in a hurry so I only thought of three) and makes sure they haven't been used in the last 20 turns. I asked the helper to do this one for me because I am still at this moment trying to figure out the "Math.floor" segment.
Then after that, it pushes the nicePhrase into the mentioned users DM
I had a lot of help with this one through the added assistant, but it was enjoyable doing it, and I think I have finally got my head around exporting modules now which was one that has eluded me for quite a while.
I'm still basic, but if I do just a few hours per day I'll definitely get my head around it I think. It's about time I finally learned how to do this stuff because I've always wanted to.
Haha, that "exporting modules" was a really pain in the *ss for me too 😂
!PGM
!LUV
BUY AND STAKE THE PGM TO SEND A LOT OF TOKENS!
The tokens that the command sends are: 0.1 PGM-0.1 LVL-0.1 THGAMING-0.05 DEC-15 SBT-1 STARBITS-[0.00000001 BTC (SWAP.BTC) only if you have 2500 PGM in stake or more ]
5000 PGM IN STAKE = 2x rewards!
Discord
Support the curation account @ pgm-curator with a delegation 10 HP - 50 HP - 100 HP - 500 HP - 1000 HP
Get potential votes from @ pgm-curator by paying in PGM, here is a guide
I'm a bot, if you want a hand ask @ zottone444
@hivecurious sent you LUV 🙂 (1/3)
Made with LUV by crrdlx
View or trade
BEER
.Hey @brofund, here is a little bit of
BEER
from @pixresteemer for you. Enjoy it!We love your support by voting @detlev.witness on HIVE .
Learning/knowing to code is such an awesome skill and I wish I wasn't so lazy and would pick up learning some coding myself.
Hehe. It's hard thats for sure!
You know I am just giving you a hard time. I recently started messing around with Python and Beem and it has been really fulfilling and rewarding to explore some new skills. I think it's cool what you are trying to do and that you are open to learning!
I know, I know, I was just messing :)
Thanks for the honourable mentions..!
I've no problem helping folks get a grasp on JS coding for HIVE and/or Discord. Certainly not a great teacher as I insist that people self teach / learn how to google and experiment with their apps.. But yeah, Glad you're getting the hang of it. I have a lot on my plate code wise at the moment between a handful of projects both client and personal.. But I don't mind helping fledgling coders get their start into the stuff. My way of paying it forward as at one time I'd had a mentor toss code at me and give me a hand with stuff.
If folks need a hand coding / getting started with code, and are willing to learn / self teach mostly and don't intend to use the code knowledge for evil, I'm around to help. :)