Exemplo n.º 1
0
 public async Task ShowProfileAsync(MiunieUser user, MiunieChannel c)
 => await _discordMessages.SendMessageAsync(c, user);
Exemplo n.º 2
0
 public async Task YesNoMaybeAnswer(MiunieChannel targetChannel) =>
 await _discordMessages.SendMessageAsync(targetChannel, PhraseKey.YES_NO_MAYBE);
Exemplo n.º 3
0
 public async Task ShowGuildProfileAsync(MiunieGuild guild, MiunieChannel c)
 => await _discordMessages.SendMessageAsync(c, guild);
Exemplo n.º 4
0
        public async Task RemoveReputationAsync(MiunieUser invoker, MiunieUser target, MiunieChannel c)
        {
            if (invoker.UserId == target.UserId)
            {
                await _discordMessages.SendMessageAsync(c, PhraseKey.CANNOT_SELF_REP, invoker.Name);

                return;
            }

            if (_reputationProvider.CanRemoveReputation(invoker, target))
            {
                return;
            }

            _reputationProvider.RemoveReputation(invoker, target);

            if (_miunieDiscord.UserIsMiunie(target))
            {
                await _discordMessages.SendMessageAsync(c, PhraseKey.REPUTATION_TAKEN_BOT, invoker.Name);

                return;
            }

            await _discordMessages.SendMessageAsync(c, PhraseKey.REPUTATION_TAKEN, invoker.Name, target.Name);
        }
Exemplo n.º 5
0
 public async Task SendRandomYesNoAnswer(MiunieChannel channel)
 {
     await _messages.SendMessageAsync(channel, PhraseKey.YES_NO_MAYBE);
 }
Exemplo n.º 6
0
 public async Task ShowProfile(MiunieUser u, MiunieChannel c)
 {
     var response = _lang.GetPhrase("SHOW_PROFILE", u.Reputation);
     await _discordMessages.SendMessage(response, c);
 }
Exemplo n.º 7
0
        public async Task ShowReputationLogAsync(MiunieUser invoker, MiunieUser target, int page, MiunieChannel c)
        {
            page -= 1;
            var repGiven = _reputationProvider.GetReputation(target);

            await _discordMessages.SendMessageAsync(c, repGiven, page);
        }
Exemplo n.º 8
0
        public async Task OutputMessageTimeAsLocalAsync(ulong messageId, DateTimeOffset?createdTimeOffset, DateTimeOffset?editTimeOffset, MiunieUser user, MiunieChannel channel)
        {
            if (createdTimeOffset is null)
            {
                await _messages.SendMessageAsync(channel, PhraseKey.TIME_NO_MESSAGE, messageId.ToString());

                return;
            }

            var messageCreated = _timeManipulator.GetDateTimeLocalToUser(createdTimeOffset?.UtcDateTime, user);
            var messageEdited  = _timeManipulator.GetDateTimeLocalToUser(editTimeOffset?.UtcDateTime, user);

            if (messageEdited.HasValue)
            {
                await _messages.SendMessageAsync(channel, PhraseKey.TIME_MESSAGE_INFO_EDIT, messageId.ToString(), messageCreated, messageEdited);

                return;
            }

            await _messages.SendMessageAsync(channel, PhraseKey.TIME_MESSAGE_INFO_NO_EDIT, messageId.ToString(), messageCreated);
        }
Exemplo n.º 9
0
        public async Task OutputFutureTimeForUserAsync(MiunieUser user, string verb, int units, string timeframe, MiunieChannel channel)
        {
            if (verb.Trim().ToLower() != "in")
            {
                await _messages.SendMessageAsync(channel, PhraseKey.INCORRECT_VERB, verb);

                return;
            }

            var timeFromLocal = _timeManipulator.GetTimeSpanFromString(timeframe, units);

            if (timeFromLocal is null)
            {
                await _messages.SendMessageAsync(channel, PhraseKey.TIME_USERTIME_IN_FUTURE_UNPARSABLE, units.ToString(), timeframe);

                return;
            }

            var usersOffset     = user.UtcTimeOffset ?? new TimeSpan();
            var usersLocalTime  = _dateTime.UtcNow + usersOffset;
            var usersFutureTime = usersLocalTime + timeFromLocal;

            await _messages.SendMessageAsync(channel, PhraseKey.TIME_USERTIME_IN_FUTURE, user.Name, usersFutureTime, units.ToString(), timeframe);
        }
Exemplo n.º 10
0
        public async Task OutputCurrentTimeComparedToInputForUserAsync(MiunieUser requestUser, DateTime requestTime, string verb, MiunieUser user, MiunieChannel channel)
        {
            if (verb.Trim().ToLower() != "for")
            {
                await _messages.SendMessageAsync(channel, PhraseKey.INCORRECT_VERB, verb);

                return;
            }

            var requesterOffset = requestUser.UtcTimeOffset ?? new TimeSpan();
            var otherUserOffSet = user.UtcTimeOffset ?? new TimeSpan();

            var requestUtcTime = requestTime - requesterOffset;
            var otherUserTime  = requestUtcTime + otherUserOffSet;

            await _messages.SendMessageAsync(channel, PhraseKey.TIME_USERTIME_FROM_LOCAL, requestTime, user.Name, otherUserTime);
        }
Exemplo n.º 11
0
        public async Task SetUtcOffsetForUserByAdminAsync(DateTime userTime, MiunieUser user, MiunieChannel channel)
        {
            var offset = TimeSpan.FromHours(userTime.Hour - _dateTime.UtcNow.Hour);

            user.UtcTimeOffset = offset;
            _users.StoreUser(user);
            await _messages.SendMessageAsync(channel, PhraseKey.TIME_NEW_OFFSET_SET_ADMIN, user.Name);
        }
Exemplo n.º 12
0
 public async Task RemoveUserData(MiunieUser user, MiunieChannel channel)
 {
     _users.RemoveUser(user);
     await _messages.SendMessageAsync(channel, PhraseKey.USER_PRIVACY_DATA_REMOVED, user.Name);
 }