예제 #1
0
        public async Task Trace(string user, string user2)
        {
            if (Limiter.Limit(Context, TimeSpan.FromSeconds(5)))
            {
                if (DsUtils.IsMention(user))
                {
                    ulong discordId = DsUtils.GetMentionId(user);
                    var   treeUser  = Garden.Tree.GetUser(discordId);

                    await ReplyAsync(embed : GetEmbed(treeUser, Garden.Tree.GetUser(Context.User.Id)));
                }
                else
                {
                    await ReplyAsync("Please tag a user!");
                }
            }
        }
예제 #2
0
        public async Task UnFriend(string user)
        {
            if (Limiter.Limit(Context, TimeSpan.FromSeconds(1)))
            {
                if (DsUtils.IsMention(user))
                {
                    ulong discordId   = DsUtils.GetMentionId(user);
                    var   discordUser = await Garden.TheFriendTree.GetUserAsync(discordId);

                    var treeUser = Garden.Tree.GetUser(discordId);

                    var currentTreeUser = Garden.Tree.GetUser(Context.User.Id);

                    if (treeUser != null && treeUser.TreeId != currentTreeUser.TreeId && !discordUser.IsBot)
                    {
                        if (currentTreeUser.Friends.Contains(treeUser.TreeId))
                        {
                            treeUser.Friends.Remove(currentTreeUser.TreeId);
                            currentTreeUser.Friends.Remove(treeUser.TreeId);
                            await ReplyAsync($"You are no longer the friend of {DsUtils.GetDiscordUsername(discordUser.Id)}!");
                        }
                        else
                        {
                            await ReplyAsync($"You are not friends with the person.");
                        }
                    }
                    else
                    {
                        await ReplyAsync($"The target user is not valid in this context!");
                    }
                }
                else
                {
                    await ReplyAsync("Please tag a user!");
                }
            }
        }