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.

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 requiring 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.

The admin role permits a server owner to authorizes members with a certain role to be able to change any server setting. Select a role to become the admin role with the admin-role option. Only the owner is allowed to change the admin role.

The map role allows admins/owners to restrict map access to members with a specific role. Set the map role with the map-role option. Remove the map, admin, or user role with remove-role. remove-role does not delete the role from the server.

Map Visibility

The visibility option allows admins/owners to change who can view the server map. Setting visibility to public allows anyone with a link to view the map. Setting it to member-restricted allows only server members to view the map. Choosing map-role-restricted restricts the map to the owner and members with the map role. admin-role-restricted limits access to only the owner and members with the admin role. Selecting invisible hides the map from everyone, including admins and the owner.

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.