Skip to content

Guildsync: Add verbose reason for role removal #140

@brybrant

Description

@brybrant

async def remove_roles(self, roles):
try:
coro = self.member.remove_roles(*roles, reason="$guildsync")
await asyncio.wait_for(coro, timeout=5)
except (asyncio.TimeoutError, discord.Forbidden):
pass

A player was recently kicked from my guild, but my Discord server audit log says "$guildsync" as the reason for the role removal. It would be great if the reason could be more specific; did the player leave the guild or were they kicked? This can be checked with the guild log endpoint ( https://wiki.guildwars2.com/wiki/API:2/guild/:id/log )

When a player is removed from a guild, the reason ( "type" field ) is always "kick".
If a player leaves a guild, their account name is in the "user" field and "kicked_by" field. Example:

[
  {},
  {
    "id": 123456,
    "time": "2023-06-10T00:00:00.000Z",
    "type": "kick",
    "user": "example.1234",
    "kicked_by": "example.1234"
  },
  {}
]

If a player is kicked by someone else, it appears as you would expect:

[
  {},
  {
    "id": 654321,
    "time": "2023-06-10T00:00:00.000Z",
    "type": "kick",
    "user": "example.1234",
    "kicked_by": "someone.5678"
  },
  {}
]

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions