Making a twitter bot

3 01 2015

Met with George and Marie at the London Hackspace to make twitter bots.

Started out by looking at hosting the bot, first port of call

Even a simple _ebooks type bot needs to be hosted somewhere

a static IP connected constantly yo the internet

chose ruby from the options and followed the instructions to install ruby gem and bundler

i already had ruby and gem installed, we checked by opening terminal and searching for versions installing bundler was a bit tricker as I ruby and gem were install on my admin user not my day to day user (this is probably inaccurate) but I could get it to install it by typing sudo user (super user do) kinda tricking it into thinking I was the admin (which I am, just not from where i was accessing the terminal)

ERROR:  While executing gem … (Gem::FilePermissionError)

    You don’t have write permissions for the /Library/Ruby/Gems/2.0.0 directory.

users-mbp-3:~ user$ sudo gem install bundler

installed the heroku toolbelt (by downlaoding and typing into terminal) which installed git. also need xcode which i already had

follwed instructions in th tutorial to install a demo app. typed into terminal to get to a specific folder

users-mbp-3:ruby-getting-started user$ open . 

^ is folder name              ^ is a neat ay to open the folder in the finder

opened gemfile in sublime 2 to see what gems the app will be using. The bundler sorts out actually getting all the gems – this is just a shopping list for it.

ls shows the same info in less detail in the terminal

ls -al shows more info in terminal

in this folder, I typed

 heroku create

to ‘create’ the app then uploaded it from my spanking new local git repository to heroku with

git push heroku master
 heroku ps:scale web=1

tell the server you want to run one instance of this app – scaled up from zero which is basically the difference between existing or not. (this is just the terminal version of doing the same thing in the pretty dashboard sliders on the heroku website)

Now I’ve got some free hosting, it’s time to make the twitter bot app. Then we stopped following the tutorial and moved on to making the app I’ll be pushing to heroku for real.

We start out looking at

went to git hub repository and copied it into the terminal using

sudo gem install twitter_ebooks

clone git

this created a folder local to my machine that had bots.rb in it this is the bot that I can edit to make my own bot.

I’d already downloaded my twitter archive and created a twitter account called minkbot.

I followed the instructions on

For step 5. I needed to use an account that had a phone number attached so instead of using the new @m1nkbot account I used my main twitter account.

We used to transfer the permissions over

in terminal

sudo gem install twurl

then following instructions on github

I used two browsers one with my ‘normal’ account in and the other with the bot in.

In the ‘normal’ account’s browser I went to permissions and got the key code and secret code – these replace the [key] and [secret] in the code below in terminal

twurl authorize --consumer-key [key]       \
                    --consumer-secret [secret]

This gave me a URL which I opened in the bot’s browser and got a PIN that I put back into terminal.

Looked in users-mbp-3:minkbot user$ cat ~/.twurlrc to find my tokens and keys

took the tweets.csv file from my twitter archive and put it in the corpus folder in the bot

Back to and follow the steps in 6 & 7.

back to

In sublime text 2 I edit in the key and secret from the permissions. and the tokens from the cat search.

There is an example bot here

logged back in to heroku to upload the real app.

If I ever edit this thing and make something new that I want to upload it to github, then I’ll need to create a new repository that hides my secret keys in an env

needs a gemfile.lock so used bundler to install the gemfile.lock in the minkbot local git repository in terminal.

now to edit bots.rb to try and make it do something more interesting! 😀

Game diary

30 09 2014

Tonight I played board games with Rob, Celia, Walden, John and Tim.

We played The Builders: Middle ages,  – a resource management game where you acquire building projects and workers then match them up to complete the buildings.

Quantum – a territory taking game with lots of dice, the dice mainly represented levels of space ship but could also be rolled to change their abilities.

and Ra. – An auction game of collecting tile sets, spurred on by the random selection of tiles from a bag.

Then when I got home, I got into a discussion about ‘what is game’? and as part of that conversation someone linked to

This game is about the power and danger of trying to ‘blend in’ and escape the ire of others. working out what harms you and how to control it are part of the gameplay.

Game Diary

24 09 2014

Tonight I played Gridlands, it’s the second game from doublespeak games who brought us A Dark Room. Gridlands is a spiritual successor to ADR in that it is a mash up of a resource gathering game and something completely different, this time round it is a match three puzzler.

There are two phases, day and night – your little character toils away during the day carting the resources you gather about and turning them into buildings.

These building upgrade your resources – during the day phase the most useful upgrade is to the food that gives your little character strength back after all that heavy lifting. Every move you make pushes the sun across the sky a little further, so getting cascades helps you gather more in the time allowed.

