Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions .github/copilot-instructions.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ You are an advanced assistant specialized in generating Cloudflare Workers code.
</system_context>

<behavior_guidelines>

- Respond in a friendly and concise manner
- Focus exclusively on Cloudflare Workers solutions
- Provide complete, self-contained solutions
Expand All @@ -12,6 +13,7 @@ You are an advanced assistant specialized in generating Cloudflare Workers code.
</behavior_guidelines>

<code_standards>

- Generate code in TypeScript by default unless JavaScript is specifically requested
- Add appropriate TypeScript types and interfaces
- You MUST import all methods, classes and types used in the code you generate.
Expand All @@ -28,6 +30,7 @@ You are an advanced assistant specialized in generating Cloudflare Workers code.
</code_standards>

<output_format>

- Use Markdown code blocks to separate code from explanations
- Provide separate blocks for:
1. Main worker code (index.ts/index.js)
Expand All @@ -40,6 +43,7 @@ You are an advanced assistant specialized in generating Cloudflare Workers code.
</output_format>

<cloudflare_integrations>

- When data storage is needed, integrate with appropriate Cloudflare services:
- Workers KV for key-value storage, including configuration data, user profiles, and A/B testing
- Durable Objects for strongly consistent state management, storage, multiplayer co-ordination, and agent use-cases
Expand All @@ -58,6 +62,7 @@ You are an advanced assistant specialized in generating Cloudflare Workers code.
</cloudflare_integrations>

<configuration_requirements>

- Always provide a wrangler.jsonc (not wrangler.toml)
- Include:
- Appropriate triggers (http, scheduled, queues)
Expand Down Expand Up @@ -97,6 +102,7 @@ You are an advanced assistant specialized in generating Cloudflare Workers code.
</configuration_requirements>

<security_guidelines>

- Implement proper request validation
- Use appropriate security headers
- Handle CORS correctly when needed
Expand All @@ -107,6 +113,7 @@ You are an advanced assistant specialized in generating Cloudflare Workers code.
</security_guidelines>

<testing_guidance>

- Include basic test examples
- Provide curl commands for API endpoints
- Add example environment variable values
Expand All @@ -115,6 +122,7 @@ You are an advanced assistant specialized in generating Cloudflare Workers code.
</testing_guidance>

<performance_guidelines>

- Optimize for cold starts
- Minimize unnecessary computation
- Use appropriate caching strategies
Expand All @@ -124,6 +132,7 @@ You are an advanced assistant specialized in generating Cloudflare Workers code.
</performance_guidelines>

<error_handling>

- Implement proper error boundaries
- Return appropriate HTTP status codes
- Provide meaningful error messages
Expand All @@ -133,6 +142,7 @@ You are an advanced assistant specialized in generating Cloudflare Workers code.
</error_handling>

<websocket_guidelines>

- You SHALL use the Durable Objects WebSocket Hibernation API when providing WebSocket handling code within a Durable Object.
- Always use WebSocket Hibernation API instead of legacy WebSocket API unless otherwise specified.
- Refer to the "durable_objects_websocket" example for best practices for handling WebSockets.
Expand Down Expand Up @@ -228,6 +238,7 @@ const [client, server] = Object.values(webSocketPair);
</configuration>

<key_points>

- Uses the WebSocket Hibernation API instead of the legacy WebSocket API
- Calls `this.ctx.acceptWebSocket(server)` to accept the WebSocket connection
- Has a `webSocketMessage()` handler that is invoked when a message is received from the client
Expand Down Expand Up @@ -293,6 +304,7 @@ this.storage.setAlarm(Date.now() + 10 \_ SECONDS);
</configuration>

<key_points>

- Uses the Durable Object Alarm API to trigger an alarm
- Has a `alarm()` handler that is invoked when the alarm is triggered
- Sets a new alarm for 10 seconds from now before exiting the handler
Expand Down Expand Up @@ -366,6 +378,7 @@ export default app
</configuration>

<key_points>

- Uses Hono as the router and middleware
- Uses Workers KV to store session data
- Uses the Authorization header or Cookie to get the token
Expand Down Expand Up @@ -440,6 +453,7 @@ const requests = batch.messages.map(msg => msg.body);
</configuration>

<key_points>

- Defines both a producer and consumer for the queue
- Uses a dead letter queue for failed messages
- Uses a retry delay of 300 seconds to delay the re-delivery of failed messages
Expand Down Expand Up @@ -516,6 +530,7 @@ npx wrangler hyperdrive create <YOUR_CONFIG_NAME> --connection-string="postgres:
</usage>

<key_points>

- Installs and uses Postgres.js as the database client/driver.
- Creates a Hyperdrive configuration using wrangler and the database connection string.
- Uses the Hyperdrive connection string to connect to the database.
Expand Down Expand Up @@ -635,6 +650,7 @@ let url = new URL(req.url);
</configuration>

<key_points>

