Пример #1
0
        public void NoRepatedEventNames()
        {
            //Example for  event starting at 6am utc, repeating every day
            string userInput = "Genshin3; 13 March 2021, 06:00AM; 1:0:0:0";

            NotifyEventManager.AddEvent(userInput);
            Assert.Throws <ArgumentException>(() => NotifyEventManager.AddEvent(userInput));

            Assert.Equal(1, NotifyEventManager.NotifyEventCount());
        }
Пример #2
0
        public void NoRepeatedUserSubscriber()
        {
            //Example for  event starting at 6am utc, repeating every day
            string userInput = "Genshin2; 13 March 2021, 06:00AM; 1:0:0:0";

            NotifyEventManager.AddEvent(userInput);

            ulong userID    = 132;
            ulong userGuild = 321;

            NotifyEventManager.SubscribeUserToEvent(userID, userGuild, "Genshin2");
            Assert.False(NotifyEventManager.SubscribeUserToEvent(userID, userGuild, "Genshin2"));
        }
Пример #3
0
        public async Task EventCreate(CommandContext ctx, [RemainingText] string args)
        {
            logger.Info("Create Event Command", Useful.GetDiscordName(ctx));

            string message;

            try
            {
                NotifyEventManager.AddEvent(args);
                message = "Event added. Now activate it manually";
            }
            catch (Exception ex)
            {
                message = "Event not created, error: " + ex.Message;
            }

            await ctx.Message.RespondAsync(message).ConfigureAwait(false);
        }