Screen Shot 2014-09-24 at 5.13.07 AM

Then the night phase, each resource turns into either a sword or shield for your little peon to carry or into something that summons a monster. The higher the resource had been upgraded in the day phase, the more powerful the protection or monster. Your shield and sword wear down with use so you have to keep matching. Unlike in the day phase only killing monsters pushes the moon onwards. The other factor that makes the day different from the night is that there are collectible power-up that are gathered from chest occasionally dropped by slain monsters.

Screen Shot 2014-09-24 at 5.13.37 AM

Survive the night, and all the resource tile convert back to their day phase appearance, this allows for some tactics – I chose to ignore gathering wood and metal during the day so that there would be plenty of swords and shields for me to use in the night.

Once you get about half way, the game adds a new goal, much like A Dark Room. There is a way of summoning a mini-boss and then later a final boss battle. It is also possible to max out all the building types, but there is no reward for doing so that I could see. There is a small amount of waiting around as the peon dawdles back and forth building things, but on the whole this is not a timer watching game, despite being called a ‘time-waster game’ by its creators.

Other games I played this past week:


Classic trick taking card game.


I finally got round to figuring out how to put money onto the Playstation and buy the game. I’ve been excitedly waiting for this game to come out since about 5 years ago when I played an early demo version in a pub after (I think) Eurogamer.

I played a bit of it at Mild Rumpus earlier this year, but this is an exploring game that means you need to give time and attention to it to get the most satisfaction.

You play as the Long Mover, a multi-coloured snake like being, who flies around the worlds it finds interacting with whatever choses to interact. You can speed up or slow down and (I think) that’s it. All other abilities are part of the world that you’re visiting, usually activated by bashing your head into them.

It’s a beautiful game, filled with secrets and charming animations hidden as rewards. There is a tinge of darkness to cutting through the cheery stories and characters, hearts get broken, partiers get electrocuted and excess crumbles into decay.

The navigation of the levels is as much a memory puzzle as anything else – unlocking a new level brings you closer to looping back round to one of the two central ‘menu selection’ areas (which do not look or feel in any way like a menu, this is just what I’m calling them).

You can just wander around admiring the scenery, but there are actual tasks and challenges that take you deeper. So far I have rescued a baboon like create, destroyed a treasure room, altered a future and instigated a wedding, freeing my fellow snakes as I go.

Game diary

9 07 2014

I played Super Time Force by Cappy. It’s a great game, a single player co-op! You play against the clock, but if you choose to ‘time out’ (or you die) you get to rewind the game as far back as you want and add a new character in to the fray. You only get so many goes at rewinding, in the first level 30 lives. So the more characters you add, the quicker it gets to kill the monsters. The writing is also very funny, although unskippable cut scene after cut scent at the start was a bit frustrating.

I ran a tournament to promote the reboot of the Spaceteam kickstarter at local Portland barcade Ground Kontrol.
There have been updates to Spaceteam since I played it last, one being the ships cat, an annoying handicap (in a hilarious way) that puts it’s paws over the bust ructions and tries to grab the controls. Typical cat.

I played some nice iPad games that I can’t talk about just yet.

Also 7 wonders card/board game which I haven’t played in ages. I got really lucky and won!

Played Ilo and milo which is a co-op game on xbox, I used to have it bsck when had an xbox. It’s a. It annoying because the two players have take turns to play, so one of is sat around waiting half the time.

I also played two game for the kongregate kongpanion. I forget their names.

Game diary

6 05 2014

Today I played Cat God vs Sun King 2 for the kongpanion. It reminds me of an old game I used to play as a kid where you have to try and destroy submarines by dropping bombs where you think they will be in a few seconds time (depthcharge?). You play as a cat god sat atop a scaffold, worker slaves and other mobs are building up the tower towards you, each level the complete allows them to get closer to you and attack you. You control a falling fire ball that periodically drops and kills any workers underneath it. There are upgrades and scarabs to target in order to get bonuses.

Game diary

5 05 2014

Today I played Alan Hazeldean’s Ludum Dare 29 entry You’re Pulleying My leg. A brain melting puzzle game – the first puzzle being figuring out what the mechanic is.

Game Diary

2 05 2014

Today I played valthirian-arc-2 for the kongpanion pet of a sparrow.

I played a little bit of Project Isla, it looks like it is a Myst style exploring game.

Fellow weapon7 player, about which I’ll write more later, told me that he hadn’t made any games. This turned out to be a lie of humbleness – I played his oldest Ludum Dare game  You Are Me Now. An action-puzzler platformer of uncovering connections. Interesting ‘attack’ of projecting yourself into the body of an enemy mob in order to switch places with them.