Skip to content

WeismanGitHub/Population-Map-Discord-Bot

Repository files navigation

Population Map Bot

The Population Map Bot is a dynamic map generator that visualizes your Discord server's population data on a global, continental, or country level. Maps are generated from self-reported locations provided by server members and are anonymous.

Server members use /set-location to set their country and, optionally, a subdivision (state, province, etc.) within that country. Maps are generated through the website, and you can get a link to a server's map with /map. Server admins can also make it so only members who share their location can access the server.

World Example Continents Example USA Example USA Example

User Docs

You can delete your data with /user-delete. Your location should be automatically removed from a server map if you leave or are kicked/banned, but this will not work if the bot is offline. Use /remove-location if your location is not automatically removed.

Location

Add your location to a server map with the /set-location command. Use /remove-location anywhere to remove your location from a server map. Use /view-location to see your location in a server.

Server Owners Docs

Set a server's settings with /server-settings. By default, the roles are set to nothing.

Server Roles

The user role is assigned to a member when they set their location and is removed when their location is deleted. You can lock your server behind this role, essentially forcing people set their locations. You must place the Population Map Bot role above the user role in your server's settings for it to work.

Server members with the admin role can make changes to the server settings (except deleting server data). Only the owner is allowed to change the admin role.

You can make it so only people with the map role can see the map, but you also need to set the map visibility.

Remove the map, admin, or user role with the remove-role option. remove-role does not delete the role from the server.

Map Visibility

Owners/admins can change who can see the server map with the visiblity option. The public option lets anyone with a link see the map, member-restricted allows only members to see it, map-role-restricted authorizes people with the map role, and admin-role-restricted authorizes owners/admins. invisible hides the map from everyone, including owners/admins.

Defaults

visibility: public
admin-role: null
map-role: null
user-role: null

Developer Instructions

Commands

npm run setup installs the required packages
npm run build builds the application
npm run dev runs the application locally with nodemon
npm run commands deploys commands to Discord
npm run prettier reformats the code
fly deploy deploys the application to Fly.io

Environment Variables

The top level directory and /src/client both require their own .env files.

Populate the client .env with the variables VITE_BOT_INVITE, VITE_OAUTH_URL, and VITE_SUPPORT_SERVER_INVITE.

Populate the top level .env with the variables in /src/server/config.ts.