mirror of
https://github.com/matrix-org/mjolnir.git
synced 2024-10-01 01:36:06 -04:00
Mjölnir-for-all: Nicer display name
This commit is contained in:
parent
fa5fbee229
commit
d83127ea8c
@ -65,8 +65,8 @@ export class MjolnirManager {
|
||||
intentListener,
|
||||
);
|
||||
await managedMjolnir.start();
|
||||
if (this.config.displayName) {
|
||||
await client.setDisplayName(this.config.displayName);
|
||||
if (this.config.bot.displayName) {
|
||||
await client.setDisplayName(this.config.bot.displayName);
|
||||
}
|
||||
this.perMjolnirId.set(mjolnirUserId, managedMjolnir);
|
||||
this.perOwnerId.set(requestingUserId, managedMjolnir);
|
||||
|
@ -75,16 +75,21 @@ export interface IConfig {
|
||||
address: string;
|
||||
}
|
||||
},
|
||||
/** a display name */
|
||||
displayName?: string,
|
||||
bot: {
|
||||
/** a display name */
|
||||
displayName?: string,
|
||||
},
|
||||
}
|
||||
|
||||
export function read(configPath: string): IConfig {
|
||||
const content = fs.readFileSync(configPath, "utf8");
|
||||
const parsed = load(content);
|
||||
const config = (parsed as object) as IConfig;
|
||||
if (!config.displayName) {
|
||||
config.displayName = "Moderation Bot";
|
||||
if (!config.bot) {
|
||||
config.bot = {};
|
||||
}
|
||||
if (!config.bot.displayName) {
|
||||
config.bot.displayName = "Moderation Bot";
|
||||
}
|
||||
return config;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user