Exemplo n.º 1
0
 /// <summary> Asynchronously sends a message to the discord API </summary>
 public void Send(DiscordApiMessage msg)
 {
     // can be null in gap between initial connection and ready event received
     if (api != null)
     {
         api.SendAsync(msg);
     }
 }
Exemplo n.º 2
0
        protected override void MessagePlayers(RelayPlayer p)
        {
            ChannelSendEmbed embed = new ChannelSendEmbed(p.ChannelID);
            int total;
            List <OnlineListEntry> entries = PlayerInfo.GetOnlineList(p, p.Rank, out total);

            embed.Title = string.Format("{0} player{1} currently online",
                                        total, total.Plural());
            foreach (OnlineListEntry e in entries)
            {
                if (e.players.Count == 0)
                {
                    continue;
                }

                embed.Fields.Add(
                    ConvertMessage(FormatRank(e)),
                    ConvertMessage(FormatPlayers(p, e))
                    );
            }
            api.SendAsync(embed);
        }