Skip to content

Commit 15ba369

Browse files
committed
Merge branch 'rewrite' of https://github.com/nyxx-discord/running_on_dart into rewrite
2 parents 8044672 + d3e209c commit 15ba369

File tree

11 files changed

+28
-21
lines changed

11 files changed

+28
-21
lines changed

.dockerignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,3 +21,5 @@ build/
2121
lib_old/
2222

2323
**/node_modules/**
24+
25+
.roo/**

.env.example

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,9 @@
11
# Core bot configuration
22
ROD_TOKEN=YOUR_DISCORD_BOT_TOKEN_HERE
33
ROD_PREFIX=n>>
4-
ROD_ADMIN_ID=YOUR_ADMIN_USER_ID
54
ROD_ADMIN_IDS=SPACE_SEPARATED_ADMIN_USER_IDS
65
ROD_INTENT_FEATURES_ENABLE=true
76
BOT_NAME=Running on Dart
8-
SYNC_COMMANDS=true
9-
ROD_DEBUG=0
107
ROD_DEV=0
118
ROD_DEV_GUILD_ID=YOUR_DEV_GUILD_ID
129
ROD_ADMIN_GUILD=YOUR_ADMIN_GUILD_ID
@@ -22,6 +19,7 @@ POSTGRES_PASSWORD=CHANGE_ME
2219
WEB_SERVER_ENABLE=0
2320
WEB_SERVER_PORT=8088
2421
WEB_SERVER_HOST=0.0.0.0
22+
WEB_SERVER_ALLOWED_ORIGIN=https://localhost:8088
2523
DISCORD_CLIENT_ID=YOUR_DISCORD_OAUTH_CLIENT_ID
2624
DISCORD_CLIENT_SECRET=YOUR_DISCORD_OAUTH_CLIENT_SECRET
2725
DISCORD_REDIRECT_URI=https://localhost:8088/redirect

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,3 +26,5 @@ sessions/
2626

2727
public/
2828
!public/.gitkeep
29+
30+
.roo/**

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
## 4.17.0
2+
- New `poop user` command
3+
- Improved SQL query for searching active tags
4+
- Extended list of bad characters for "poop" feature
5+
- Various test improvements
6+
17
## 4.16.1
28
- Improve pooping command
39

README.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,6 @@ Core bot settings
1111
- `ROD_PREFIX` (optional, default `n>>`): The prefix to use for text commands.
1212
- `ROD_INTENT_FEATURES_ENABLE`: A bool (`true` or `false`) indicating whether to enable features requiring privileged intents, namely `GUILD_MESSAGES` and `GUILD_MEMBERS`.
1313
- `ROD_ADMIN_IDS`: The space-separated IDs (snowflakes) of the users that can use administrator commands.
14-
- `ROD_ADMIN_ID` (optional): Single administrator user ID (snowflake). Use `ROD_ADMIN_IDS` to provide multiple admins.
15-
- `SYNC_COMMANDS` (optional, default `true`): Whether to sync application commands on startup.
16-
- `ROD_DEBUG` (optional, default `0`): Enable extra debug logging (`1`/`0` or `true`/`false`).
1714
- `ROD_DEV` (optional, default `false`): A bool indicating whether to run in development mode.
1815
- `BOT_NAME` (optional, default `Nataly`): Displayed bot name in some contexts.
1916

@@ -36,6 +33,7 @@ Web server
3633
- `WEB_SERVER_ENABLE` (optional, default `0`): Enable the built-in web server (`1`/`0`).
3734
- `WEB_SERVER_HOST` (optional, default `0.0.0.0`): Host/interface to bind the web server to.
3835
- `WEB_SERVER_PORT` (optional, default `8088`): Port for the web server.
36+
- `WEB_SERVER_ALLOWED_ORIGIN` (optional, default `https://localhost:8088`): Allowed origins for CORS headers.
3937
- `DISCORD_CLIENT_ID` (optional): Discord OAuth2 application client ID.
4038
- `DISCORD_CLIENT_SECRET` (optional): Discord OAuth2 application client secret.
4139
- `DISCORD_REDIRECT_URI` (optional, default `https://localhost:8088/redirect`): OAuth2 redirect URI.

docker-compose.prod.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
version: '3.9'
22
services:
33
running_on_dart:
4-
image: ghcr.io/nyxx-discord/running_on_dart:4.16.1
4+
image: ghcr.io/nyxx-discord/running_on_dart:4.17.0
55
container_name: running_on_dart
66
restart: unless-stopped
77
ports:

lib/src/cli.dart

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,14 @@ import 'package:running_on_dart/src/settings.dart';
22
import 'package:running_on_dart/src/web_app/jwt.dart';
33

44
bool handleCli(List<String> args) {
5-
if (args.isNotEmpty && dev) {
6-
final commandArg = args.first;
7-
if (commandArg == 'generate-test-jwt') {
8-
print(generateJwt('1300543841996374131', maxAge: Duration(days: 31), permissions: []));
9-
return true;
10-
}
5+
if (args.isEmpty || !dev) {
6+
return false;
117
}
128

13-
return false;
9+
final commandArg = args.first;
10+
if (commandArg == 'generate-test-jwt') {
11+
print(generateJwt('1300543841996374131', maxAge: Duration(days: 31), permissions: []));
12+
}
13+
14+
return true;
1415
}

lib/src/commands/admin.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,9 @@ final poopUserCommand = UserCommand("poop-username", (UserContext context) async
2727

2828
final poopModule = Injector.appInstance.get<PoopNameModule>();
2929

30-
await poopModule.poopMember(member, dryRun: false);
30+
final result = await poopModule.poopMember(member, dryRun: false);
3131

32-
await context.respond(MessageBuilder(content: "Done..."), level: ResponseLevel.private);
32+
await context.respond(MessageBuilder(content: result ? 'Done...' : 'Not needed...'), level: ResponseLevel.private);
3333
}, checks: [GuildCheck.all(), PermissionsCheck(Permissions.manageNicknames)]);
3434

3535
final admin = ChatGroup(

lib/src/repository/tag.dart

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -83,15 +83,15 @@ FROM (
8383
(similarity(name, @q) * 5.0 + similarity(content, @q) * 1.0) AS score
8484
FROM tags
8585
WHERE enabled = TRUE
86-
AND (@authorId::text IS NULL OR author_id::text = @authorId)
87-
AND (@guildId::text IS NULL OR guild_id::text = @guildId)
86+
AND (author_id = @authorId OR @authorId IS NULL)
87+
AND (guild_id = @guildId OR @guildId IS NULL)
8888
AND (
8989
name ILIKE '%' || @q || '%'
9090
OR content ILIKE '%' || @q || '%'
9191
OR name % @q
9292
OR content % @q
9393
)
94-
) s
94+
) AS scored_tags
9595
WHERE score >= @simThresh
9696
ORDER BY score DESC, name ASC
9797
LIMIT @limit OFFSET @offset

lib/src/settings.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import 'dart:io';
22

33
import 'package:nyxx/nyxx.dart';
44

5-
String get version => '4.16.1';
5+
String get version => '4.17.0';
66
String get frontendVersion => '1.0.0';
77

88
/// Get a [String] from an environment variable, throwing an exception if it is not set.

0 commit comments

Comments
 (0)