iopred / bruxism

A chat bot for YouTube, Discord and IRC.
MIT License
146 stars 20 forks source link

Install issues #19

Closed annareinike closed 7 years ago

annareinike commented 7 years ago

Hey iopred, unfortunately I am experiencing some issues with the installation of Go on Mac OS X. I downloaded and installed the Go Package for Mac OS X here. Then I tried to follow your instructions.

Is it right that the terminal window doesn't give me any feedback if the installation works or if it's done?

Apparently the next step bruxism -youtubeurl won't work because the terminal didn't seem to recognize the command bruxism. I guess the installation with your cmd package haven't worked properly otherwise the command bruxism should work right?

Do you have any idea? Thanks in advance.

iopred commented 7 years ago

You might need to do ./bruxism -youtubeurl ......

If you're in $GOPATH/bin, do ls and see if the bruxism command exists.

On Sat, Apr 1, 2017 at 4:38 PM, annareinike notifications@github.com wrote:

Hey iopred, unfortunately I am experiencing some issues with the installation of Go on Mac OS X. I downloaded and installed the Go Package for Mac OS X here https://golang.org/dl/. Then I tried to follow your instructions.

  • go get github.com/iopred/bruxism/cmd/bruxism If I hit enter the terminal jumps immediately to the next line with no response.
  • go install github.com/iopred/bruxism/cmd/bruxism The same result as mentioned above. It jumps immediately to the next line.

Is it right that the terminal window doesn't give me any feedback if the installation works or if it's done?

  • cd $GOPATH/bin The command works. It changes the directory to /bin

Apparently the next step bruxism -youtubeurl won't work because the terminal didn't seem to recognize the command bruxism. I guess the installation with your cmd package haven't worked properly otherwise the command bruxism should work right?

Do you have any idea? Thanks in advance.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/iopred/bruxism/issues/19, or mute the thread https://github.com/notifications/unsubscribe-auth/ABdVgvYwjrTBDY0ogzvEwQQos_87Qsv5ks5rruAJgaJpZM4MwpdE .

annareinike commented 7 years ago

bruxism doesn't exist in the $GOPATH/bin folder.

iopred commented 7 years ago

hmm, that's weird, try:

go run github.com/iopred/bruxism/cmd/bruxism -youtubeurl ....

On Sat, Apr 1, 2017 at 4:56 PM, annareinike notifications@github.com wrote:

bruxism doesn't exist in the $GOPATH/bin folder.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/iopred/bruxism/issues/19#issuecomment-290955163, or mute the thread https://github.com/notifications/unsubscribe-auth/ABdVgt317VORxQMSdZQFfxN8eQK2To1_ks5rruRGgaJpZM4MwpdE .

annareinike commented 7 years ago

go run: no go files listed

iopred commented 7 years ago

Hmm, you'll need to be in $GOPATH to do that.

Do files exist in:

$GOPATH/src/github.com/iopred/bruxism?

On Sat, Apr 1, 2017 at 5:41 PM, annareinike notifications@github.com wrote:

go run: no go files listed

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/iopred/bruxism/issues/19#issuecomment-290956789, or mute the thread https://github.com/notifications/unsubscribe-auth/ABdVgs-xVP9q5NX5CwaxTs1fyLt4BeVvks5rru7DgaJpZM4MwpdE .

annareinike commented 7 years ago

If I'm trying to run your command go run github.com/iopred/bruxism/cmd/bruxism -youtubeurl in $GOPATH I get the same error as above.

Yes, files exist in $GOPATH/src/github.com/iopred/bruxism.

iopred commented 7 years ago

lol sorry!

go run github.com/iopred/bruxism/cmd/bruxism/main.go -youtubeurl ....

On Sat, Apr 1, 2017 at 6:03 PM, annareinike notifications@github.com wrote:

If I'm trying to run your command go run github.com/iopred/bruxism/cmd/ bruxism -youtubeurl in $GOPATH I get the same error as above.

Yes, files exist in $GOPATH/src/github.com/iopred/bruxism.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/iopred/bruxism/issues/19#issuecomment-290957527, or mute the thread https://github.com/notifications/unsubscribe-auth/ABdVgst5uvQc6maNzuPgMBwNGtZot6gtks5rrvPggaJpZM4MwpdE .

annareinike commented 7 years ago

