fix: dont use copilooooooooooooot - correct guildid

This commit is contained in:
xHyroM 2022-10-20 12:47:20 +02:00
parent 14b0c6d252
commit 6c1528b7be

View file

@ -6,7 +6,7 @@ export const getDiscordGuildMembers = async(token: string) => {
while (true) { while (true) {
const members: any[] = await (await fetch( const members: any[] = await (await fetch(
`https://discord.com/api/v8/guilds/${process.env.DISCORD_GUILD_ID}/members?limit=1000${oldId ? `&after=${oldId}` : ''}`, `https://discord.com/api/v10/guilds/876711213126520882/members?limit=1000${oldId ? `&after=${oldId}` : ''}`,
{ {
headers: { headers: {
Authorization: `Bot ${token}`, Authorization: `Bot ${token}`,
@ -14,7 +14,7 @@ export const getDiscordGuildMembers = async(token: string) => {
} }
)).json(); )).json();
if (!members.length) break; if (members.length == 0) break;
result.push(...members.map(m => ({ id: m.id, nickname: m.nick }))); result.push(...members.map(m => ({ id: m.id, nickname: m.nick })));
oldId = members[members.length - 1].id; oldId = members[members.length - 1].id;
@ -31,7 +31,7 @@ export const removeExclamationFromNicknames = async(token: string) => {
for (const member of await getDiscordGuildMembers(token)) { for (const member of await getDiscordGuildMembers(token)) {
if (!member.nickname?.startsWith?.('!')) continue; if (!member.nickname?.startsWith?.('!')) continue;
await fetch(`https://discord.com/api/v8/guilds/${process.env.DISCORD_GUILD_ID}/members/${member.id}`, { await fetch(`https://discord.com/api/v8/guilds/876711213126520882/members/${member.id}`, {
method: 'PATCH', method: 'PATCH',
headers: { headers: {
Authorization: `Bot ${token}`, Authorization: `Bot ${token}`,