Sélectionner une révision Git
mpvwidget_interface.cc
usersyncroniser.ts 15,65 Kio
/*
Copyright 2018, 2019 matrix-appservice-discord
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
import { User, GuildMember } from "discord.js";
import { DiscordBot } from "./bot";
import { Util } from "./util";
import { Bridge, Intent, MatrixUser } from "matrix-appservice-bridge";
import { DiscordBridgeConfig } from "./config";
import { Log } from "./log";
import { IMatrixEvent } from "./matrixtypes";
import { DbUserStore, RemoteUser } from "./db/userstore";
const log = new Log("UserSync");
const DEFAULT_USER_STATE = {
avatarId: "",
avatarUrl: null,
createUser: false,
displayName: null,
id: null,
mxUserId: null,
removeAvatar: false,
};
const DEFAULT_GUILD_STATE = {
displayName: "",
id: null,
mxUserId: null,
roles: [],
};
export interface IUserState {
avatarId: string;
avatarUrl: string | null;
createUser: boolean;
displayName: string | null;
id: string;
mxUserId: string;
removeAvatar: boolean; // If the avatar has been removed from the user.
}
export interface IGuildMemberRole {
name: string;
color: number;
position: number;
}
export interface IGuildMemberState {
bot: boolean;
displayColor?: number;
displayName: string;
id: string;
mxUserId: string;
roles: IGuildMemberRole[];
username: string;
}