Example #1
0
 public async Task ApplySetting(string name, [Remainder] string value)
 {
     if (_settings.Has(name))
     {
         _settings.Set(name, value);
         await ReplyAsync("I updated the setting for you!");
     }
     else
     {
         _settings.Add(name, value);
         await ReplyAsync("I added the setting for you!");
     }
 }
Example #2
0
        public async Task ApplySetting(string name, [Remainder] string value)
        {
            (Context.User as IGuildUser).EnsureStaff();

            if (_settings.Has(name))
            {
                _settings.Set(name, value);
            }
            else
            {
                _settings.Add(name, value);
            }

            await ReplyAsync("Setting has been applied.");
        }
Example #3
0
        public async Task InitializeGiveaway([Remainder] string message)
        {
            // Delete the invokation message
            await Context.Message.DeleteAsync();

            // Reply with the specified message
            var botMessage = await ReplyAsync(message);

            // Find the giveaway emote and add it as a reaction
            var emote = _settings.Get(GIVEAWAY_EMOTE_IDENTIFIER);
            await botMessage.AddReactionAsync(new Emoji(emote));

            // Save the giveaway message id
            string identifier = $"{botMessage.Channel.Id}/{botMessage.Id.ToString()}";

            if (!_settings.Has(GIVEAWAY_MESSAGE_IDENTIFIER))
            {
                _settings.Add(GIVEAWAY_MESSAGE_IDENTIFIER, identifier);
            }
            else
            {
                _settings.Set(GIVEAWAY_MESSAGE_IDENTIFIER, identifier);
            }
        }