pineafan | 3276721 | 2022-03-14 21:27:39 +0000 | [diff] [blame] | 1 | import * as fs from 'fs'; |
| 2 | |
| 3 | function writeLogConfig(guild, logs) { |
| 4 | if( !fs.existsSync(`./data/guilds/${guild.id}/config.json`) ) { |
| 5 | fs.rmSync(`./data/guilds/${guild.id}/config.json`); |
| 6 | } |
| 7 | if( !fs.existsSync(`./data/guilds/${guild.id}/pins.json`) ) { |
| 8 | let pins = guild.channels.cache.filter(c => c.type === "GUILD_TEXT").map( |
| 9 | c => c.messages.fetchPinned().then(m => m.map(m => m.id)) |
| 10 | ); |
| 11 | fs.writeFileSync(`./data/guilds/${guild.id}/pins.json`, JSON.stringify(pins)); |
| 12 | } |
| 13 | if( !fs.existsSync(`./data/guilds/${guild.id}/logs.json`) ) { |
| 14 | fs.writeFileSync(`./data/guilds/${guild.id}/logs.json`, JSON.stringify([])); |
| 15 | } else if( logs ) { |
| 16 | fs.rmSync(`./data/guilds/${guild.id}/logs.json`); |
| 17 | fs.writeFileSync(`./data/guilds/${guild.id}/logs.json`, JSON.stringify([])); |
| 18 | } |
| 19 | fs.writeFileSync(`./data/guilds/${guild.id}/config.json`, JSON.stringify({ |
| 20 | metadata: { |
| 21 | premium: false |
| 22 | }, |
| 23 | logs: { |
| 24 | enabled: true, |
| 25 | logChannel: guild.systemChannelId, |
| 26 | toLog: "8be71", |
| 27 | toIgnore: { |
| 28 | bots: false, |
| 29 | channels: [], |
| 30 | members: [], |
| 31 | roles: [] |
| 32 | } |
| 33 | }, |
| 34 | userVerification: { |
| 35 | enabled: false, |
| 36 | roleID: null, |
| 37 | customMessage: null |
| 38 | }, |
| 39 | modmail: { |
| 40 | enabled: false, |
| 41 | categoryId: null, |
| 42 | namingScheme: "rsm-{user}-{discriminator}", |
| 43 | }, |
| 44 | welcome: { |
| 45 | enabled: false, |
| 46 | channelId: null, |
| 47 | message: null, |
| 48 | messageType: "embed", |
| 49 | }, |
| 50 | filters: { |
pineafan | e625d78 | 2022-05-09 18:04:32 +0100 | [diff] [blame^] | 51 | images: { |
| 52 | NSFW: true, |
| 53 | size: true |
| 54 | }, |
| 55 | malware: true, |
| 56 | wordFilter: { |
| 57 | enabled: true, |
| 58 | words: { |
| 59 | strict: [], |
| 60 | loose: [] |
| 61 | }, |
| 62 | allowed: { |
| 63 | users: [], |
| 64 | roles: [], |
| 65 | channels: [] |
| 66 | } |
| 67 | }, |
| 68 | invite: { |
| 69 | enabled: true, |
| 70 | allowed: { |
| 71 | users: [], |
| 72 | channels: [], |
| 73 | roles: [] |
| 74 | } |
| 75 | }, |
| 76 | pings: { |
| 77 | mass: 5, |
| 78 | everyone: true, |
| 79 | roles: true, |
| 80 | allowed: { |
| 81 | roles: [], |
| 82 | rolesToMention: [], |
| 83 | users: [], |
| 84 | channels: [] |
| 85 | } |
| 86 | } |
| 87 | }, |
pineafan | 3276721 | 2022-03-14 21:27:39 +0000 | [diff] [blame] | 88 | tags: {} |
| 89 | })); |
| 90 | } |
| 91 | |
| 92 | export default writeLogConfig; |