164
PRIVACY.md
164
PRIVACY.md
@@ -1,72 +1,92 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
</head>
|
||||
<body>
|
||||
<h1>Privacy Policy</h1>
|
||||
<p><strong>Effective Date:</strong> March 20, 2026</p>
|
||||
<p>This Privacy Policy describes how SkyBot ("the Bot") collects, uses, and stores information when used within a Valour planet.</p>
|
||||
<hr>
|
||||
<h2>1. Information Collected</h2>
|
||||
<p>The Bot collects only the minimum data necessary to provide its intended functionality. Most data is stored in-memory and is lost when the Bot restarts. A small amount of server configuration data is persisted to a local SQLite database for features that require it.</p>
|
||||
<h3>Information Temporarily Held in Memory:</h3>
|
||||
<ol>
|
||||
<li>Channel IDs (for routing messages and commands)</li>
|
||||
<li>Planet IDs (for planet-specific operations)</li>
|
||||
<li>Member IDs (for moderation commands and game session tracking)</li>
|
||||
<li>Member display names (for game contributor lists in Hangman, Wordle, and Trivia)</li>
|
||||
</ol>
|
||||
<h3>Information Persisted to Disk:</h3>
|
||||
<p>The following server configuration data is saved to a local SQLite database so that it survives restarts:</p>
|
||||
<ol>
|
||||
<li>Planet IDs (to associate configuration with a planet)</li>
|
||||
<li>Channel IDs (to remember the configured welcome channel)</li>
|
||||
<li>Welcome message template (the text set by a moderator via <code>setwelcome message</code>)</li>
|
||||
<li>Welcome system active state (enabled/disabled)</li>
|
||||
</ol>
|
||||
<p>This data contains no personal user information. It is server configuration set by planet moderators and is stored locally on the host running the Bot.</p>
|
||||
<h3>Information Never Stored:</h3>
|
||||
<ol>
|
||||
<li>Message content</li>
|
||||
<li>Direct Messages ("DMs")</li>
|
||||
<li>Personal account information (including usernames, email addresses, or other personally identifiable information)</li>
|
||||
</ol>
|
||||
<hr>
|
||||
<h2>2. Purpose of Data Collection</h2>
|
||||
<p>Temporarily held information is used exclusively to:</p>
|
||||
<ol>
|
||||
<li>Route commands to the correct channels and planets</li>
|
||||
<li>Enable moderation commands such as ban, unban, and kick</li>
|
||||
<li>Track active game sessions (Hangman, Wordle, Trivia) and display contributor lists</li>
|
||||
<li>Enable core bot functionality during the current session</li>
|
||||
</ol>
|
||||
<p>The Bot does not use any information for profiling, marketing, analytics, or tracking purposes.</p>
|
||||
<hr>
|
||||
<h2>3. Data Storage and Security</h2>
|
||||
<p>Most data is stored in-memory only and is automatically cleared when the Bot restarts. The exception is server configuration for the welcome system (see Section 1), which is written to a local SQLite database on the host machine. No data is sent to any external storage or cloud service.</p>
|
||||
<p>The Bot does not sell, rent, trade, or otherwise share any data with third parties.</p>
|
||||
<p>Some features make outbound requests to third-party APIs to fetch content. These requests do not include any user data:</p>
|
||||
<ul>
|
||||
<li><strong>Datamuse</strong> (datamuse.com) — word lists for Hangman and Wordle</li>
|
||||
<li><strong>Open Trivia Database</strong> (opentdb.com) — trivia questions for Trivia</li>
|
||||
<li><strong>The Cat API</strong> (thecatapi.com) — random cat images for the cat command</li>
|
||||
<li><strong>nekos.best</strong> (nekos.best) — hug GIFs for the hug command</li>
|
||||
<li><strong>Pixabay</strong> (pixabay.com) — images for the image command</li>
|
||||
</ul>
|
||||
<hr>
|
||||
<h2>4. Data Retention</h2>
|
||||
<p>In-memory data (game sessions, moderation context, etc.) is held only for the duration of the Bot's current session and is cleared on restart. Server configuration data for the welcome system is retained in a local SQLite database until explicitly changed or deleted by a planet moderator.</p>
|
||||
<hr>
|
||||
<h2>5. Self-Hosting</h2>
|
||||
<p>SkyBot is designed for self-hosting. If you choose to host your own instance of SkyBot, you are responsible for the privacy and security of any data processed by your instance. This policy applies to the official instance of SkyBot only.</p>
|
||||
<hr>
|
||||
<h2>6. Future Changes to Logging or Data Practices</h2>
|
||||
<p>If additional operational logging or data collection practices are introduced in the future, this Privacy Policy will be updated to reflect those changes prior to implementation.</p>
|
||||
<p>Continued use of the Bot after updates to this policy constitutes acceptance of the revised policy.</p>
|
||||
<hr>
|
||||
<h2>7. Contact Information</h2>
|
||||
<p>For privacy-related inquiries, requests, or concerns, please contact:</p>
|
||||
<p><strong>Email:</strong> contact@skyjoshua.xyz</p>
|
||||
</body>
|
||||
</html>
|
||||
# Privacy Policy
|
||||
|
||||
**Effective Date:** March 20, 2026
|
||||
|
||||
This Privacy Policy describes how SkyBot ("the Bot") collects, uses, and stores information when used within a Valour planet.
|
||||
|
||||
---
|
||||
|
||||
## 1. Information Collected
|
||||
|
||||
The Bot collects only the minimum data necessary to provide its intended functionality. Most data is stored in-memory and is lost when the Bot restarts. A small amount of server configuration data is persisted to a local SQLite database for features that require it.
|
||||
|
||||
### Information Temporarily Held in Memory
|
||||
|
||||
1. Channel IDs (for routing messages and commands)
|
||||
2. Planet IDs (for planet-specific operations)
|
||||
3. Member IDs (for moderation commands and game session tracking)
|
||||
4. Member display names (for game contributor lists in Hangman, Wordle, and Trivia)
|
||||
|
||||
### Information Persisted to Disk
|
||||
|
||||
The following server configuration data is saved to a local SQLite database so that it survives restarts:
|
||||
|
||||
1. Planet IDs (to associate configuration with a planet)
|
||||
2. Channel IDs (to remember the configured welcome channel)
|
||||
3. Welcome message template (the text set by a moderator via `setwelcome message`)
|
||||
4. Welcome system active state (enabled/disabled)
|
||||
|
||||
This data contains no personal user information. It is server configuration set by planet moderators and is stored locally on the host running the Bot.
|
||||
|
||||
### Information Never Stored
|
||||
|
||||
1. Message content
|
||||
2. Direct Messages ("DMs")
|
||||
3. Personal account information (including usernames, email addresses, or other personally identifiable information)
|
||||
|
||||
---
|
||||
|
||||
## 2. Purpose of Data Collection
|
||||
|
||||
Temporarily held information is used exclusively to:
|
||||
|
||||
1. Route commands to the correct channels and planets
|
||||
2. Enable moderation commands such as ban, unban, and kick
|
||||
3. Track active game sessions (Hangman, Wordle, Trivia) and display contributor lists
|
||||
4. Enable core bot functionality during the current session
|
||||
|
||||
The Bot does not use any information for profiling, marketing, analytics, or tracking purposes.
|
||||
|
||||
---
|
||||
|
||||
## 3. Data Storage and Security
|
||||
|
||||
Most data is stored in-memory only and is automatically cleared when the Bot restarts. The exception is server configuration for the welcome system (see Section 1), which is written to a local SQLite database on the host machine. No data is sent to any external storage or cloud service.
|
||||
|
||||
The Bot does not sell, rent, trade, or otherwise share any data with third parties.
|
||||
|
||||
Some features make outbound requests to third-party APIs to fetch content. These requests do not include any user data:
|
||||
|
||||
- **Datamuse** (datamuse.com) — word lists for Hangman and Wordle
|
||||
- **Open Trivia Database** (opentdb.com) — trivia questions for Trivia
|
||||
- **The Cat API** (thecatapi.com) — random cat images for the cat command
|
||||
- **nekos.best** (nekos.best) — hug GIFs for the hug command
|
||||
- **Pixabay** (pixabay.com) — images for the image command
|
||||
|
||||
---
|
||||
|
||||
## 4. Data Retention
|
||||
|
||||
In-memory data (game sessions, moderation context, etc.) is held only for the duration of the Bot's current session and is cleared on restart. Server configuration data for the welcome system is retained in a local SQLite database until explicitly changed or deleted by a planet moderator.
|
||||
|
||||
---
|
||||
|
||||
## 5. Self-Hosting
|
||||
|
||||
SkyBot is designed for self-hosting. If you choose to host your own instance of SkyBot, you are responsible for the privacy and security of any data processed by your instance. This policy applies to the official instance of SkyBot only.
|
||||
|
||||
---
|
||||
|
||||
## 6. Future Changes to Logging or Data Practices
|
||||
|
||||
If additional operational logging or data collection practices are introduced in the future, this Privacy Policy will be updated to reflect those changes prior to implementation.
|
||||
|
||||
Continued use of the Bot after updates to this policy constitutes acceptance of the revised policy.
|
||||
|
||||
---
|
||||
|
||||
## 7. Contact Information
|
||||
|
||||
For privacy-related inquiries, requests, or concerns, please contact:
|
||||
|
||||
**Email:** contact@skyjoshua.xyz
|
||||
248
README.md
248
README.md
@@ -1,131 +1,129 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<body>
|
||||
<h1>SkyBot</h1>
|
||||
<p>
|
||||
# SkyBot
|
||||
|
||||
SkyBot is a Valour.gg bot built with .NET 10.
|
||||
</p>
|
||||
<h2>Features</h2>
|
||||
<ul>
|
||||
<li>Designed for self-hosting</li>
|
||||
<li>Open-source under AGPL-3.0</li>
|
||||
<li>Built with .NET 10</li>
|
||||
<li>Command system with automatic registration</li>
|
||||
</ul>
|
||||
<h3>Fun</h3>
|
||||
<ul>
|
||||
<li>8ball — ask the magic 8 ball a question</li>
|
||||
<li>coinflip — flip a coin</li>
|
||||
<li>dice — roll a die</li>
|
||||
<li>rockpaperscissors — play rock paper scissors against the bot</li>
|
||||
<li>choose — pick one of the given options</li>
|
||||
<li>echo — repeat text through the bot</li>
|
||||
<li>reverse — reverse yours or a replied message</li>
|
||||
<li>mock — mOcK tExT</li>
|
||||
<li>t9encode / t9decode — encode or decode old phone keypad multi-tap digits</li>
|
||||
<li>hangman — channel-wide game of hangman with optional category (<code>hg <letter or word></code> to guess)</li>
|
||||
<li>wordle — channel-wide Wordle; guess the 5-letter word in 6 tries (<code>wg <word></code> to guess)</li>
|
||||
<li>trivia — channel-wide trivia question with 30 seconds to answer (<code>tg <A/B/C/D></code> to guess)</li>
|
||||
<li>image — fetch a random image matching your search (aliases: <code>img</code>)</li>
|
||||
</ul>
|
||||
<h3>Chill</h3>
|
||||
<ul>
|
||||
<li>cat — post a random cat picture</li>
|
||||
<li>hug — send a hug with a random gif</li>
|
||||
</ul>
|
||||
<h3>Info</h3>
|
||||
<ul>
|
||||
<li>ping — check bot latency</li>
|
||||
<li>uptime — show how long the bot has been running</li>
|
||||
<li>info — user and planet info</li>
|
||||
<li>version — show the current bot and Valour SDK version</li>
|
||||
<li>usercount — show the total Valour user count</li>
|
||||
<li>source — link to the bot's source code</li>
|
||||
<li>joinsite — link to a site to help bots join a planet</li>
|
||||
<li>devcentral — invite link to the Dev Central planet</li>
|
||||
<li>swagger — link to the Valour API docs</li>
|
||||
<li>minecraft — Unofficial ValourSMP server IPs</li>
|
||||
<li>suggest — submit a suggestion for the bot</li>
|
||||
</ul>
|
||||
<h3>Moderation</h3>
|
||||
<ul>
|
||||
<li>ban / unban / kick — member moderation</li>
|
||||
<li>bans — list all bans in the planet</li>
|
||||
<li>setwelcome — configure a welcome channel and message</li>
|
||||
</ul>
|
||||
<h2>Data & Privacy</h2>
|
||||
<p>SkyBot stores only the minimum data required for operation. All data is stored in-memory and is lost on restart. SkyBot does <strong>not</strong> persist any data to disk.</p>
|
||||
<p>SkyBot does <strong>not</strong> store:</p>
|
||||
<ul>
|
||||
<li>Message content</li>
|
||||
<li>Direct messages</li>
|
||||
<li>Personal user data</li>
|
||||
</ul>
|
||||
<p>
|
||||
Full privacy policy:<br>
|
||||
<a href="https://github.com/SkyJoshua/SkyBot/blob/main/PRIVACY.md">
|
||||
https://github.com/SkyJoshua/SkyBot/blob/main/PRIVACY.md
|
||||
</a>
|
||||
</p>
|
||||
<h2>License</h2>
|
||||
<p>
|
||||
This project is licensed under the
|
||||
<strong>GNU Affero General Public License v3.0 (AGPL-3.0)</strong>.
|
||||
</p>
|
||||
<p>
|
||||
See the LICENSE file for details:<br>
|
||||
<a href="https://github.com/SkyJoshua/SkyBot/blob/main/LICENSE">
|
||||
https://github.com/SkyJoshua/SkyBot/blob/main/LICENSE
|
||||
</a>
|
||||
</p>
|
||||
<p>
|
||||
Because this project is licensed under AGPL-3.0, if you modify and deploy it
|
||||
publicly (including as a hosted service), you must make your source code
|
||||
available under the same license.
|
||||
</p>
|
||||
<h2>Requirements</h2>
|
||||
<ul>
|
||||
<li>.NET 10</li>
|
||||
<li>A Valour bot token</li>
|
||||
<li>A <a href="https://pixabay.com/api/docs/">Pixabay API key</a> (free) — required for the <code>image</code> command</li>
|
||||
</ul>
|
||||
<h2>Installation</h2>
|
||||
<p>Fork this repository, then:</p>
|
||||
<pre><code>git clone https://github.com/YOUR_USERNAME/SkyBot.git
|
||||
|
||||
---
|
||||
|
||||
## Features
|
||||
|
||||
- Designed for self-hosting
|
||||
- Open-source under AGPL-3.0
|
||||
- Built with .NET 10
|
||||
- Command system with automatic registration
|
||||
|
||||
### Fun
|
||||
|
||||
- `8ball` — ask the magic 8 ball a question
|
||||
- `coinflip` — flip a coin
|
||||
- `dice` — roll a die
|
||||
- `rockpaperscissors` — play rock paper scissors against the bot
|
||||
- `choose` — pick one of the given options
|
||||
- `echo` — repeat text through the bot
|
||||
- `reverse` — reverse yours or a replied message
|
||||
- `mock` — mOcK tExT
|
||||
- `t9encode` / `t9decode` — encode or decode old phone keypad multi-tap digits
|
||||
- `hangman` — channel-wide game of hangman with optional category (`hg <letter or word>` to guess)
|
||||
- `wordle` — channel-wide Wordle; guess the 5-letter word in 6 tries (`wg <word>` to guess)
|
||||
- `trivia` — channel-wide trivia question with 30 seconds to answer (`tg <A/B/C/D>` to guess)
|
||||
- `image` — fetch a random image matching your search (aliases: `img`)
|
||||
|
||||
### Chill
|
||||
|
||||
- `cat` — post a random cat picture
|
||||
- `hug` — send a hug with a random gif
|
||||
|
||||
### Info
|
||||
|
||||
- `ping` — check bot latency
|
||||
- `uptime` — show how long the bot has been running
|
||||
- `info` — user and planet info
|
||||
- `version` — show the current bot and Valour SDK version
|
||||
- `usercount` — show the total Valour user count
|
||||
- `source` — link to the bot's source code
|
||||
- `joinsite` — link to a site to help bots join a planet
|
||||
- `devcentral` — invite link to the Dev Central planet
|
||||
- `swagger` — link to the Valour API docs
|
||||
- `minecraft` — Unofficial ValourSMP server IPs
|
||||
- `suggest` — submit a suggestion for the bot
|
||||
|
||||
### Moderation
|
||||
|
||||
- `ban` / `unban` / `kick` — member moderation
|
||||
- `bans` — list all bans in the planet
|
||||
- `setwelcome` — configure a welcome channel and message
|
||||
|
||||
---
|
||||
|
||||
## Data & Privacy
|
||||
|
||||
SkyBot stores only the minimum data required for operation. Most data is stored in-memory and is lost on restart. A small amount of server configuration data is persisted to a local SQLite database for the welcome system.
|
||||
|
||||
SkyBot does **not** store:
|
||||
|
||||
- Message content
|
||||
- Direct messages
|
||||
- Personal user data
|
||||
|
||||
Full privacy policy:
|
||||
https://git.skyjoshua.xyz/SkyJoshua/SkyBot/blob/main/PRIVACY.md
|
||||
|
||||
---
|
||||
|
||||
## License
|
||||
|
||||
This project is licensed under the **GNU Affero General Public License v3.0 (AGPL-3.0)**.
|
||||
|
||||
See the LICENSE file for details:
|
||||
https://git.skyjoshua.xyz/SkyJoshua/SkyBot/blob/main/LICENSE
|
||||
|
||||
Because this project is licensed under AGPL-3.0, if you modify and deploy it publicly (including as a hosted service), you must make your source code available under the same license.
|
||||
|
||||
---
|
||||
|
||||
## Requirements
|
||||
|
||||
- .NET 10
|
||||
- A Valour bot token
|
||||
- A [Pixabay API key](https://pixabay.com/api/docs/) (free) — required for the `image` command
|
||||
|
||||
---
|
||||
|
||||
## Installation
|
||||
|
||||
```bash
|
||||
git clone https://git.skyjoshua.xyz/SkyJoshua/SkyBot.git
|
||||
cd SkyBot/SkyBot
|
||||
dotnet restore
|
||||
</code></pre>
|
||||
<p>
|
||||
All required NuGet packages will be installed automatically using the
|
||||
provided <code>SkyBot.csproj</code> file.
|
||||
</p>
|
||||
<h2>Configuration</h2>
|
||||
<p>Create a <code>.env</code> file in the root directory of the project with your bot token:</p>
|
||||
<pre><code>TOKEN=your-bot-token-here
|
||||
```
|
||||
|
||||
All required NuGet packages will be installed automatically using the provided `SkyBot.csproj` file.
|
||||
|
||||
---
|
||||
|
||||
## Configuration
|
||||
|
||||
Create a `.env` file in the root directory of the project:
|
||||
```
|
||||
TOKEN=your-bot-token-here
|
||||
PIXABAY_API_KEY=your-pixabay-api-key-here
|
||||
</code></pre>
|
||||
<p>Then open <code>Config.cs</code> and update the following values:</p>
|
||||
<pre><code>public static readonly long OwnerId = your-owner-id-here;
|
||||
```
|
||||
|
||||
Then open `Config.cs` and update the following values:
|
||||
```cs
|
||||
public static readonly long OwnerId = your-owner-id-here;
|
||||
public static readonly string Prefix = "your-prefix-here";
|
||||
public static readonly string SourceLink = "your-source-link-here";
|
||||
</code></pre>
|
||||
<ul>
|
||||
<li>Replace <code>your-owner-id-here</code> with your Valour user ID.</li>
|
||||
<li>Replace <code>your-prefix-here</code> with your desired command prefix (e.g. <code>s/</code>).</li>
|
||||
<li>Replace <code>your-source-link-here</code> with a link to your fork of the repository.</li>
|
||||
</ul>
|
||||
<p>Never commit your <code>.env</code> file to the repository. Ensure it is listed in your <code>.gitignore</code>.</p>
|
||||
<h2>Running the Bot</h2>
|
||||
<pre><code>dotnet run</code></pre>
|
||||
<h2>Contributing</h2>
|
||||
<p>
|
||||
Contributions are welcome. By submitting a contribution, you agree that your
|
||||
contributions will be licensed under AGPL-3.0.
|
||||
</p>
|
||||
<ol>
|
||||
<li>Fork the repository</li>
|
||||
<li>Create a feature branch</li>
|
||||
<li>Submit a pull request</li>
|
||||
</ol>
|
||||
</body>
|
||||
</html>
|
||||
```
|
||||
|
||||
- Replace `your-owner-id-here` with your Valour user ID.
|
||||
- Replace `your-prefix-here` with your desired command prefix (e.g. `s/`).
|
||||
- Replace `your-source-link-here` with a link to your fork of the repository.
|
||||
|
||||
Never commit your `.env` file to the repository. Ensure it is listed in your `.gitignore`.
|
||||
|
||||
---
|
||||
|
||||
## Running the Bot
|
||||
```bash
|
||||
dotnet run
|
||||
```
|
||||
@@ -1,6 +1,6 @@
|
||||
using System.Collections.Concurrent;
|
||||
using SkyBot.Helpers;
|
||||
using SkyBot.Models;
|
||||
using Valour.Sdk.Client;
|
||||
using Valour.Sdk.Models;
|
||||
|
||||
namespace SkyBot.Commands
|
||||
@@ -15,8 +15,13 @@ namespace SkyBot.Commands
|
||||
|
||||
public async Task Execute(CommandContext ctx)
|
||||
{
|
||||
ConcurrentDictionary<long, Channel> channelCache = ctx.ChannelCache;
|
||||
long channelId = ctx.ChannelId;
|
||||
ValourClient Client = ctx.Client;
|
||||
ConcurrentDictionary<long, Channel> channelCache = ctx.ChannelCache;
|
||||
PlanetMember Member = ctx.Member;
|
||||
Message Message = ctx.Message;
|
||||
Planet Planet = ctx.Planet;
|
||||
long channelId = ctx.ChannelId;
|
||||
string[] Args = ctx.Args;
|
||||
|
||||
if (!channelCache.TryGetValue(channelId, out var channel)) return;
|
||||
|
||||
|
||||
72
SkyBot/Commands/Dev/React.cs
Normal file
72
SkyBot/Commands/Dev/React.cs
Normal file
@@ -0,0 +1,72 @@
|
||||
using System.Collections.Concurrent;
|
||||
using SkyBot.Helpers;
|
||||
using SkyBot.Models;
|
||||
using Valour.Sdk.Models;
|
||||
using Valour.Shared.Models;
|
||||
|
||||
namespace SkyBot.Commands
|
||||
{
|
||||
public class React : ICommand
|
||||
{
|
||||
public string Name => "react";
|
||||
public string[] Aliases => [];
|
||||
public string Description => "Send a message with a reaction at a set count.";
|
||||
public string Section => "Dev";
|
||||
public string Usage => "react <emoji> <amount> <message>";
|
||||
|
||||
public async Task Execute(CommandContext ctx)
|
||||
{
|
||||
ConcurrentDictionary<long, Channel> channelCache = ctx.ChannelCache;
|
||||
long channelId = ctx.ChannelId;
|
||||
|
||||
if (!channelCache.TryGetValue(channelId, out var channel)) return;
|
||||
|
||||
if (!PermissionHelper.IsOwner(ctx.Member))
|
||||
{
|
||||
await MessageHelper.ReplyAsync(ctx, channel, "This is a Dev only command.");
|
||||
return;
|
||||
}
|
||||
|
||||
string[] args = ctx.Args;
|
||||
|
||||
if (args.Length < 3)
|
||||
{
|
||||
await MessageHelper.ReplyAsync(ctx, channel, $"Usage: `{Config.Prefix}react <emoji> <amount> <message>`");
|
||||
return;
|
||||
}
|
||||
|
||||
string emoji = args[0];
|
||||
|
||||
if (!int.TryParse(args[1], out int amount) || amount < 1)
|
||||
{
|
||||
await MessageHelper.ReplyAsync(ctx, channel, "Amount must be a number between 1 and 100.");
|
||||
return;
|
||||
}
|
||||
|
||||
string content = string.Join(" ", args.Skip(2));
|
||||
|
||||
var reactions = Enumerable.Range(0, amount)
|
||||
.Select(_ => new MessageReaction
|
||||
{
|
||||
Emoji = emoji,
|
||||
AuthorUserId = ctx.Client.Me.Id,
|
||||
AuthorMemberId = ctx.Planet.MyMember?.Id,
|
||||
CreatedAt = DateTime.UtcNow
|
||||
})
|
||||
.ToList();
|
||||
|
||||
var msg = new Message(ctx.Client)
|
||||
{
|
||||
Content = content,
|
||||
ChannelId = channelId,
|
||||
PlanetId = ctx.Planet.Id,
|
||||
AuthorUserId = ctx.Client.Me.Id,
|
||||
AuthorMemberId = ctx.Planet.MyMember?.Id,
|
||||
Reactions = reactions,
|
||||
Fingerprint = Guid.NewGuid().ToString()
|
||||
};
|
||||
|
||||
await ctx.Client.MessageService.SendMessage(msg);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -27,7 +27,7 @@ namespace SkyBot.Commands
|
||||
if (!channelCache.TryGetValue(channelId, out var channel)) return;
|
||||
|
||||
string msg = @"Here is a link to a Bot Guide that SkyJoshua has made (WIP):
|
||||
https://github.com/SkyJoshua/Valour-Bot-Guide";
|
||||
https://git.skyjoshua.xyz/SkyJoshua/Valour-Bot-Guide";
|
||||
|
||||
await MessageHelper.ReplyAsync(ctx, channel, msg);
|
||||
}
|
||||
|
||||
@@ -5,6 +5,5 @@ namespace SkyBot
|
||||
public static readonly long OwnerId = 15652354820931584;
|
||||
public static readonly string Prefix = "s/";
|
||||
public static readonly string SourceLink = "https://github.com/SkyJoshua/SkyBot";
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
using System.Globalization;
|
||||
using SkyBot.Models;
|
||||
using Valour.Sdk.Models;
|
||||
using Valour.Shared;
|
||||
@@ -10,6 +11,7 @@ namespace SkyBot.Helpers
|
||||
public static string Mention(this PlanetMember member) => $"«@m-{member.Id}»";
|
||||
public static string Mention(this User user) => $"«@u-{user.Id}»";
|
||||
public static string ToTitleCase(this string str) => System.Globalization.CultureInfo.CurrentCulture.TextInfo.ToTitleCase(str);
|
||||
|
||||
public static async Task<TaskResult<Message>> ReplyAsync(CommandContext ctx, Channel channel, string content)
|
||||
{
|
||||
long? replyToId = ctx.Message.ReplyToId.HasValue ? ctx.Message.ReplyToId : ctx.Message.Id;
|
||||
@@ -26,11 +28,13 @@ namespace SkyBot.Helpers
|
||||
};
|
||||
return await ctx.Client.MessageService.SendMessage(msg);
|
||||
}
|
||||
|
||||
public static async Task<TaskResult<Message>> EditAsync(Channel channel, Message message, string content)
|
||||
{
|
||||
message.Content = content;
|
||||
return await channel.Planet.Node.PutAsyncWithResponse<Message>($"api/messages/{message.Id}", message);
|
||||
}
|
||||
|
||||
public static DateTime? ParseDuration(string input)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(input)) return null;
|
||||
@@ -49,5 +53,19 @@ namespace SkyBot.Helpers
|
||||
_ => null
|
||||
};
|
||||
}
|
||||
|
||||
public static bool IsSingleEmoji(string input)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(input)) return false;
|
||||
|
||||
input = input.Trim();
|
||||
|
||||
var enumerator = StringInfo.GetTextElementEnumerator(input);
|
||||
int count = 0;
|
||||
|
||||
while (enumerator.MoveNext()) count++;
|
||||
|
||||
return count == 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -6,6 +6,7 @@ namespace SkyBot.Helpers
|
||||
private static readonly HttpClient _http = new HttpClient();
|
||||
private static long _valourUsercount;
|
||||
public static long ValourUsercount => _valourUsercount;
|
||||
|
||||
public static async Task UpdateUsercount()
|
||||
{
|
||||
try
|
||||
|
||||
@@ -23,16 +23,13 @@ namespace SkyBot.Services.Messages
|
||||
string prefix = Config.Prefix;
|
||||
string content = message.Content ?? "";
|
||||
if (string.IsNullOrWhiteSpace(content)) return;
|
||||
if (!content.ToLower().StartsWith(prefix)) return;
|
||||
|
||||
long channelId = message.ChannelId;
|
||||
PlanetMember member = await message.FetchAuthorMemberAsync();
|
||||
noPrefixMessages(message, content);
|
||||
var parts = content.Substring(prefix.Length).Split(' ', StringSplitOptions.RemoveEmptyEntries);
|
||||
if (parts.Length == 0) return;
|
||||
|
||||
string command = parts[0].ToLower();
|
||||
string[] args = parts[1..];
|
||||
|
||||
CommandContext ctx = new CommandContext
|
||||
{
|
||||
ChannelCache = channelCache,
|
||||
@@ -44,6 +41,21 @@ namespace SkyBot.Services.Messages
|
||||
Client = client
|
||||
};
|
||||
|
||||
async void noPrefixMessages(Message message, string content)
|
||||
{
|
||||
if (message.AuthorUserId == Config.OwnerId)
|
||||
{
|
||||
if (MessageHelper.IsSingleEmoji(content))
|
||||
{
|
||||
await message.AddReactionAsync(content);
|
||||
}
|
||||
}
|
||||
|
||||
// await message.AddReactionAsync("🫃");
|
||||
}
|
||||
|
||||
|
||||
if (!content.ToLower().StartsWith(prefix)) return;
|
||||
if (_cooldowns.TryGetValue(message.AuthorUserId, out var lastUsed) && DateTime.UtcNow - lastUsed < _cooldown)
|
||||
return;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user