mirror of
https://github.com/nikoksr/notify.git
synced 2024-11-28 08:39:13 +02:00
Requested Changes
This commit is contained in:
parent
742d127319
commit
b07e71dade
@ -15,8 +15,7 @@ type Notify struct {
|
|||||||
// ErrSendNotification signals that the notifier failed to send a notification.
|
// ErrSendNotification signals that the notifier failed to send a notification.
|
||||||
var ErrSendNotification = errors.New("send notification")
|
var ErrSendNotification = errors.New("send notification")
|
||||||
|
|
||||||
// New returns a new instance of Notify. Defaulting to being not disabled and using the pseudo notification
|
// New returns a new instance of Notify. Defaulting to being not disabled
|
||||||
// service under the hood.
|
|
||||||
func New() *Notify {
|
func New() *Notify {
|
||||||
notifier := &Notify{
|
notifier := &Notify{
|
||||||
Disabled: defaultDisabled,
|
Disabled: defaultDisabled,
|
||||||
|
@ -36,7 +36,8 @@ func New(apiToken string) (*Telegram, error) {
|
|||||||
// a given message to all those chats.
|
// a given message to all those chats.
|
||||||
func (t *Telegram) AddReceivers(chatIDs ...string) {
|
func (t *Telegram) AddReceivers(chatIDs ...string) {
|
||||||
for _, v := range chatIDs {
|
for _, v := range chatIDs {
|
||||||
if chatID, err := strconv.ParseInt(v, 10, 64); err != nil {
|
chatID, err := strconv.ParseInt(v, 10, 64)
|
||||||
|
if err != nil {
|
||||||
t.chatIDs = append(t.chatIDs, chatID)
|
t.chatIDs = append(t.chatIDs, chatID)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
3
use.go
3
use.go
@ -1,7 +1,6 @@
|
|||||||
package notify
|
package notify
|
||||||
|
|
||||||
// useService adds a given service to the notifiers services list. If the list still contains
|
// useService adds a given service to the notifiers services list.
|
||||||
// a pseudo service we remove it before adding the 'real' service.
|
|
||||||
func (n *Notify) useService(service Notifier) {
|
func (n *Notify) useService(service Notifier) {
|
||||||
if service == nil {
|
if service == nil {
|
||||||
return
|
return
|
||||||
|
Loading…
Reference in New Issue
Block a user