Ejemplo n.º 1
0
        public Task <ActionResult> UserInfoAsync(
            [Remainder, Description("The user whose info you want to see. Defaults to yourself.")]
            SocketGuildUser user = null)
        {
            user ??= Context.User;

            string GetRelevantActivity() => user.Activities.FirstOrDefault() switch
            {
                //we are ignoring custom emojis because there is no guarantee that volte is in the guild where the emoji is from; which could lead to a massive (and ugly) embed field value
                CustomStatusGame {
                    Emote : Emoji _
                } csg => $"{csg.Emote} {csg.State}",
                CustomStatusGame csg => $"{csg.State}",
                SpotifyGame _ => "Listening to Spotify",
                _ => user.Activities.FirstOrDefault()?.Name
            }
Ejemplo n.º 2
0
 public static bool TryGetSpotifyStatus(this IGuildUser user, out SpotifyGame spotify)
 {
     spotify = user.Activities.FirstOrDefault(x => x is SpotifyGame).Cast <SpotifyGame>();
     return(spotify != null);
 }