Skip to main content

Overview

Stiletto integrates with Discord to provide authentication and enhanced clan management features. By connecting your Discord account, you can create clans, manage members, and integrate the Stiletto Discord bot with your server.

How Discord Integration Works

Stiletto uses Discord OAuth2 to authenticate users. The authentication flow:
  1. User clicks “Login with Discord” button
  2. Redirects to Discord’s authorization page
  3. Discord redirects back to Stiletto with an authorization code
  4. Stiletto exchanges the code for user information and creates a session token
  5. User is authenticated and can access protected features

OAuth2 Configuration

The Discord OAuth2 integration requires:
  • Client ID: Set via VITE_DISCORD_CLIENT_ID environment variable
  • Redirect URI: {your-domain}/profile
  • Scopes: identify and guilds
// From src/functions/utils.ts:37-41
const discordAuthUrl = `https://discord.com/api/oauth2/authorize?client_id=${
  config.DISCORD_CLIENT_ID
}&redirect_uri=${getDomain()}/profile&scope=identify%20guilds&response_type=code`;

Connecting Your Discord Account

Step 1: Navigate to Profile

Go to the Stiletto website and click the Login with Discord button in the navigation menu or visit /profile directly.

Step 2: Authorize Stiletto

You’ll be redirected to Discord’s authorization page. Click Authorize to grant Stiletto access to:
  • Your Discord identity (username and ID)
  • Your Discord guild (server) list

Step 3: Complete Setup

After authorization, you’ll be redirected back to Stiletto and automatically logged in. You can now:
  • Set your in-game nickname
  • Create or join a clan
  • Access clan management features

Features Requiring Discord Authentication

The following features are only available to authenticated Discord users:

Profile Management

Once connected, you can manage your profile at /profile:
  • View your Discord tag
  • Set your in-game nickname
  • Change language preferences
  • Delete your account
// User profile data from src/functions/requests/users.ts:7-20
interface UserInfo {
  discordid: string;
  discordtag: string;
  nickname?: string;
  clanname?: string;
  leaderid?: string;
}

Clan Creation and Management

Authenticated users can:
  • Create a new clan: Only available to users without a clan
  • Join an existing clan: Browse clan list and request to join
  • Manage clan members: Add, remove, or update member permissions (clan leaders only)
  • Leave a clan: Members can leave at any time (except clan leaders)

Resource Maps

Create and share interactive resource maps with your clan:
  • Create private maps with password protection
  • Add markers for resources, bases, and points of interest
  • Share map links with your clan members

Trading System

Post trade offers to the community:
  • Create trade listings for items
  • View and search available trades
  • Delete your own trade listings

Diplomacy Management

Manage your clan’s relationships with other clans:
  • Mark clans as Allies, Enemies, or NAP (Non-Aggression Pact)
  • View your clan’s diplomatic relationships
  • Remove relationships when needed

Discord Bot Integration for Clans

Clan leaders can integrate the Stiletto Discord bot with their Discord server to automatically sync walker data and enable additional features.

Bot Features

  • Walker Tracking: Automatically collect and display your clan’s walkers
  • Discord Server Integration: Link your clan to a specific Discord server
  • Automated Updates: Keep walker information synchronized

Configuring the Discord Bot

Clan leaders can configure bot settings through the clan management interface:
// From src/functions/requests/clans/discordbot.ts:10-25
// Get current bot configuration
const config = await getDiscordConfig(clanId);

// Update bot configuration
interface UpdateBotConfigParams {
  guildid?: string;        // Discord server ID
  discordid?: string;      // Bot user ID
  // Additional configuration options
}

await updateBotConfig(clanId, {
  guildid: "your-discord-server-id"
});

Bot API Endpoints

GET /clans/:clanId/discordbot
object
Get Discord bot configuration for a clanAuthentication: Required (Bearer token)Response:
{
  "guildid": "123456789",
  "discordid": "987654321"
}
PUT /clans/:clanId/discordbot
object
Update Discord bot configurationAuthentication: Required (Bearer token)Query Parameters:
  • guildid (optional): Discord server ID
  • discordid (optional): Bot user ID
Response:
{
  "message": "Configuration updated successfully"
}

User Workflows

First-Time User Setup

  1. Visit Stiletto website
  2. Click Login with Discord
  3. Authorize Stiletto on Discord
  4. Get redirected to profile page
  5. Set your in-game nickname
  6. Create a clan or join an existing one

Clan Leader Workflow

  1. Log in with Discord
  2. Create a new clan (or become clan leader)
  3. Configure clan settings
  4. Integrate Discord bot (optional)
  5. Manage members and permissions
  6. Set up diplomatic relationships
  7. Share resource maps with clan

Clan Member Workflow

  1. Log in with Discord
  2. Browse clan list at /clanlist
  3. Request to join a clan
  4. Wait for clan leader approval
  5. Access clan resources and maps
  6. View clan walkers and tech tree

Session Management

Stiletto maintains user sessions using tokens stored in the browser:
// From src/functions/requests/users.ts:107-123
// Discord authentication returns a token
interface LoginInfo {
  discordid: string;
  token: string;
}

const response = await authDiscord(authCode);
if (response?.discordid && response?.token) {
  // Token is stored and used for subsequent API requests
  login(response.discordid, response.token);
}
Tokens are included in API requests via the Authorization header:
headers: {
  Authorization: `Bearer ${token}`
}

Disconnecting Your Account

To disconnect your Discord account and delete all your data:
  1. Go to your profile page at /profile
  2. Scroll to the bottom
  3. Click Delete User
  4. Confirm the deletion
Deleting your account is permanent and will:
  • Remove all your data from Stiletto
  • Remove you from any clans you’ve joined
  • Delete any maps or trades you’ve created
  • This action cannot be undone

Troubleshooting

”Login Again” Error

If you see an error asking you to log in again:
  • Your session token may have expired
  • Clear your browser cache and log in again
  • Check that you’re using the same Discord account

Authorization Failed

If Discord authorization fails:
  • Ensure you clicked Authorize on the Discord page
  • Check that Stiletto has the correct Discord Client ID configured
  • Try logging out of Discord and back in
  • Verify your Discord account is in good standing

Can’t Create or Join Clan

If you can’t create or join a clan:
  • Ensure you’re logged in with Discord
  • Verify you don’t already belong to a clan (you must leave first)
  • Check that you’ve set your in-game nickname
  • Contact the clan leader if joining a private clan

Privacy and Security

Stiletto only requests the minimum Discord permissions needed:
  • identify: To get your Discord username and ID
  • guilds: To see which Discord servers you’re in (for bot integration)
Stiletto does not:
  • Read your Discord messages
  • Access your Discord friends list
  • Post messages on your behalf
  • Access any other Discord data