import axios from "axios";

const discordAxiosClient = axios.create({
	baseURL: process.env.DISCORD_SERVER_URL || "https://discord.com/api/v10",
});

export const renameMember = async (memberId: string, newName: string) => {
	discordAxiosClient
		.post("/member/rename", {
			memberId,
			newName,
		})
		.catch((error) => {
			console.error("Error renaming member:", error);
		});
};

export const addRolesToMember = async (memberId: string, roleIds: string[]) => {
	discordAxiosClient
		.post("/member/add-role", {
			memberId,
			roleIds,
		})
		.catch((error) => {
			console.error("Error adding roles to member:", error);
		});
};

export const removeRolesFromMember = async (memberId: string, roleIds: string[]) => {
	discordAxiosClient
		.post("/member/remove-role", {
			memberId,
			roleIds,
		})
		.catch((error) => {
			console.error("Error removing roles from member:", error);
		});
};
