1
0
mirror of synced 2024-11-25 06:16:07 +03:00

reverted PR 51; fixed persistent menu typo

This commit is contained in:
Ayomide Onigbinde 2019-01-02 20:12:05 +01:00
parent f1076a12b6
commit 61add2ce3d
4 changed files with 6 additions and 56 deletions

View File

@ -1,5 +0,0 @@
verify_token: <verify_token_here>
access_token: <access_token_here>
app_secret: <app_secret_here>
# other configs can be added as necessary. For example, the webhook URL and host.

View File

@ -7,17 +7,17 @@ import (
"net/http"
"os"
"time"
"github.com/paked/messenger"
)
var vt, acct, appsc = messenger.GetTokens()
var (
verifyToken = flag.String("verify-token", vt, "The token used to verify facebook (required)")
verifyToken = flag.String("verify-token", "mad-skrilla", "The token used to verify facebook (required)")
verify = flag.Bool("should-verify", false, "Whether or not the app should verify itself")
pageToken = flag.String("page-token", acct, "The token that is used to verify the page on facebook")
appSecret = flag.String("app-secret", appsc, "The app secret from the facebook developer portal (required)")
pageToken = flag.String("page-token", "not skrilla", "The token that is used to verify the page on facebook")
appSecret = flag.String("app-secret", "", "The app secret from the facebook developer portal (required)")
host = flag.String("host", "localhost", "The host used to serve the messenger bot")
port = flag.Int("port", 5000, "The port used to serve the messenger bot")
port = flag.Int("port", 8080, "The port used to serve the messenger bot")
)
func main() {

View File

@ -240,7 +240,7 @@ func (m *Messenger) GreetingSetting(text string) error {
return checkFacebookError(resp.Body)
}
// CallToActionsSetting sends settings for Get Started or Persist Menu
// CallToActionsSetting sends settings for Get Started or Persistent Menu
func (m *Messenger) CallToActionsSetting(state string, actions []CallToActionsItem) error {
d := CallToActionsSetting{
SettingType: "call_to_actions",

View File

@ -1,45 +0,0 @@
package messenger
import (
"io/ioutil"
"log"
"os"
"path/filepath"
"gopkg.in/yaml.v2"
)
//Config is the struct for the configuration file
type Config struct {
VerifyToken string `yaml:"verify_token"`
AccessToken string `yaml:"access_token"`
AppSecret string `yaml:"app_secret"`
}
//ReadYml parses the config yml file and format into the Config struct
func (x *Config) ReadYml() *Config {
configFile, err := filepath.Abs("./bot.config.yml")
if err != nil {
log.Printf("ERROR READING THE CONFIG FILE: %s", err)
}
yamlFile, err := ioutil.ReadFile(configFile)
if err != nil {
log.Println("Could not find the config file. Please make sure it is created", err)
os.Exit(-1)
}
yaml.Unmarshal(yamlFile, &x)
return x
}
//GetTokens returns the verifytoken, accesstoken and the appsecret from the config file
func GetTokens() (string, string, string) {
var c Config
configObj := c.ReadYml()
verifyToken, accessToken, appSecret := configObj.VerifyToken, configObj.AccessToken, configObj.AppSecret
return verifyToken, accessToken, appSecret
}