Esempio n. 1
0
        public async Task Execute(
            [Remainder][Summary("Specify the string '" + ConfirmString + "' to confirm execution of this command")]
            string Confirm
            )
        {
            Log.Application_.LogVerbose("Executing RefreshImgurOAuth with confirm string '{0}'", Confirm);
            if (!ConfirmString.Equals(Confirm, StringComparison.CurrentCultureIgnoreCase))
            {
                await Usage();

                return;
            }
            IOAuth2Token NewToken;

            try{
                NewToken = await Imgur.RefreshUserAuthenticationToken();
            }catch (ImgurException Error) {
                await base.ReplyAsync("Error refreshing Imgur OAuth Token: " + Error.Message);

                return;
            }
            await base.ReplyAsync(string.Format(
                                      "Imgur OAuth Token refresh successful. The new Token will expire at {0:u}."
                                      + "\r\nIt is strongly recommended that an administrator backup the new Token."
                                      , NewToken.ExpiresAt
                                      ));
        }