Skip to content

Weird Behaviour of member.status and member.activities #891

Closed
@TheKaushikGoswami

Description

@TheKaushikGoswami

Summary

Both member.status and member.activities return some weird values.

Reproduction Steps

  • Make a command to fetch a member's status and activities.
  • Add an optional parameter to select the member.
  • Change the default value of member to ctx.author.
  • Have a "Playing a Game" activity and keep your status Online (you can have different activity/status too but the code snippet below is for these status and activity right now, You would need to edit the snippet to reproduce for your case).
  • Run the command 2 times:
    • 1st Time: Pass the member parameter by selecting yourself as the member.
    • 2nd Time: Don't Pass the member parameter (let it use the default value).

Minimal Reproducible Code

import discord
from discord.ext import commands
from discord.commands import slash_command, Option

intents = discord.Intents.all()
bot = commands.Bot(command_prefix="-", case_insensitive=True, intents=intents)

class UserInfo(commands.Cog, name="Cog Name"):

    @slash_command()
    async def userinfo(self, ctx, member: Option(discord.Member, "Choose The Member", required=False)):
        await ctx.defer()
        if member == None:
            member = ctx.author
        status = " "
        activity = "None"
        if member.status == discord.Status.online:
            status = f'🟢'
        elif member.status == discord.Status.offline:
            status = f'🟤'
        if member.activity == None:
            activity = "No Activity"
        else:
            if member.activities[-1].type == discord.ActivityType.custom:
                activity = "None"
            elif member.activities[-1].type == discord.ActivityType.playing:
                activity = f"Playing {member.activities[-1].name}"
        await ctx.followup.send(f"**Status:** {status}\n**Activity:** {activity}")       

bot.add_cog(UserInfo(bot))
bot.run("token-here")

Expected Results

The result in second case should be the same as in first case.

Actual Results

The results produced are different and the second result is weird and incorrect.

Intents

All

System Information

  • Python v3.10.2-final
  • py-cord v2.0.0-beta
    • py-cord pkg_resources: v2.0.0b1
  • aiohttp v3.7.4.post0
  • system info: Windows 10 10.0.22000

Checklist

  • I have searched the open issues for duplicates.
  • I have shown the entire traceback, if possible.
  • I have removed my token from display, if visible.

Metadata

Metadata

Assignees

No one assigned

    Labels

    unconfirmed bugA bug report that needs triaging

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions