Exemple #1
0
        public override async Task <IResult> MessageReceived(TyniBot.CommandContext context)
        {
            var message = context.Message;
            var channel = context.Channel;

            KeyValuePair <string, string> addition = ParseMsg(message);
            await message.DeleteAsync();

            var boardMsg = (await channel.GetMessagesAsync(1).FlattenAsync()).FirstOrDefault();

            Dictionary <string, string> board = StringToBoard(boardMsg.Content);

            if (board.ContainsKey(addition.Key))
            {
                board[addition.Key] = addition.Value;
            }
            else
            {
                board.Add(addition.Key, addition.Value);
            }

            await boardMsg.DeleteAsync();

            await channel.SendMessageAsync(BoardToString(board));

            return(ExecuteResult.FromSuccess());
        }
Exemple #2
0
        public override async Task <IResult> MessageReceived(TyniBot.CommandContext context)
        {
            var message = context.Message;
            var channel = context.Channel;
            //var user = context.User;
            //var role = context.Guild.Roles.FirstOrDefault(x => x.Id == 740316086284845093);

            KeyValuePair <string, string> addition = ParseMsg(message);
            await message.DeleteAsync();

            var boardMsg = (await channel.GetMessagesAsync(1).FlattenAsync()).FirstOrDefault();

            Dictionary <string, string> board = StringToBoard(boardMsg.Content);

            if (board.ContainsKey(addition.Key))
            {
                board[addition.Key] = addition.Value;
            }
            else
            {
                board.Add(addition.Key, addition.Value);
            }

            //await (user as IGuildUser).AddRoleAsync(role);

            await boardMsg.DeleteAsync();

            await channel.SendMessageAsync(BoardToString(board));

            return(ExecuteResult.FromSuccess());
        }