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,
|
intentListener,
|
||||||
);
|
);
|
||||||
await managedMjolnir.start();
|
await managedMjolnir.start();
|
||||||
if (this.config.displayName) {
|
if (this.config.bot.displayName) {
|
||||||
await client.setDisplayName(this.config.displayName);
|
await client.setDisplayName(this.config.bot.displayName);
|
||||||
}
|
}
|
||||||
this.perMjolnirId.set(mjolnirUserId, managedMjolnir);
|
this.perMjolnirId.set(mjolnirUserId, managedMjolnir);
|
||||||
this.perOwnerId.set(requestingUserId, managedMjolnir);
|
this.perOwnerId.set(requestingUserId, managedMjolnir);
|
||||||
|
@ -75,16 +75,21 @@ export interface IConfig {
|
|||||||
address: string;
|
address: string;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
/** a display name */
|
bot: {
|
||||||
displayName?: string,
|
/** a display name */
|
||||||
|
displayName?: string,
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
export function read(configPath: string): IConfig {
|
export function read(configPath: string): IConfig {
|
||||||
const content = fs.readFileSync(configPath, "utf8");
|
const content = fs.readFileSync(configPath, "utf8");
|
||||||
const parsed = load(content);
|
const parsed = load(content);
|
||||||
const config = (parsed as object) as IConfig;
|
const config = (parsed as object) as IConfig;
|
||||||
if (!config.displayName) {
|
if (!config.bot) {
|
||||||
config.displayName = "Moderation Bot";
|
config.bot = {};
|
||||||
|
}
|
||||||
|
if (!config.bot.displayName) {
|
||||||
|
config.bot.displayName = "Moderation Bot";
|
||||||
}
|
}
|
||||||
return config;
|
return config;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user