mirror of
https://github.com/ZeppelinBot/Zeppelin.git
synced 2025-05-10 12:25:02 +00:00
feat: new username support vol 2
This commit is contained in:
parent
ecaa16bf7c
commit
63c41f0278
29 changed files with 105 additions and 64 deletions
|
@ -1,10 +1,11 @@
|
|||
import { User } from "discord.js";
|
||||
import { GuildPluginData } from "knub";
|
||||
import { renderUserUsername } from "../../utils";
|
||||
import { UsernameSaverPluginType } from "./types";
|
||||
|
||||
export async function updateUsername(pluginData: GuildPluginData<UsernameSaverPluginType>, user: User) {
|
||||
if (!user) return;
|
||||
const newUsername = user.tag;
|
||||
const newUsername = renderUserUsername(user);
|
||||
const latestEntry = await pluginData.state.usernameHistory.getLastEntry(user.id);
|
||||
if (!latestEntry || newUsername !== latestEntry.username) {
|
||||
await pluginData.state.usernameHistory.addEntry(user.id, newUsername);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue