예제 #1
0
        public async Task SubscribeTask(string account)
        {
            var url = $"https://steamid.venner.io/raw.php?input={account}";

            using (var client = new WebClient())
            {
                var json = client.DownloadString(url);
                var obj  = JsonConvert.DeserializeObject <SteamConvertData>(json);

                string reply;
                if (LinkedAccounts.UserDictionary.TryAdd(Context.User.Id, obj.Uid))
                {
                    reply = $"Now I know you as [{obj.Name}](http://steamcommunity.com/profiles/{obj.Steamid64}) 🙂";
                    LinkedAccounts.Save();
                }
                else
                {
                    url =
                        $"https://steamid.venner.io/raw.php?input=[U:1:{LinkedAccounts.UserDictionary[Context.User.Id]}]";
                    json  = client.DownloadString(url);
                    obj   = JsonConvert.DeserializeObject <SteamConvertData>(json);
                    reply =
                        $"But But But I already know you as [{obj.Name}](http://steamcommunity.com/profiles/{obj.Steamid64}) 😕";
                }

                var embed = new EmbedBuilder {
                    Description = reply
                };
                await ReplyAsync(string.Empty, false, embed.Build());
            }
        }
예제 #2
0
 public async Task UnSubscribeTask(string accountId)
 {
     if (LinkedAccounts.UserDictionary.ContainsKey(Context.User.Id))
     {
         if (LinkedAccounts.UserDictionary[Context.User.Id] == accountId.Steam32Parse())
         {
             LinkedAccounts.UserDictionary.Remove(Context.User.Id);
             LinkedAccounts.Save();
             await ReplyAsync("Okay you are no longer " + accountId +
                              "\nI curse you to give a parameter every-time you use an `accountID` demanding command. RIP!");
         }
         else
         {
             await ReplyAsync("You were never " + accountId);
         }
     }
     else
     {
         await ReplyAsync(
             "Uhh I don't know who you are 😑" +
             "\n*I've arranged us a secret meeting at* `I am [you account]` 😉");
     }
 }