Ejemplo n.º 1
0
        private AfkMessage ReplaceSpaceHolder(User user)
        {
            ComingBack = ComingBack.Replace("{username}", user.Username)
                         .Replace("{time}", TimeHelper.ConvertMillisecondsToPassedTime(user.Time, "ago", ConversionType.YearDayHourMin))
                         .Replace("{message}", user.MessageText.Decode());
            ComingBack = string.IsNullOrEmpty(user.MessageText.Decode()) ? ComingBack.Replace(":", "").ReplaceSpaces() : ComingBack;

            GoingAway = GoingAway.Replace("{username}", user.Username);

            Resuming = Resuming.Replace("{username}", user.Username);

            return(this);
        }
Ejemplo n.º 2
0
    private void CreateMessages()
    {
        if (User is null)
        {
            return;
        }

        AfkCommand afkCommand = AppSettings.CommandList[(AfkCommandType)User.AfkType];

        ComingBack = afkCommand.ComingBack.Replace("{username}", User.Username)
                     .Replace("{time}", $"{TimeHelper.GetUnixDifference(User.AfkTime)} ago")
                     .Replace("{message}", User.AfkMessage.Decode());
        ComingBack = string.IsNullOrEmpty(User.AfkMessage.Decode()) ? ComingBack.Remove(":").ReplaceSpaces() : ComingBack;

        GoingAway = afkCommand.GoingAway.Replace("{username}", User.Username);

        Resuming = afkCommand.Resuming.Replace("{username}", User.Username);
    }