Projects STRLCPY Osmedeus Commits ae0c1fbf
🤬
  • Remove some noise error message if you didn't setup noti yet

  • Loading...
  • j3ssie committed 2 years ago
    ae0c1fbf
    1 parent 8993bede
  • ■ ■ ■ ■ ■ ■
    core/config.go
    skipped 435 lines
    436 436   // tokens
    437 437   options.Noti.SlackToken = tokens["slack"]
    438 438   options.Noti.TelegramToken = tokens["telegram"]
     439 + 
     440 + // this mean you're not setup the notification yet
     441 + if len(options.Noti.TelegramToken) < 20 {
     442 + options.NoNoti = true
     443 + }
     444 + 
    439 445   options.Noti.ClientName = noti["client_name"]
    440 446   
    441 447   options.Noti.SlackStatusChannel = noti["slack_status_channel"]
    skipped 269 lines
  • ■ ■ ■ ■ ■ ■
    execution/noti.go
    1 1  package execution
    2 2   
    3 3  import (
    4  - "encoding/json"
    5  - "errors"
    6  - "fmt"
    7  - "github.com/spf13/cast"
    8  - "math/rand"
    9  - "path/filepath"
    10  - "strconv"
    11  - "strings"
    12  - "time"
     4 + "encoding/json"
     5 + "errors"
     6 + "fmt"
     7 + "github.com/spf13/cast"
     8 + "math/rand"
     9 + "path/filepath"
     10 + "strconv"
     11 + "strings"
     12 + "time"
    13 13   
    14  - "github.com/go-telegram-bot-api/telegram-bot-api"
    15  - "github.com/j3ssie/osmedeus/libs"
    16  - "github.com/j3ssie/osmedeus/utils"
    17  - "github.com/robertkrimen/otto"
    18  - "github.com/slack-go/slack"
     14 + "github.com/go-telegram-bot-api/telegram-bot-api"
     15 + "github.com/j3ssie/osmedeus/libs"
     16 + "github.com/j3ssie/osmedeus/utils"
     17 + "github.com/robertkrimen/otto"
     18 + "github.com/slack-go/slack"
    19 19  )
    20 20   
    21 21  // StatusNoti send to when module is done with report file
    22 22  func StatusNoti(notiType string, options libs.Options) {
    23  - SendAttachment(notiType, "", options)
     23 + SendAttachment(notiType, "", options)
    24 24  }
    25 25   
    26 26  // ReportNoti send to notification when module is done with report file
    27 27  func ReportNoti(arguments []otto.Value, options libs.Options) {
    28  - if len(arguments) >= 1 {
    29  - for _, argument := range arguments {
    30  - SendFile(argument.String(), options.Noti.SlackReportChannel, options)
    31  - }
    32  - return
    33  - }
    34  - // if doesn't provide report file send all file in noti section
    35  - for _, file := range options.Module.Report.Noti {
    36  - SendFile(file, options.Noti.SlackReportChannel, options)
    37  - }
     28 + if len(arguments) >= 1 {
     29 + for _, argument := range arguments {
     30 + SendFile(argument.String(), options.Noti.SlackReportChannel, options)
     31 + }
     32 + return
     33 + }
     34 + // if doesn't provide report file send all file in noti section
     35 + for _, file := range options.Module.Report.Noti {
     36 + SendFile(file, options.Noti.SlackReportChannel, options)
     37 + }
    38 38  }
    39 39   
    40 40  // DiffNoti send to notification based on diff content
    41 41  func DiffNoti(arguments []otto.Value, options libs.Options) {
    42  - if len(arguments) >= 1 {
    43  - for _, argument := range arguments {
    44  - filename := argument.String()
    45  - if !utils.FileExists(filename) {
    46  - continue
    47  - }
    48  - data := getNewContent(utils.ReadingLines(filename))
    49  - if strings.TrimSpace(data) == "" {
    50  - continue
    51  - }
    52  - // messageContent := fmt.Sprintf("%v \n ```%v```", filename, data)
    53  - // SendAttachment("diff", messageContent, options)
    54  - SendFile(filename, options.Noti.SlackDiffChannel, options)
    55  - }
    56  - return
    57  - }
    58  - // if doesn't provide report file send all file in noti section
    59  - for _, filename := range options.Module.Report.Diff {
    60  - if !utils.FileExists(filename) {
    61  - continue
    62  - }
    63  - data := getNewContent(utils.ReadingLines(filename))
    64  - if strings.TrimSpace(data) == "" {
    65  - continue
    66  - }
    67  - // messageContent := fmt.Sprintf("%v \n ```%v```", filename, data)
    68  - // SendAttachment("diff", messageContent, options)
    69  - SendFile(filename, options.Noti.SlackDiffChannel, options)
    70  - }
     42 + if len(arguments) >= 1 {
     43 + for _, argument := range arguments {
     44 + filename := argument.String()
     45 + if !utils.FileExists(filename) {
     46 + continue
     47 + }
     48 + data := getNewContent(utils.ReadingLines(filename))
     49 + if strings.TrimSpace(data) == "" {
     50 + continue
     51 + }
     52 + // messageContent := fmt.Sprintf("%v \n ```%v```", filename, data)
     53 + // SendAttachment("diff", messageContent, options)
     54 + SendFile(filename, options.Noti.SlackDiffChannel, options)
     55 + }
     56 + return
     57 + }
     58 + // if doesn't provide report file send all file in noti section
     59 + for _, filename := range options.Module.Report.Diff {
     60 + if !utils.FileExists(filename) {
     61 + continue
     62 + }
     63 + data := getNewContent(utils.ReadingLines(filename))
     64 + if strings.TrimSpace(data) == "" {
     65 + continue
     66 + }
     67 + // messageContent := fmt.Sprintf("%v \n ```%v```", filename, data)
     68 + // SendAttachment("diff", messageContent, options)
     69 + SendFile(filename, options.Noti.SlackDiffChannel, options)
     70 + }
    71 71  }
    72 72   
    73 73  func getNewContent(data []string) string {
    74  - var result string
    75  - for _, line := range data {
    76  - if strings.HasPrefix(line, "+") && !strings.HasPrefix(line, "++") {
    77  - result += fmt.Sprintf("%v\n", line)
    78  - }
    79  - }
    80  - return result
     74 + var result string
     75 + for _, line := range data {
     76 + if strings.HasPrefix(line, "+") && !strings.HasPrefix(line, "++") {
     77 + result += fmt.Sprintf("%v\n", line)
     78 + }
     79 + }
     80 + return result
    81 81  }
    82 82   
    83 83  // SendAttachment send attach message to specific channel
    84 84  func SendAttachment(messType string, messContent string, options libs.Options) error {
    85  - if options.Noti.SlackToken == "" {
    86  - return errors.New("Slack config improperly")
    87  - }
     85 + if options.Noti.SlackToken == "" {
     86 + return errors.New("Slack config improperly")
     87 + }
    88 88   
    89  - // choose method
    90  - var channel, color, mess string
    91  - switch messType {
    92  - case "start":
    93  - channel = options.Noti.SlackStatusChannel
    94  - color = "#005b9f"
    95  - mess = fmt.Sprintf("%v Start to run *%v* on *%v*", GetEmoji(), options.Module.Name, options.Scan.ROptions["Workspace"])
    96  - break
    97  - case "done":
    98  - channel = options.Noti.SlackStatusChannel
    99  - color = "#32cb00"
    100  - mess = fmt.Sprintf("%v Done run *%v* on *%v*", GetEmoji(), options.Module.Name, options.Scan.ROptions["Workspace"])
    101  - break
    102  - case "diff":
    103  - channel = options.Noti.SlackDiffChannel
    104  - color = "#5E35B1"
    105  - mess = fmt.Sprintf("%v Diff content on %v: \n %v", GetEmoji(), options.Scan.ROptions["Workspace"], messContent)
    106  - break
    107  - case "custom":
    108  - channel = options.Noti.SlackStatusChannel
    109  - color = "#1ABC9C"
    110  - mess = messContent
    111  - break
    112  - }
     89 + // choose method
     90 + var channel, color, mess string
     91 + switch messType {
     92 + case "start":
     93 + channel = options.Noti.SlackStatusChannel
     94 + color = "#005b9f"
     95 + mess = fmt.Sprintf("%v Start to run *%v* on *%v*", GetEmoji(), options.Module.Name, options.Scan.ROptions["Workspace"])
     96 + break
     97 + case "done":
     98 + channel = options.Noti.SlackStatusChannel
     99 + color = "#32cb00"
     100 + mess = fmt.Sprintf("%v Done run *%v* on *%v*", GetEmoji(), options.Module.Name, options.Scan.ROptions["Workspace"])
     101 + break
     102 + case "diff":
     103 + channel = options.Noti.SlackDiffChannel
     104 + color = "#5E35B1"
     105 + mess = fmt.Sprintf("%v Diff content on %v: \n %v", GetEmoji(), options.Scan.ROptions["Workspace"], messContent)
     106 + break
     107 + case "custom":
     108 + channel = options.Noti.SlackStatusChannel
     109 + color = "#1ABC9C"
     110 + mess = messContent
     111 + break
     112 + }
    113 113   
    114  - if channel == "" || mess == "" {
    115  - return errors.New("Slack channel config improperly")
    116  - }
    117  - utils.DebugF("Sending %v message to %v", messType, channel)
     114 + if channel == "" || mess == "" {
     115 + return errors.New("Slack channel config improperly")
     116 + }
     117 + utils.DebugF("Sending %v message to %v", messType, channel)
    118 118   
    119  - api := slack.New(options.Noti.SlackToken)
    120  - // message config
    121  - attachment := slack.Attachment{
    122  - Color: color,
    123  - Text: mess,
    124  - // sender name
    125  - Footer: options.Noti.ClientName,
    126  - FooterIcon: GetIcon(),
    127  - Ts: json.Number(strconv.FormatInt(time.Now().Unix(), 10)),
    128  - }
     119 + api := slack.New(options.Noti.SlackToken)
     120 + // message config
     121 + attachment := slack.Attachment{
     122 + Color: color,
     123 + Text: mess,
     124 + // sender name
     125 + Footer: options.Noti.ClientName,
     126 + FooterIcon: GetIcon(),
     127 + Ts: json.Number(strconv.FormatInt(time.Now().Unix(), 10)),
     128 + }
    129 129   
    130  - _, _, err := api.PostMessage(channel, slack.MsgOptionAttachments(attachment))
    131  - if err != nil {
    132  - return err
    133  - }
    134  - return nil
     130 + _, _, err := api.PostMessage(channel, slack.MsgOptionAttachments(attachment))
     131 + if err != nil {
     132 + return err
     133 + }
     134 + return nil
    135 135  }
    136 136   
    137 137  // SlackWebHook send message with webhook
    138 138  func SlackWebHook(webhookURL string, content string) error {
    139  - content = fmt.Sprintf("```%s```", content)
    140  - attachment := slack.Attachment{
    141  - Color: "#1ABC9C",
    142  - Text: content,
    143  - // sender name
    144  - //Footer: options.Noti.ClientName,
    145  - FooterIcon: GetIcon(),
    146  - Ts: json.Number(strconv.FormatInt(time.Now().Unix(), 10)),
    147  - }
     139 + content = fmt.Sprintf("```%s```", content)
     140 + attachment := slack.Attachment{
     141 + Color: "#1ABC9C",
     142 + Text: content,
     143 + // sender name
     144 + //Footer: options.Noti.ClientName,
     145 + FooterIcon: GetIcon(),
     146 + Ts: json.Number(strconv.FormatInt(time.Now().Unix(), 10)),
     147 + }
    148 148   
    149  - msg := slack.WebhookMessage{
    150  - Attachments: []slack.Attachment{attachment},
    151  - }
    152  - err := slack.PostWebhook(webhookURL, &msg)
    153  - return err
     149 + msg := slack.WebhookMessage{
     150 + Attachments: []slack.Attachment{attachment},
     151 + }
     152 + err := slack.PostWebhook(webhookURL, &msg)
     153 + return err
    154 154  }
    155 155   
    156 156  // WebHookSendAttachment send attach message to specific channel
    157 157  func WebHookSendAttachment(options libs.Options, messType string, messContent string) error {
    158  - if options.NoNoti {
    159  - return fmt.Errorf("noti disabled")
    160  - }
    161  - if options.Noti.SlackWebHook == "" {
    162  - return errors.New("slack webhook config improperly")
    163  - }
     158 + if options.NoNoti {
     159 + return fmt.Errorf("noti disabled")
     160 + }
     161 + if options.Noti.SlackWebHook == "" {
     162 + return errors.New("slack webhook config improperly")
     163 + }
    164 164   
    165  - // choose method
    166  - var color, mess string
    167  - switch messType {
    168  - case "start":
    169  - color = "#005b9f"
    170  - mess = fmt.Sprintf("%v Start to run *%v* on *%v*", GetEmoji(), options.Module.Name, options.Scan.ROptions["Workspace"])
    171  - break
    172  - case "done":
    173  - color = "#32cb00"
    174  - mess = fmt.Sprintf("%v Done run *%v* on *%v*", GetEmoji(), options.Module.Name, options.Scan.ROptions["Workspace"])
    175  - break
    176  - case "diff":
    177  - color = "#5E35B1"
    178  - mess = fmt.Sprintf("%v Diff content on %v: \n %v", GetEmoji(), options.Scan.ROptions["Workspace"], messContent)
    179  - break
    180  - case "custom":
    181  - color = "#1ABC9C"
    182  - mess = messContent
    183  - break
    184  - default:
    185  - color = "#1ABC9C"
    186  - mess = messContent
    187  - }
     165 + // choose method
     166 + var color, mess string
     167 + switch messType {
     168 + case "start":
     169 + color = "#005b9f"
     170 + mess = fmt.Sprintf("%v Start to run *%v* on *%v*", GetEmoji(), options.Module.Name, options.Scan.ROptions["Workspace"])
     171 + break
     172 + case "done":
     173 + color = "#32cb00"
     174 + mess = fmt.Sprintf("%v Done run *%v* on *%v*", GetEmoji(), options.Module.Name, options.Scan.ROptions["Workspace"])
     175 + break
     176 + case "diff":
     177 + color = "#5E35B1"
     178 + mess = fmt.Sprintf("%v Diff content on %v: \n %v", GetEmoji(), options.Scan.ROptions["Workspace"], messContent)
     179 + break
     180 + case "custom":
     181 + color = "#1ABC9C"
     182 + mess = messContent
     183 + break
     184 + default:
     185 + color = "#1ABC9C"
     186 + mess = messContent
     187 + }
    188 188   
    189  - // message config
    190  - attachment := slack.Attachment{
    191  - Color: color,
    192  - Text: mess,
    193  - // sender name
    194  - Footer: options.Noti.ClientName,
    195  - FooterIcon: GetIcon(),
    196  - Ts: json.Number(strconv.FormatInt(time.Now().Unix(), 10)),
    197  - }
     189 + // message config
     190 + attachment := slack.Attachment{
     191 + Color: color,
     192 + Text: mess,
     193 + // sender name
     194 + Footer: options.Noti.ClientName,
     195 + FooterIcon: GetIcon(),
     196 + Ts: json.Number(strconv.FormatInt(time.Now().Unix(), 10)),
     197 + }
    198 198   
    199  - msg := slack.WebhookMessage{
    200  - Attachments: []slack.Attachment{attachment},
    201  - }
    202  - err := slack.PostWebhook(options.Noti.SlackWebHook, &msg)
    203  - if err != nil {
    204  - return err
    205  - }
    206  - return nil
     199 + msg := slack.WebhookMessage{
     200 + Attachments: []slack.Attachment{attachment},
     201 + }
     202 + err := slack.PostWebhook(options.Noti.SlackWebHook, &msg)
     203 + if err != nil {
     204 + return err
     205 + }
     206 + return nil
    207 207  }
    208 208   
    209 209  // SendFile send file to specific channel
    210 210  func SendFile(filename string, channel string, options libs.Options) error {
    211  - if options.Noti.SlackToken == "" || options.Noti.SlackReportChannel == "" {
    212  - return fmt.Errorf("Slack config improperly")
    213  - }
     211 + if options.Noti.SlackToken == "" || options.Noti.SlackReportChannel == "" {
     212 + return fmt.Errorf("Slack config improperly")
     213 + }
    214 214   
    215  - if !utils.FileExists(filename) {
    216  - return fmt.Errorf("report file not found: %v", filename)
    217  - }
     215 + if !utils.FileExists(filename) {
     216 + return fmt.Errorf("report file not found: %v", filename)
     217 + }
    218 218   
    219  - baseName := filepath.Base(filename)
    220  - mess := fmt.Sprintf("%v - %v - Report file for *%v* on *%v*", GetEmoji(), baseName, options.Module.Name, options.Scan.ROptions["Workspace"])
    221  - utils.DebugF("Sending %v message to %v", filename, channel)
     219 + baseName := filepath.Base(filename)
     220 + mess := fmt.Sprintf("%v - %v - Report file for *%v* on *%v*", GetEmoji(), baseName, options.Module.Name, options.Scan.ROptions["Workspace"])
     221 + utils.DebugF("Sending %v message to %v", filename, channel)
    222 222   
    223  - // sending file
    224  - api := slack.New(options.Noti.SlackToken)
    225  - params := slack.FileUploadParameters{
    226  - Channels: []string{channel},
    227  - Title: mess,
    228  - Filetype: "txt",
    229  - File: filename,
    230  - }
    231  - _, err := api.UploadFile(params)
    232  - if err != nil {
    233  - return err
    234  - }
    235  - return nil
     223 + // sending file
     224 + api := slack.New(options.Noti.SlackToken)
     225 + params := slack.FileUploadParameters{
     226 + Channels: []string{channel},
     227 + Title: mess,
     228 + Filetype: "txt",
     229 + File: filename,
     230 + }
     231 + _, err := api.UploadFile(params)
     232 + if err != nil {
     233 + return err
     234 + }
     235 + return nil
    236 236  }
    237 237   
    238 238  // TeleSendMess send message to telegram
    239 239  func TeleSendMess(options libs.Options, content string, channel string, wrap bool) error {
    240 240   
    241  - if options.NoNoti {
    242  - return fmt.Errorf("noti disabled")
    243  - }
    244  - bot, err := tgbotapi.NewBotAPI(options.Noti.TelegramToken)
    245  - if wrap {
    246  - content = fmt.Sprintf("```\n%s\n```", content)
    247  - }
    248  - if err != nil {
    249  - utils.DebugF("error init telegram: %v", err)
    250  - return err
    251  - }
     241 + if options.NoNoti {
     242 + return fmt.Errorf("noti disabled")
     243 + }
     244 + bot, err := tgbotapi.NewBotAPI(options.Noti.TelegramToken)
     245 + if wrap {
     246 + content = fmt.Sprintf("```\n%s\n```", content)
     247 + }
     248 + if err != nil {
     249 + utils.DebugF("error init telegram: %v", err)
     250 + return err
     251 + }
    252 252   
    253  - if channel == "" || channel == "general" {
    254  - channel = options.Noti.TelegramChannel
    255  - }
    256  - switch channel {
    257  - case "#status":
    258  - channel = options.Noti.TelegramStatusChannel
    259  - case "#r", "#report", "#reports", "#vuln":
    260  - channel = options.Noti.TelegramReportChannel
    261  - case "#s", "#sensitive", "#sen":
    262  - channel = options.Noti.TelegramSensitiveChannel
    263  - case "#dirb", "#dirscan":
    264  - channel = options.Noti.TelegramDirbChannel
    265  - case "#m", "#mics":
    266  - channel = options.Noti.TelegramMicsChannel
    267  - case "#default", "#general":
    268  - channel = options.Noti.TelegramChannel
    269  - }
    270  - telechannel := cast.ToInt64(channel)
    271  - utils.DebugF("send message to channel %v", channel)
    272  - msg := tgbotapi.NewMessage(telechannel, content)
    273  - msg.ParseMode = "markdown"
    274  - _, err = bot.Send(msg)
    275  - if err != nil {
    276  - utils.ErrorF("error sending telegram to %v -- %v", channel, err)
    277  - }
    278  - return err
     253 + if channel == "" || channel == "general" {
     254 + channel = options.Noti.TelegramChannel
     255 + }
     256 + switch channel {
     257 + case "#status":
     258 + channel = options.Noti.TelegramStatusChannel
     259 + case "#r", "#report", "#reports", "#vuln":
     260 + channel = options.Noti.TelegramReportChannel
     261 + case "#s", "#sensitive", "#sen":
     262 + channel = options.Noti.TelegramSensitiveChannel
     263 + case "#dirb", "#dirscan":
     264 + channel = options.Noti.TelegramDirbChannel
     265 + case "#m", "#mics":
     266 + channel = options.Noti.TelegramMicsChannel
     267 + case "#default", "#general":
     268 + channel = options.Noti.TelegramChannel
     269 + }
     270 + telechannel := cast.ToInt64(channel)
     271 + utils.DebugF("send message to channel %v", channel)
     272 + msg := tgbotapi.NewMessage(telechannel, content)
     273 + msg.ParseMode = "markdown"
     274 + _, err = bot.Send(msg)
     275 + if err != nil {
     276 + utils.DebugF("error sending telegram to %v -- %v", channel, err)
     277 + }
     278 + return err
    279 279  }
    280 280   
    281 281  // TeleSendFile send message to telegram
    282 282  func TeleSendFile(options libs.Options, filename string, channel string) error {
    283  - if options.NoNoti {
    284  - return fmt.Errorf("noti disabled")
    285  - }
    286  - bot, err := tgbotapi.NewBotAPI(options.Noti.TelegramToken)
    287  - if err != nil {
    288  - utils.DebugF("error init telegram: %v", err)
    289  - return err
    290  - }
     283 + if options.NoNoti {
     284 + return fmt.Errorf("noti disabled")
     285 + }
     286 + bot, err := tgbotapi.NewBotAPI(options.Noti.TelegramToken)
     287 + if err != nil {
     288 + utils.DebugF("error init telegram: %v", err)
     289 + return err
     290 + }
    291 291   
    292  - if channel == "" || channel == "general" {
    293  - channel = options.Noti.TelegramChannel
    294  - }
    295  - switch channel {
    296  - case "#status":
    297  - channel = options.Noti.TelegramStatusChannel
    298  - case "#r", "#report", "#reports", "#vuln":
    299  - channel = options.Noti.TelegramReportChannel
    300  - case "#sensitive", "#sen":
    301  - channel = options.Noti.TelegramSensitiveChannel
    302  - case "#dirb", "#dirscan":
    303  - channel = options.Noti.TelegramDirbChannel
    304  - case "#m", "#mics":
    305  - channel = options.Noti.TelegramMicsChannel
    306  - case "#default":
    307  - channel = options.Noti.TelegramChannel
    308  - }
    309  - telechannel := cast.ToInt64(channel)
     292 + if channel == "" || channel == "general" {
     293 + channel = options.Noti.TelegramChannel
     294 + }
     295 + switch channel {
     296 + case "#status":
     297 + channel = options.Noti.TelegramStatusChannel
     298 + case "#r", "#report", "#reports", "#vuln":
     299 + channel = options.Noti.TelegramReportChannel
     300 + case "#sensitive", "#sen":
     301 + channel = options.Noti.TelegramSensitiveChannel
     302 + case "#dirb", "#dirscan":
     303 + channel = options.Noti.TelegramDirbChannel
     304 + case "#m", "#mics":
     305 + channel = options.Noti.TelegramMicsChannel
     306 + case "#default":
     307 + channel = options.Noti.TelegramChannel
     308 + }
     309 + telechannel := cast.ToInt64(channel)
    310 310   
    311  - filename = utils.NormalizePath(filename)
    312  - msg := tgbotapi.NewDocumentUpload(telechannel, filename)
     311 + filename = utils.NormalizePath(filename)
     312 + msg := tgbotapi.NewDocumentUpload(telechannel, filename)
    313 313   
    314  - utils.DebugF("send file %v to channel %v", filename, channel)
    315  - _, err = bot.Send(msg)
    316  - if err != nil {
    317  - utils.DebugF("error sending telegram to %v -- %v", channel, err)
    318  - }
    319  - return err
     314 + utils.DebugF("send file %v to channel %v", filename, channel)
     315 + _, err = bot.Send(msg)
     316 + if err != nil {
     317 + utils.DebugF("error sending telegram to %v -- %v", channel, err)
     318 + }
     319 + return err
    320 320  }
    321 321   
    322 322  /////// utils for slack message
    323 323   
    324 324  // GetEmoji get random emoji
    325 325  func GetEmoji() string {
    326  - rand.Seed(time.Now().Unix())
    327  - emojis := []string{
    328  - ":robot_face:",
    329  - ":alien:",
    330  - ":gift:",
    331  - ":gun:",
    332  - ":diamond_shape_with_a_dot_inside:",
    333  - ":rocket:",
    334  - ":bug:",
    335  - ":broccoli:",
    336  - ":shamrock:",
    337  - }
    338  - n := rand.Int() % len(emojis)
    339  - return emojis[n]
     326 + rand.Seed(time.Now().Unix())
     327 + emojis := []string{
     328 + ":robot_face:",
     329 + ":alien:",
     330 + ":gift:",
     331 + ":gun:",
     332 + ":diamond_shape_with_a_dot_inside:",
     333 + ":rocket:",
     334 + ":bug:",
     335 + ":broccoli:",
     336 + ":shamrock:",
     337 + }
     338 + n := rand.Int() % len(emojis)
     339 + return emojis[n]
    340 340  }
    341 341   
    342 342  // GetIcon get random emoji
    343 343  func GetIcon() string {
    344  - rand.Seed(time.Now().Unix())
    345  - emojis := []string{
    346  - "https://platform.slack-edge.com/img/default_application_icon.png",
    347  - }
    348  - n := rand.Int() % len(emojis)
    349  - return emojis[n]
     344 + rand.Seed(time.Now().Unix())
     345 + emojis := []string{
     346 + "https://platform.slack-edge.com/img/default_application_icon.png",
     347 + }
     348 + n := rand.Int() % len(emojis)
     349 + return emojis[n]
    350 350  }
    351 351   
Please wait...
Page is in error, reload to recover