Skip to content
This repository has been archived by the owner on Nov 3, 2019. It is now read-only.

Guild issue #9

Closed
KikoPlayZ opened this issue Jul 29, 2017 · 30 comments
Closed

Guild issue #9

KikoPlayZ opened this issue Jul 29, 2017 · 30 comments

Comments

@KikoPlayZ
Copy link

Good Night, I am trying to use your project, and I made it work in a discord server with all the name together, but in a discord server with separate words like this example: 'Eurovision Discord <3' doesn't work, how I make this work in -guild?

@nhooyr
Copy link
Owner

nhooyr commented Jul 30, 2017

use quotes, e.g. rankbot -guild "Eurovision Discord <3"

@KikoPlayZ
Copy link
Author

Still not working =/ - Still giving the same error : https://image.prntscr.com/image/R6jzyvUHQZat6YwV9R5OGQ.png

@nhooyr
Copy link
Owner

nhooyr commented Jul 30, 2017

What does the error say? I can't read it.

@KikoPlayZ
Copy link
Author

System couldn't find the specified file

@nhooyr
Copy link
Owner

nhooyr commented Jul 30, 2017

Must be something specific to the windows command line.

Google "how to send an argument with spaces in cmd.exe" and you'll likely find the answer.

@nhooyr
Copy link
Owner

nhooyr commented Jul 30, 2017

Oh sorry, didn't specify but I think its misinterpreting the double quotes as a file read.

@KikoPlayZ
Copy link
Author

Tried with the 2 quotes but still persists. https://image.prntscr.com/image/ggZ8CZd3S6_zPoyRPDTJ4w.png

@nhooyr
Copy link
Owner

nhooyr commented Jul 30, 2017

Don't put a space between the quotes.

@KikoPlayZ
Copy link
Author

@KikoPlayZ
Copy link
Author

sry for being annoying to you, I am newbie in this but already make this work

@nhooyr
Copy link
Owner

nhooyr commented Jul 30, 2017

Sorry, I've got no idea then. I'm not familiar with windows. Your best bet is to keep googling around or ask someone familiar with the windows command line. You could also try using the linux on windows sub system.

@KikoPlayZ
Copy link
Author

Ok thanks :) and thanks for making this amazing script, this is really useful

@KikoPlayZ
Copy link
Author

Can use another command line like the git cmd or something like that? I am noob with this sorry :/

@nhooyr
Copy link
Owner

nhooyr commented Jul 30, 2017

I wrote a quick Go program to do this for you so you wouldn't need to use a shell.

package main

import (
	"os/exec"
	"io"
	"log"
	"os"
)

func main() {
	c := exec.Command("echo", "-email", "me@domain.com", "-pass", "secret", "-guild", "server", "-chan", "channel")
	cmdStdout, err := c.StdoutPipe()
	if err != nil {
		log.Fatal(err)
	}
	cmdStderr, err := c.StderrPipe()
	if err != nil {
		log.Fatal(err)
	}
	err = c.Start()
	go func() {
		_, err := io.Copy(os.Stdout, cmdStdout)
		if err != nil {
			log.Fatal(err)
		}
	}()
	_, err = io.Copy(os.Stderr, cmdStderr)
	if err != nil {
		log.Fatal(err)
	}
}

Just edit the details (pass, server etc) to fit what you need.

@nhooyr
Copy link
Owner

nhooyr commented Jul 30, 2017

That should fix your problem so I'm gonna close this issue.

@nhooyr nhooyr closed this as completed Jul 30, 2017
@KikoPlayZ
Copy link
Author

@KikoPlayZ
Copy link
Author

PS: Sorry for reopening

@nhooyr
Copy link
Owner

nhooyr commented Jul 30, 2017

Oh, haha I missed a small detail. See where it says "echo" on the first line of the main function? Change that string to the path of the rankbot executable.

@KikoPlayZ
Copy link
Author

c := exec.Command("go run C:\Users-KikoGrilo\Desktop\rankbot-master\main.go", "-email", "kiko-grilo@hotmail.com", "-pass", "password", "-guild", "Eurovision Discord <3", "-chan", "bot_commands")

Like this?

@nhooyr
Copy link
Owner

nhooyr commented Jul 30, 2017

No, first run go build inside of C:\Users-KikoGrilo\Desktop\rankbot-master. That will generate an executable. Then c := exec.Command("C:\Users-KikoGrilo\Desktop\rankbot-master\rankbot-master", "-email", "kiko-grilo@hotmail.com", "-pass", "password", "-guild", "Eurovision Discord <3", "-chan", "bot_commands")

@KikoPlayZ
Copy link
Author

Like this?
image

@KikoPlayZ
Copy link
Author

not making it

@nhooyr
Copy link
Owner

nhooyr commented Jul 30, 2017

Ok, forget all of this. Delete that file. I'll make it more simple.

Just edit the main.go in this repo. Change the following lines.

rankbot/main.go

Lines 11 to 18 in 072e50b

var (
email = flag.String("email", "", "account email")
pass = flag.String("pass", "", "account password")
guild = flag.String("guild", "", "guild (server) to join")
channel = flag.String("chan", "", "channel to join")
message = flag.String("msg", "_", "message to be sent")
interval = flag.Int64("int", 60, "interval between messages in seconds")
)

E.g.

var (
	email    = "some email"
	pass     = "pass"
	guild    = "server"
	channel  = "channel"
	message  = "_"
	interval = 60
)

@nhooyr
Copy link
Owner

nhooyr commented Jul 30, 2017

And then just go run main.go

@KikoPlayZ
Copy link
Author

ok
in this case this?

var (
email = "kiko-grilo@hotmail.com/"
pass = "password"
guild = "Eurovision Discord <3"
channel = "bot_commands"
message = "_"
interval = 60
)

@KikoPlayZ
Copy link
Author

KikoPlayZ commented Jul 30, 2017

image

@nhooyr
Copy link
Owner

nhooyr commented Jul 30, 2017

lol, I missed one more detail. Do the following instead

var (
	email    = flag.String("email", "kiko-grilo@hotmail.com", "account email")
	pass     = flag.String("pass", "password", "account password")
	guild    = flag.String("guild", "Eurovision Discord <3", "guild (server) to join")
	channel  = flag.String("chan", "bot_channels", "channel to join")
	message  = flag.String("msg", "_", "message to be sent")
	interval = flag.Int64("int", 60, "interval between messages in seconds")
)

@KikoPlayZ
Copy link
Author

IT WORKED! just saying thank you for your amazing support and thanks for being nice to me since I am a big amateur in this programming world :) 👍 to you!

@nhooyr
Copy link
Owner

nhooyr commented Jul 30, 2017

Glad it worked out.

@KikoPlayZ
Copy link
Author

Now you can close the thread 😂

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants