Publish module beta #14

Merged
klmp200 merged 6 commits from bro-features into master 2018-12-31 16:05:52 +00:00
Member

Publish system patch preview

The publish module intend to be a "multi-pin" feature for chats, allowing users to retrieve importants messages in a crowded conversation.

Commands

Subscribe

Description : Subscribe to this group chat publications

Usage location : Group chat only

Command syntax : /subscribe

Unsubscribe

Description : Unsubscribe [target chat member] from this group chat publications. If no member is provided, unsubscribe yourself.

Usage location : Group chat

Command syntax : /unsubscribe [target chat member]

note : parameter [target chat member] not implemented

ListSubscribers

Description : List all subscribers of this group chat

Usage location : Group chat

Command syntax : /listsubscribers

Publish

Description : Publish a message to Alfred for this group chat and sends this message via MP to every subscriber of the group chat. The message can then be retrieved using the retrieve command.

Usage location : Group chat only

Usage conditions : Reply to the message to publish

Command syntax : /publish

note : MP not implemented

Unpublish

Description : Remove a published message from Alfred for this group chat

Usage location : Group chat only

Command syntax : /unpublish [publication ID]

Retrieve

Description : if MP, retrieve all messages from subscribed sources for user, if Group Chat, retrieve all published messages for this chat

Usage location : Group Chat or MP

Command syntax : /retrieve

# Publish system patch preview The publish module intend to be a "multi-pin" feature for chats, allowing users to retrieve importants messages in a crowded conversation. ## Commands ### Subscribe **Description** : Subscribe to this group chat publications **Usage location** : Group chat only **Command syntax** : /subscribe ### Unsubscribe **Description** : Unsubscribe [target chat member] from this group chat publications. If no member is provided, unsubscribe yourself. **Usage location** : Group chat **Command syntax** : /unsubscribe [target chat member] *note* : parameter [target chat member] not implemented ### ListSubscribers **Description** : List all subscribers of this group chat **Usage location** : Group chat **Command syntax** : /listsubscribers ### Publish **Description** : Publish a message to Alfred for this group chat and sends this message via MP to every subscriber of the group chat. The message can then be retrieved using the *retrieve* command. **Usage location** : Group chat only **Usage conditions** : Reply to the message to publish **Command syntax** : /publish *note* : MP not implemented ### Unpublish **Description** : Remove a published message from Alfred for this group chat **Usage location** : Group chat only **Command syntax** : /unpublish [publication ID] ### Retrieve **Description** : if MP, retrieve all messages from subscribed sources for user, if Group Chat, retrieve all published messages for this chat **Usage location** : Group Chat or MP **Command syntax** : /retrieve
klmp200 requested changes 2018-12-31 15:40:36 +00:00
klmp200 left a comment
Owner

Can you add all the documentation in a README file inside commands ?

Can you add all the documentation in a README file inside commands ?
@ -61,6 +67,7 @@ func main() {
b.Handle(key, value)
}
log.Println("token : " + settings.Settings["token"].(string))
Owner

To be removed

To be removed
@ -0,0 +1 @@
aethor@pc60.home.13981:1546264820
Owner

This is wierd

This is wierd
@ -0,0 +29,4 @@
userSubscribedChats, exists := shared.Users.Get(m.Sender.Username, "subscribed_chats")
if !exists {
shared.Bot.Send(m.Chat, "Abonnement au chat : "+m.Chat.Title)
shared.Users.Set(m.Sender.Username, "subscribed_chats", strconv.FormatInt(m.Chat.ID, 10))
Owner

What is 10 ? If it's important, can you make a constant ?

What is 10 ? If it's important, can you make a constant ?
Author
Member

mmh a constant would not fit, it's just an argument saying it's in base 10 for the conversion

mmh a constant would not fit, it's just an argument saying it's in base 10 for the conversion
Owner

Oh, yeah, I've not seen the strconv

Oh, yeah, I've not seen the strconv
@ -0,0 +70,4 @@
shared.Users.Set(m.Sender.Username, "subscribed_chats", strings.Join(splittedChats, ":"))
}
// List all subscribers of the current chat
Owner

Always use the name of the function first in functions comments, here : ListSubscribers list all subscribers of the current chat

Always use the name of the function first in functions comments, here : ListSubscribers list all subscribers of the current chat
@ -0,0 +106,4 @@
// Remove a message from published messages in the current chat
// Command syntax : /unpublish [publication ID]
func Unpublish(m *tb.Message) {
Owner

Unpublish remove a message from published messages

Unpublish remove a message from published messages
@ -0,0 +131,4 @@
shared.Bot.Send(m.Chat, "Message supprimé des publication")
}
// If performed in MP : retrieve all messages from all subscribed sources for the user
Owner

Start the command with Retrieve

Start the command with Retrieve
shared/users.go Outdated
@ -61,6 +61,17 @@ func (u users) Set(username string, key, data string) {
go uf.write()
}
// Get all known usernames
Owner

GetUsernames get all usernames stored in the settings

GetUsernames get all usernames stored in the settings
bro was assigned by klmp200 2018-12-31 15:41:55 +00:00
klmp200 reviewed 2018-12-31 16:02:00 +00:00
klmp200 left a comment
Owner

Just the doc and it's ready

Just the doc and it's ready
klmp200 approved these changes 2018-12-31 16:05:10 +00:00
klmp200 closed this pull request 2018-12-31 16:05:52 +00:00
Sign in to join this conversation.
No reviewers
No Label
No Milestone
No Assignees
2 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: ALFRED/ALFRED#14
No description provided.