コード例 #1
0
 public RichDisplay(ulong authorId, ulong messageId)
 {
     AuthorId         = authorId;
     MessageId        = messageId;
     InternalTemplate = new MessageEmbed();
     InformationPage  = null;
     AllowedEmojis    = new (RichDisplayReactionType, string)[0];
コード例 #2
0
ファイル: Module.cs プロジェクト: Marmanoff/CryptoDiscordBot
        public async Task PumpDate(DateTime date, double hours, double minutes)
        {
            try
            {
                int counter = 0;
                await Context.Channel.SendMessageAsync("Date for pump has been set");

                var  pumpDate = date.AddHours(hours).AddMinutes(minutes);
                bool firstRun = true;
                while (pumpDate >= DateTime.Now)
                {
                    var embeds = new MessageEmbed(date, hours, minutes);
                    await SetGame(embeds);

                    await Task.Delay(15000);

                    if (counter == 1 || firstRun == true)
                    {
                        firstRun = false;
                        await SendSignalMessage(embeds);

                        counter = 0;
                    }

                    counter++;
                }
            }
            catch (Exception)
            {
                await Context.Channel.SendMessageAsync("pumpdate needs to be a date.");
            }
        }
コード例 #3
0
ファイル: Module.cs プロジェクト: Marmanoff/CryptoDiscordBot
 public async Task SendSignalMessage(MessageEmbed embeds)
 {
     if (int.Parse(embeds.Day) >= 1 || int.Parse(embeds.Hour.ToString()) >= 5)
     {
         var signalChannel = (ISocketMessageChannel)Context.Client.GetChannel(400626676070875156);
         await signalChannel.SendMessageAsync("", false, embeds.BuildEmbed().Build());
     }
     else
     {
         var communityChannel = (ISocketMessageChannel)Context.Client.GetChannel(401353571498721280);
         await communityChannel.SendMessageAsync("@everyone", false, embeds.BuildEmbed().Build());
     }
 }
コード例 #4
0
        /// <summary>
        /// Adds a message embed to the queue.
        /// </summary>
        /// <remarks>
        /// All methods relating to the Message Event Queue are O(1) constant time.
        /// This is because there is no list of events as there can only be one at a time for a user.
        /// </remarks>
        /// <param name="embed">The embed to add</param>
        public static void AddMessageEvent(MessageEmbed embed)
        {
            ulong id = embed.CommandCaller.Id;

            if (MessageEventQueue.ContainsKey(id))
            {
                // If the user is in the queue
                MessageEventQueue[id] = new MessageEventNode(embed, embed.CommandChannel);  // Add the action to their list
            }
            else
            {
                // otherwise
                MessageEventQueue.Add(id, new MessageEventNode(embed, embed.CommandChannel));  // Create the entry and add the action to their list
            }
        }
コード例 #5
0
ファイル: Module.cs プロジェクト: Marmanoff/CryptoDiscordBot
        public async Task SetGame(MessageEmbed embeds)
        {
            if (embeds.TimeSpan.Days == 0)
            {
                await Context.Client.SetGameAsync("Pump in " + embeds.Hour + ":" + embeds.Minute);

                var shit = embeds.Minute;
            }
            else
            {
                await Context.Client.SetGameAsync("Pump in " + embeds.Day + "d" + " " + embeds.Hour + ":" + embeds.Minute);

                var shit = embeds.Minute;
            }

            if (embeds.PumpDate <= DateTime.Now)
            {
                await Context.Client.SetGameAsync("");
            }
        }
コード例 #6
0
 public MessageEventNode(MessageEmbed iface, SocketChannel c)
 {
     Interface   = iface;
     Channel     = c;
     TimeCreated = DateTime.Now;
 }
コード例 #7
0
        /// <summary>
        /// Removes a message event from the queue.
        /// </summary>
        /// <param name="node">The embed to remove.</param>
        public static void RemoveMessageEvent(MessageEmbed node)
        {
            ulong id = node.CommandCaller.Id;

            RemoveMessageEvent(id);
        }