1
0
mirror of synced 2024-11-21 20:46:05 +03:00

Merge pull request #23 from gwinn/master

add name field to channel
This commit is contained in:
Alex Lushpai 2018-09-10 12:12:21 +03:00 committed by GitHub
commit 70ddbb4650
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 13 additions and 9 deletions

View File

@ -28,6 +28,7 @@ func main() {
var client = v1.New("https://token.url", "cb8ccf05e38a47543ad8477d49bcba99be73bff503ea6")
ch := Channel{
Type: "telegram",
Name: "@my_shopping_bot"
Settings: ChannelSettings{
SpamAllowed: false,
Status: Status{

View File

@ -26,6 +26,7 @@ func New(url string, token string) *MgClient {
//
// request := ActivateRequest{
// Type: "telegram",
// Name: "@my_shopping_bot",
// Settings: ChannelSettings{
// SpamAllowed: false,
// Status: Status{
@ -77,6 +78,7 @@ func (c *MgClient) ActivateTransportChannel(request Channel) (ActivateResponse,
// request := ActivateRequest{
// ID: 3053450384,
// Type: "telegram",
// Name: "@my_shopping_bot",
// Settings: ChannelSettings{
// SpamAllowed: false,
// Status: Status{

View File

@ -24,6 +24,7 @@ func TestMgClient_ActivateTransportChannel(t *testing.T) {
ch := Channel{
ID: channelId,
Type: "telegram",
Name: "@my_shopping_bot",
Settings: ChannelSettings{
SpamAllowed: false,
Status: Status{
@ -52,6 +53,7 @@ func TestMgClient_ActivateNewTransportChannel(t *testing.T) {
c := client()
ch := Channel{
Type: "telegram",
Name: "@my_shopping_bot",
Settings: ChannelSettings{
SpamAllowed: false,
Status: Status{
@ -91,7 +93,8 @@ func TestMgClient_ActivateNewTransportChannel(t *testing.T) {
func TestMgClient_UpdateTransportChannel(t *testing.T) {
c := client()
ch := Channel{
ID: channelId,
ID: channelId,
Name: "@my_shopping_bot_2",
Settings: ChannelSettings{
SpamAllowed: false,
Status: Status{
@ -121,13 +124,10 @@ func TestMgClient_Messages(t *testing.T) {
t.Logf("%v", ext)
snd := SendData{
Message: SendMessage{
Message{
ExternalID: ext,
Type: "text",
Text: "hello!",
},
time.Now(),
Message: Message{
ExternalID: ext,
Type: "text",
Text: "hello!",
},
User: User{
ExternalID: "6",

View File

@ -24,6 +24,7 @@ type MgClient struct {
type Channel struct {
ID uint64 `json:"id,omitempty"`
Type string `json:"type,omitempty"`
Name string `json:"name,omitempty"`
Settings ChannelSettings `json:"settings,omitempty,brackets"`
}
@ -101,7 +102,7 @@ type UpdateMessage struct {
// SendData struct
type SendData struct {
Message SendMessage `json:"message"`
Message Message `json:"message"`
User User `json:"user"`
Channel uint64 `json:"channel"`
ExternalChatID string `json:"external_chat_id"`