Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/develop' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
jhqwqmc committed Nov 5, 2024
2 parents 2d3d133 + 6a4324d commit feafdff
Show file tree
Hide file tree
Showing 30 changed files with 3,760 additions and 2,640 deletions.
17 changes: 17 additions & 0 deletions .github/ISSUE_TEMPLATE/discord.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: Questions via discord
description: Please ask your questions in our Discord.
title: "Questions via Discord!"
labels: [question]

body:
- type: checkboxes
id: i-have-checked
attributes:
label: I
options:
- label: "Stopped typing this issue and am going to the discord."
required: true
- type: markdown
attributes:
value: |
[Join our Discord](https://discord.gg/gs5QYhfv9x)
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,7 @@ Typewriter是一个适用于 Paper Minecraft 服务器的插件,它允许你
### 示例

以下是Typewriter的几个示例:

[https://github.com/user-attachments/assets/b5c7ecb7-557b-41ac-ba7b-82c6a46b79a8](https://github.com/user-attachments/assets/b5c7ecb7-557b-41ac-ba7b-82c6a46b79a8)
<video src="https://github.com/user-attachments/assets/b5c7ecb7-557b-41ac-ba7b-82c6a46b79a8" width="55%" height="auto" controls>您的浏览器不支持视频标签或该视频不再存在。 <a href="https://github.com/user-attachments/assets/b5c7ecb7-557b-41ac-ba7b-82c6a46b79a8">点击此处观看视频</a></video>

展示了Typewriter提供的几乎所有功能的完整演示。

Expand Down
23 changes: 23 additions & 0 deletions discord_bot/ai/intake_examples/a_walking_npc.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<user>
# A walking NPC
</user>
<user>
Add NPCs to version 0.7 that will do something to the player if they see him
</user>
<assistant>
To help support staff assist you effectively, please provide the following information:

- **Functionality**: What do you mean by: `Do something to the player if they see him`.
- **Benefits**: How would this feature enhance gameplay for users?
- **Use Cases**: Can you describe at least one scenario where this feature would be utilized?

Providing the above information is **mandatory** for the ticket to be answered and looked at by the support team.
</assistant>
<user>
1. I mean like that that when the npc sees the player like close look it triggers an entry.
2. Add the ability for players to create guards, more functional NPCs, and more lively ones
3. A man needs to enter a building without getting seen by the npc's.
</user>
<tool_call>
complete_intake({"provided_inquiry": true})
</tool_call>
32 changes: 32 additions & 0 deletions discord_bot/ai/intake_examples/apex_host_support.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<user>
# Typewriter - Apex Host Support?
</user>
<user>
Hello it's been a while that I have created this support: https://discord.com/channels/1054708062520360960/1208744946002165792 it was around February right? then my last reponse was April 20, 2024;

Now as I can see here it says in Beta and In Production, does it mean that it now support ApexHosting and this plugin will work?
</user>
<assistant>
To assist you effectively, please provide the following information:

- **Opening ports** Are you able to open 2 additional ports on Apex Hosting?

Providing the above information is **mandatory** for the ticket to be answered and looked at by the support team.
</assistant>
<user>
I have no idea what that means, I'm not a developer, I just want to use it
</user>
<assistant>
Typewriter needs 2 fresh network ports to work.
Some hosting providers allow you to open additional ports, but others do not.

Network ports are essentially identifiers for processes in Typewriter.

Are you able to open 2 additional ports on Apex Hosting?
</assistant>
<user>
No, I can't open any more ports
</user>
<tool_call>
complete_intake({"provided_inquiry": true})
</tool_call>
21 changes: 21 additions & 0 deletions discord_bot/ai/intake_examples/ender_dragon_entity.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<user>
# Add Ender Dragon
</user>
<user>
Please add the ender dragon entity.
</user>
<assistant>
To help support staff assist you effectively, please provide the following information:

- **Did you check?** Has the Ender Dragon entity not already been added to the entity extension?
- **Does this have priority?** Should we add the addition of this entity to our priority list?

Providing the above information is **mandatory** for the ticket to be answered and looked at by the support team.
</assistant>
<user>
1. Yes this entity hasn't been added to the entity extension
2. No take your time./Yes i would like to have this get added as soon as possible.
</user>
<tool_call>
complete_intake({"provided_inquiry": true})
</tool_call>
21 changes: 21 additions & 0 deletions discord_bot/ai/intake_examples/wolf_entity.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<user>
# Wolf Entity
</user>
<user>
I tried to find wolf definition, but couldn't find it. Did I miss it, or hasn't been added yet?
</user>
<assistant>
To help support staff assist you effectively, please provide the following information:

- **Did you check?** Has the wolf entity not already been added to the entity extension?
- **Does this have priority?** Should we add the addition of this entity to our priority list?

Providing the above information is **mandatory** for the ticket to be answered and looked at by the support team.
</assistant>
<user>
Yeah I couldn't find it.
Yes please add this as fast as possible.
</user>
<tool_call>
complete_intake({"provided_inquiry": true})
</tool_call>
18 changes: 12 additions & 6 deletions discord_bot/src/discord/thread_cleanup.rs
Original file line number Diff line number Diff line change
Expand Up @@ -165,9 +165,12 @@ async fn resolve_intake_thread(
let now = Timestamp::now();
let duration = now.timestamp() - last_message_date.timestamp();

// If the duration is between 12 and 13 hours, we want to send the owner a reminder in dms.
if duration > Duration::hours(12).num_seconds() && duration < Duration::hours(13).num_seconds()
{
let hours = [3, 12, 22];
// If the intake is not completed, we want to send the owner a reminder in dms.
if hours.iter().any(|h| {
duration > Duration::hours(*h).num_seconds()
&& duration < Duration::hours(h + 1).num_seconds()
}) {
let owner_id = thread.owner_id.ok_or(WinstonError::NotAThreadChannel)?;

let dms = owner_id.create_dm_channel(&discord).await?;
Expand All @@ -191,9 +194,12 @@ async fn resolve_intake_thread(
,

)
.await {
eprintln!("Failed to send message: {}", e);
}
.await
{
eprintln!("Failed to send message: {}", e);
} else {
println!("Sent reminder message to {}", owner_id.mention());
}
}

if duration < Duration::days(1).num_seconds() {
Expand Down
5 changes: 3 additions & 2 deletions discord_bot/src/discord/thread_intake.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ use serde_json::json;
use std::{fs, path::Path};

use crate::{
check_is_support, webhooks::GetTagId, WinstonError, QUESTIONS_FORUM_ID, SUPPORT_ROLE_ID,
check_is_contributer, check_is_support, webhooks::GetTagId, WinstonError, QUESTIONS_FORUM_ID,
SUPPORT_ROLE_ID,
};

pub struct ThreadIntakeHandler;
Expand Down Expand Up @@ -445,7 +446,7 @@ fn ai_message(message: &Message) -> Result<ChatCompletionRequestMessage, OpenAIE
}
}

#[poise::command(slash_command, ephemeral, check = "check_is_support")]
#[poise::command(slash_command, ephemeral, check = "check_is_contributer")]
pub async fn complete_intake(ctx: crate::Context<'_>) -> Result<(), WinstonError> {
let handle = ctx
.send(CreateReply::default().content("Manually Completing Intake"))
Expand Down
25 changes: 18 additions & 7 deletions discord_bot/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use std::sync::Arc;

use actix_web::{middleware::Logger, App, HttpServer};
use once_cell::sync::Lazy;
use poise::serenity_prelude::{self as serenity, GatewayIntents};
use poise::serenity_prelude::{self as serenity, GatewayIntents, Mentionable};
use tokio::signal;
use tokio_util::sync::CancellationToken;

Expand All @@ -26,6 +26,7 @@ pub type ApplicationContext<'a> = poise::ApplicationContext<'a, Data, WinstonErr

const GUILD_ID: serenity::GuildId = serenity::GuildId::new(1054708062520360960);
const SUPPORT_ROLE_ID: serenity::RoleId = serenity::RoleId::new(1288764206191218711);
const CONTRIBUTE_ROLE_ID: serenity::RoleId = serenity::RoleId::new(1054708457535713350);
const QUESTIONS_FORUM_ID: u64 = 1199700329948782613;
const QUESTIONS_CHANNEL: serenity::ChannelId = serenity::ChannelId::new(QUESTIONS_FORUM_ID);

Expand Down Expand Up @@ -200,16 +201,26 @@ async fn on_error(error: poise::FrameworkError<'_, Data, WinstonError>) {
}
}
}

pub async fn check_is_support(ctx: Context<'_>) -> Result<bool, WinstonError> {
let has_role = ctx
.author()
.has_role(ctx, GUILD_ID, SUPPORT_ROLE_ID)
.await?;
check_has_role(ctx, SUPPORT_ROLE_ID).await
}

pub async fn check_is_contributer(ctx: Context<'_>) -> Result<bool, WinstonError> {
check_has_role(ctx, CONTRIBUTE_ROLE_ID).await
}

pub async fn check_has_role(
ctx: Context<'_>,
role_id: serenity::RoleId,
) -> Result<bool, WinstonError> {
let has_role = ctx.author().has_role(ctx, GUILD_ID, role_id).await?;

if !has_role {
eprintln!(
"User {} is not a support and tried to run command",
ctx.author().name
"User {} is not a {} and tried to run command",
ctx.author().name,
role_id.mention(),
);
return Ok(false);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,14 @@ When updating the plugin, it's crucial to **always** install the corresponding e

## Configuring the Web Panel

:::caution[External server providers]
Typewriter's web panel does **not** support external server providers such as Minehut, Aternos, or Apex. You can still use everything else in TypeWriter. It is still possible to use the panel still by setting up a local server with Typewriter installed. For more information, please create a question in our [Discord](https://discord.gg/HtbKyuDDBw).
:::caution[External Server Providers]
Typewriter's web panel is **not compatible** with some external server providers, including **Minehut**, **Aternos**, and **Apex**. These providers typically don’t support multiple ports, though their support team may be able to open additional ports upon request.

If this isn't possible, you can still use all other features in Typewriter or consider setting up a local server with Typewriter installed.

For further assistance, feel free to reach out with questions on our [Discord](https://discord.gg/HtbKyuDDBw).
:::

:::info[Resource consumption]
Please note that the web panel and web socket use precious resources on your server, and it is best to host the panel on your development server instead of on a production server.
:::
Expand Down
7 changes: 5 additions & 2 deletions documentation/docusaurus.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ const darkTheme = themes.vsDark;
/** @type {import('@docusaurus/types').Config} */
const config = {
title: 'Typewriter',
tagline: 'The next generation of Minecraft Questing',
tagline: 'The next generation of Player Interactions',
favicon: 'img/favicon.ico',

// Set the production url of your site here
Expand Down Expand Up @@ -233,7 +233,10 @@ const config = {
require.resolve("./plugins/tailwind/index.js"),
require.resolve("./plugins/compression/index.js"),
require.resolve("./plugins/code-snippets/index.js"),
]
],
future: {
experimental_faster: true,
},
};

export default config;
Loading

0 comments on commit feafdff

Please sign in to comment.