blob: 42ec5803d475640ed2955152772cc7deae417b26 [file] [log] [blame]
pineafan32767212022-03-14 21:27:39 +00001import log from '../utils/log.js'
2import readConfig from '../utils/readConfig.js'
3import convertCurlyBracketString from '../utils/convertCurlyBracketString.js'
4
5export async function callback(_, member) {
6 let config = await readConfig(member.guild.id);
7
8 config.stats.forEach(async element => {
9 if (element.enabled) {
10 let string = element.text
11 if (!string) return
12 string = await convertCurlyBracketString(string, member.id, member.displayName, member.guild.name, member.guild.members)
13
14 let channel = await member.client.channels.fetch(element.channel)
15 if (channel.guild.id !== member.guild.id) return
16 if (!channel) return // TODO: Notify mods
17 try {
18 await channel.edit({ name: string })
19 } catch (err) {
20 console.error(err)
21 }
22 }
23 });
24}