PyDrocsid / cogs

The official cog library used by PyDrocsid bots
GNU General Public License v3.0
13 stars 5 forks source link

Show join name in userlog #135

Closed Defelo closed 2 years ago

Defelo commented 2 years ago

Userlog "join" entries should contain the name the user had when joining the server.

umairkarel commented 2 years ago

Do we want to add username to the out list in this function ?

TheCataliasTNT2k commented 2 years ago

Do we want to add username to the out list in this function ?

No, the logging cog currently logs all username and nickname changes. But it does not log the username the user had, when he joined the server. Just log the username on join, that's all.... The current username can easily be found when pinging the user, no need to add it to out.

umairkarel commented 2 years ago

Just log the username on join

Actually, I not getting how to Log?

Defelo commented 2 years ago

Actually, the username is already logged on join, but it is not shown in the userlog itself. Just read the name the user had on join from the database and put it into the userlog join entries (you will have to modify the translation string in translations/en.yml for this).

umairkarel commented 2 years ago
join: Join
async for join in await db.stream(filter_by(Join, member=user_id)):
    username_on_join = t.ulog.username_on_join(join.member_name)
    out.append((join.timestamp, t.ulog.joined))
ulog:
  created: ":sparkles: **Created** this account."
  joined: ":tada: **Joined** this server."
  left: ":door: **Left** this server."
  username_on_join: "`{}`"

Is it right? added username_on_join

Defelo commented 2 years ago

You can just add the username placeholder to the ulog.created translation string instead of creating an new translation