Don't get me wrong but shouldn't I be in the src folder to run that command? Because my $GOPATH variable is set to /Users/annareinike/go. But in the folder go isn't a github.com folder?

iopred commented 7 years ago

yup, sorry just spitballing here, I rarely use go run, sorry! I assumed it worked like install.

On Sat, Apr 1, 2017 at 6:08 PM, annareinike notifications@github.com wrote:

Don't get me wrong but shouldn't I be in the src folder to run that command? Because my $GOPATH variable is set to /Users/annareinike/go. But in the folder go isn't a github.com folder?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/iopred/bruxism/issues/19#issuecomment-290957684, or mute the thread https://github.com/notifications/unsubscribe-auth/ABdVgm950xPjdVrwhV7qRI7pxg7_LQRTks5rrvUBgaJpZM4MwpdE .

annareinike commented 7 years ago

No problem - I'm grateful you help me and finally I got a response that some files are missing.

annareinike commented 7 years ago

Even after some troubleshooting I wasn't able to get the bot working.

But why are those files are missing? Aren't these files part of the package I downloaded? Additionally the youtubeoauth2config.json is already in the users/annareinike/go/bin but I get the error anyway.

iopred commented 7 years ago

I guess it needs to run from bin/

The install command should be tried again I guess. I haven't tried with go run, sorry for the bad advice.

For the emoji read the readme in the emojiplugin dir.

The comic plugin needs a lot of data that I don't provide, that's why I dont include it in the master branch.

On Apr 1, 2017 6:54 PM, "annareinike" notifications@github.com wrote:

Even after some troubleshooting I wasn't able to get the bot working.

  • Could not open avatars directory: open avatars: no such file or directory
  • Could not open emoji directory: emoji/google open emoji/google: no such file or directory
  • Could not open emoji directory: emoji/twitter open emoji/twitter: no such file or directory
  • Could not open rooms directory: open rooms: no such file or directory
  • Could not open characters directory: open characters: no such file or directory
  • open youtubeoauth2config.json: no such file or directory

But why are those files are missing? Aren't these files part of the package I downloaded? Additionally the youtubeoauth2config.json is already in the users/annareinike/go/bin but I get the error anyway.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/iopred/bruxism/issues/19#issuecomment-290959221, or mute the thread https://github.com/notifications/unsubscribe-auth/ABdVghu95ZNDsqsyFg1DgAjFtldGitQLks5rrv_TgaJpZM4MwpdE .

annareinike commented 7 years ago

Okay the emoji stuff is in the bin/emoji dir. Where do I download the comic plugin data?

So go install github.com/iopred/bruxism/cmd/bruxism again and then trying to run it out of the bin dir with go run github.com/iopred/bruxism/cmd/bruxism/main.go -youtubeurl?

iopred commented 7 years ago

The goal is to run the bruxism binary from $GOPATH/bin, where all the assets live.

go install is supposed to do that, but you can try: go build github.com/iopred/bruxism/cmd/bruxism and then check $GOPATH/bin for the bruxism binary.

Finally, the comic stuff is out of master because I don't maintain a public way to make it work, I really should remove it from the repo.

annareinike commented 7 years ago

In the $GOPATH/bin is a bruxism Unix executable file. I guess you meant this. But the main.go is in the src folder. So how I should run it out of $GOPATH/bin?

iopred commented 7 years ago

Yeah, now you can do ./bruxism from $GOPATH/bin

On Sun, Apr 2, 2017 at 8:18 AM, annareinike notifications@github.com wrote:

In the $GOPATH/bin is a bruxism Unix executable file. I guess you meant this.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/iopred/bruxism/issues/19#issuecomment-290992886, or mute the thread https://github.com/notifications/unsubscribe-auth/ABdVgpBA_NWyU_JKXFpN7ZZsn5WxIlbAks5rr7wsgaJpZM4MwpdE .

annareinike commented 7 years ago

That works with some errors: Could not open avatars directory: open avatars: no such file or directory Could not open rooms directory: open rooms: no such file or directory Could not open characters directory: open characters: no such file or directory

But I got the auth link which I paste into my browser and confirm. Now I run ./bruxism -youtubeauth 123 http://localhost:4242/youtube/callback?state=state&code=123 right?

iopred commented 7 years ago

Sorry, I have removed the comic plugin from master (I thought I had done it previously) doing: go get -u github.com/iopred/bruxism/cmd/bruxism will fix those last remaining warnings.

annareinike commented 7 years ago

Thank you so much. How does the bot work after I confirm the auth code with bruxism -youtubeauth <AUTH CODE>? Is it listening the livestream chat and if one of those messages it retrieves is a trigger command then it fires a predefined message?

iopred commented 7 years ago

If you're using this for YT, you should run the bot:

Now you're authed you can just do:

./bruxism -youtubechannelids <yourchannelid>

The bot will then respond to:

@<botname> <command>

Because my bots name is Septapus I usually test with:

@Septapus topstreamers

On Sun, Apr 2, 2017 at 9:45 AM, annareinike notifications@github.com wrote:

Thank you so much. How does the bot work after I confirm the auth code with bruxism -youtubeauth ? Is it listening the livestream chat and if one of those messages it retrieves is a trigger command then it fires a predefined message?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/iopred/bruxism/issues/19#issuecomment-290998192, or mute the thread https://github.com/notifications/unsubscribe-auth/ABdVgkGDVuumhYj4Vt9e_zhNHO9Nj-dmks5rr9C6gaJpZM4MwpdE .

annareinike commented 7 years ago

But the YouTube API only allows me to get data from my own livestream right? So I have to do a livestream and then test the bot?

iopred commented 7 years ago

bruxism works fine as a chat bot in other peoples chats, as it only needs to read public messages, however it's recommended to give the bot moderation privileges so that it isn't rate limited.

The YouTube API flow you did allows bruxism to post messages as your account.

annareinike commented 7 years ago

Got it. Should I do an extra account for the bot or is it possible if I allow bruxism to post on the behalf of the streamer's account?

iopred commented 7 years ago

It's usually good to make an extra account, then you get to name it :)

PS. if you really just want Septapus and don't want the hassle of hosting it yourself, you can visit: youtube.septapus.com and invite it to your streams.

annareinike commented 7 years ago

Yeah thanks but at the moment my ambition is to host and configure it on my own. One of reasons why I promise myself not to use Nightbot ;). Seems that I have to stream to test the bot. What is the purpose of that livechat window in the Livechat Dashboard?

iopred commented 7 years ago

It's there so you can have one window open on another monitor so you can view chat and stream health etc.

annareinike commented 7 years ago

That makes sense - mostly used the live chat popup. Shouldn't the bot respond to my command in that live chat dashboard if I write for instance @annareinike topstreamers?

iopred commented 7 years ago

The bot is made to monitor channels, so it polls the streaming state of all the channel id's you provide every 5 minutes, it won't be able to find streams to join if they are not live. (unlisted won't work either sadly).

If you wanted to make code modifications, in main.go, right after bot.Open() you could call youtube.Join('videoid') and use your current stream now video id.

You get that video id from your offline stream now page, so for example mine: https://www.youtube.com/channel/UCGmC0A8mEAPdlELQdP9xJbw/live

Right click the player: copy video url: https://youtu.be/27jl9d1oc1g

You take the last bit, so the line of code would be:

youtube.Join('27jl9d1oc1g')

annareinike commented 7 years ago

Finally the bot works without any errors but the terminal window only outputs <videoid> annareinike: @annareinike topstreamers. But the chat didn't receive any answer from the bot?

iopred commented 7 years ago

annarenike is the account you oauthed?

You can also try @<botname> help or @<botname> info etc.

annareinike commented 7 years ago

Exactly. None of those commands worked for me. I only receive the messages. But doesn't that mean the oauth worked? Otherwise the bot coudn't listening right?

iopred commented 7 years ago

Yeah if the bot is seeing messages it should be able to respond to them. The only thing I can think is that you're spelling the bots name wrong, or maybe the bot's name has a space in it? (I've never tested that)

Easiest thing to do is to change the command prefix to !, change the following function in youtube.go

func (yt *YouTube) CommandPrefix() string {
    return fmt.Sprintf("@%s ", yt.UserName())
}

to:

func (yt *YouTube) CommandPrefix() string {
    return "!"
}

Then you can do !topstreamers or !help

annareinike commented 7 years ago

But the bots name is the oauthed accounts name isn't it? So I oauthed with the account ’annareinike’ it should be working with ’@annareinike !topstreamers’?

iopred commented 7 years ago

if you don't make the code modification: @annareinike topstreamers if you make the modification: !topstreamers

When you did the oauth flow, did you perhaps click on a different YT account?

The account could also be unable to comment I guess, if you sign in to that YT account, can you send messages?

annareinike commented 7 years ago

Alright. Hm do you know how those brand accounts behave in that case? Because I have a main account but without a YouTube channel and with that account I maintain the brand account which has a YouTube account.

iopred commented 7 years ago

Yeah, you need a YT account to send messages, my guess is you selected your main account when you oauthed, instead of your brand. Redo the original steps to generate a new auth key.

On Sun, Apr 2, 2017 at 9:01 PM, annareinike notifications@github.com wrote:

Alright. Hm do you know how those brand accounts behave in that case? Because I have a main account but without a YouTube channel and with that account I maintain the brand account which has a YouTube account.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/iopred/bruxism/issues/19#issuecomment-291044132, or mute the thread https://github.com/notifications/unsubscribe-auth/ABdVgnrmbqZNKezndN7ohT8y5GlVenRnks5rsG8ZgaJpZM4MwpdE .

annareinike commented 7 years ago

Pretty sure I selected the right one but I'll give it a try. What is with the oauth credentials which I got from the Google Console? Are these independent from the YouTube accounts?

iopred commented 7 years ago

That's linked to your Google account, basically your account has a certain amount of Quota, but it doesn't restrict the accounts you can use. With those credentials, you could post on behalf of any account (if you convinced them to do the oauth flow)

annareinike commented 7 years ago

Now I selected the right account and change the command prefix to "!" but the bot doesn't respond. Man it's frustrating - you helped me out so much and it will not work.

iopred commented 7 years ago

In main.go you could try sending a message not tied to a command:

youtube.SendMessage('', 'message')

That should debug whether or not it's the command system.

You could also do:

fmt.Sprintf(youtube.UserName()) to make sure the bot is acting as the right account.

But if you're seeing messages in the console, I think it's something with your account.

On Sun, Apr 2, 2017 at 9:44 PM, annareinike notifications@github.com wrote:

Now I selected the right account and change the command prefix to "!" but the bot doesn't respond. Man it's frustrating - you helped me out so much and it will not work.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/iopred/bruxism/issues/19#issuecomment-291047720, or mute the thread https://github.com/notifications/unsubscribe-auth/ABdVgjFgcaJcAJ9R8KEHLs33ZL7WNINbks5rsHk_gaJpZM4MwpdE .

iopred commented 7 years ago

(also try !help or !info)

annareinike commented 7 years ago

I pasted both code snippets after bot.Open() in main.go and nothing happened. fmt.Sprintf(youtube.UserName()) the bot should output its own username in the console right? Do you have a suggestion whats wrong with my account so I can't send messages?

iopred commented 7 years ago

Did the bots username print?

All I can think is that the account is being rate limited, so I would suggest triggering the command with a different account.

Other than that, I can't really explain why it's not posting, I could try post on that video with my own bot? Likely not tonight though sorry :(

iopred commented 7 years ago

Also sorry: fmt.Println(youtube.UserName()) is the right code, sorry again, remote debugging is hard as heck.

annareinike commented 7 years ago

No the username didn't print :( For explanation:

src/github.com/iopred/bruxism/cmd/bruxism/main.go

// Start all our services.
bot.Open()
youtube.SendMessage('<videoid>', 'test')
fmt.Println(youtube.UserName())

What do you mean with rate limited? I trigger the command with the streamers account so why am I limited? Yeah sure. Our time difference is about 10 hours so good night. Maybe I can contact you on Discord instead of spamming the comment section?

bwmarrin commented 7 years ago

@annareinike yeah, hop on Discord. There's a Go server and iopred and many others are there that can help get you going if you want. https://discord.gg/0f1SbxBZjYq9jLBk

iopred commented 7 years ago

Yeah join the discord would be right.

For the SendMessage thing, you need to actually send the message to the video:

youtube.SendMessage('oe34snthuoe', 'test')

As for rate limiting, if you're the owner of the video, then that is not the case.

iopred commented 7 years ago

Worked it out over Discord. Updated the README to reflect pain points we found setting up for YouTube.