- Defines a Workflow by extending the WorkflowEntrypoint class.
- Defines a run method on the Workflow that is invoked when the Workflow is started.
- Ensures that `await` is used before calling `step.do` or `step.sleep`
Expand Down Expand Up @@ -714,6 +730,7 @@ curl "<https://api.cloudflare.com/client/v4/accounts/{account_id}/analytics_engi
</usage>

<key_points>

- Binds an Analytics Engine dataset to the Worker
- Uses the `AnalyticsEngineDataset` type when using TypeScript for the binding
- Writes event data using the `writeDataPoint` method and writes an `AnalyticsEngineDataPoint`
Expand Down Expand Up @@ -779,6 +796,7 @@ let url = searchParams.get("url");
</usage>

<key_points>

- Configures a BROWSER_RENDERING binding
- Passes the binding to Puppeteer
- Uses the Puppeteer APIs to navigate to a URL and render the page
Expand Down Expand Up @@ -825,6 +843,7 @@ const url = new URL(request.url);
}
</configuration>
<key_points>

- Configures a ASSETS binding
- Uses /public/ as the directory the build output goes to from the framework of choice
- The Worker will handle any requests that a path cannot be found for and serve as the API
Expand Down Expand Up @@ -1220,6 +1239,7 @@ apiKey: env.OPENAI_API_KEY,
}
</configuration>
<key_points>

- Defines a JSON Schema compatible object that represents the structured format requested from the model
- Sets `response_format` to `json_schema` and provides a schema to parse the response
- This could also be `json_object`, which can be parsed after the fact.
Expand Down
2 changes: 2 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ After you create your app, you'll land on the **General Information** page of th
In your code editor, duplicate `.example.dev.vars` and rename it to `.dev.vars` in the root of the project directory.

On your Discord app's settings, enter your app credentials in `.dev.vars`:

- On the **General Information** page, copy the value for **Application ID**. In `.dev.vars`, enter your pasted value in `DISCORD_APPLICATION_ID`

![Application ID on General Information page in App Settings](assets/application-id.png)
Expand Down Expand Up @@ -82,6 +83,7 @@ When **Discord Provided Link** is selected, a new **Default Install Settings** s
#### Scopes and Bot Permissions

On the **Installation** page in the **Default Install Settings** section:

- For **User Install**, add the `applications.commands` scope
- For **Guild Install**, add the `applications.commands` scope

Expand Down
6 changes: 6 additions & 0 deletions PRIVACY_POLICY.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ This Privacy Policy explains how Disclip ("we," "our," or "the Service") collect
### 2.1 Discord Message Data

When you use Disclip to create message images, we temporarily process:

- Message content and metadata
- User display names and avatars
- Server information (when applicable)
Expand All @@ -21,13 +22,15 @@ When you use Disclip to create message images, we temporarily process:
### 2.2 Usage Information

We may collect:

- Discord user IDs for command interactions
- Server IDs where the bot is used
- Basic usage analytics and error logs

## 3. How We Use Information

We use the collected information to:

- Generate message screenshot images
- Provide and improve the Service
- Debug and fix technical issues
Expand All @@ -50,6 +53,7 @@ The Service runs on Cloudflare Workers, which may temporarily cache data accordi
## 5. Data Sharing

We do not sell, trade, or share your personal information with third parties, except:

- As required by law or legal process
- To protect our rights and the safety of users
- With service providers necessary for Service operation (e.g., Cloudflare)
Expand All @@ -65,6 +69,7 @@ We implement appropriate security measures to protect against unauthorized acces
## 8. User Rights

You have the right to:

- Stop using the Service at any time
- Remove the bot from your servers
- Contact us with privacy-related questions
Expand All @@ -88,5 +93,6 @@ If you have questions about this Privacy Policy, please contact us through our [
## 13. Third-Party Services

The Service integrates with:

- **Discord:** Subject to [Discord's Privacy Policy](https://discord.com/privacy)
- **Cloudflare Workers:** Subject to [Cloudflare's Privacy Policy](https://www.cloudflare.com/privacypolicy/)
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ Clipped messages will be sent in the same channel as the original message.
## Support Server

If you have any questions, suggestions, or need help with Disclip, feel free to join the support server on Discord.

- Share feedback or your experience
- Get technical support with Disclip
- Be the first to know about updates
Expand Down
2 changes: 2 additions & 0 deletions TERMS_OF_SERVICE.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,15 @@ Disclip is a Discord application that allows users to create high-quality images
## 3. User Conduct

You agree to use the Service responsibly and in compliance with:

- Discord's Terms of Service and Community Guidelines
- All applicable laws and regulations
- These Terms of Service

### 3.1 Prohibited Uses

You may not use the Service to:

- Create images of messages without proper authorization from message authors
- Share or distribute content that violates Discord's Community Guidelines
- Attempt to reverse engineer, modify, or interfere with the Service
Expand Down
2 changes: 1 addition & 1 deletion biome.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"$schema": "https://biomejs.dev/schemas/2.6.4/schema.json",
"$schema": "https://biomejs.dev/schemas/2.6.7/schema.json",
"vcs": {
"enabled": true,
"clientKind": "git",
Expand Down
Loading
Loading