modified: app.py

modified:   bot.py
	modified:   templates/server_settings.html
This commit is contained in:
SimolZimol
2026-06-15 21:10:09 +02:00
parent 99a04b9a6b
commit d0a3954f0a
3 changed files with 400 additions and 18 deletions

View File

@@ -350,6 +350,110 @@
</div>
</div>
<!-- Honeypot Settings -->
<div class="settings-section">
<h3 class="section-title">
<i class="fas fa-spider section-icon"></i>
Honeypot System
</h3>
<div class="info-card">
<div class="info-card-title">
<i class="fas fa-info-circle"></i>
What is a Honeypot?
</div>
<p class="info-card-text">
A honeypot channel is a hidden channel that attracts bots and spam accounts.
Any user who writes there will be automatically banned — or if old account protection
is enabled, muted for 1 year.
</p>
</div>
<div class="form-check">
<input class="form-check-input" type="checkbox" id="honeypot_enabled"
name="honeypot_enabled" {% if settings.honeypot_enabled %}checked{% endif %}>
<label class="form-check-label" for="honeypot_enabled">
Enable Honeypot System
</label>
<small class="help-text d-block">Enables automatic detection in the honeypot channel</small>
</div>
<div class="row mt-3">
<div class="col-md-6">
<div class="form-group">
<label for="honeypot_channel_id">Honeypot Channel ID</label>
<input type="text" class="form-control" id="honeypot_channel_id"
name="honeypot_channel_id"
value="{{ settings.honeypot_channel_id or '' }}"
placeholder="e.g. 123456789012345678">
<small class="help-text">Channel where messages trigger a ban</small>
</div>
</div>
<div class="col-md-6">
<div class="form-group">
<label for="honeypot_log_channel_id">Honeypot Log Channel ID</label>
<input type="text" class="form-control" id="honeypot_log_channel_id"
name="honeypot_log_channel_id"
value="{{ settings.honeypot_log_channel_id or '' }}"
placeholder="e.g. 123456789012345678">
<small class="help-text">Channel for honeypot logs (empty = disabled)</small>
</div>
</div>
</div>
<div class="form-check">
<input class="form-check-input" type="checkbox" id="honeypot_preserve_old_accounts"
name="honeypot_preserve_old_accounts"
{% if settings.honeypot_preserve_old_accounts %}checked{% endif %}>
<label class="form-check-label" for="honeypot_preserve_old_accounts">
Enable Old Account Protection
</label>
<small class="help-text d-block">
Users who have been on the server longer than the minimum age will not be banned,
but only muted for 1 year (for possibly hacked accounts)
</small>
</div>
<div class="row mt-3">
<div class="col-md-6">
<div class="form-group">
<label for="honeypot_acc_age_min">Minimum Server Age (Days)</label>
<input type="number" class="form-control" id="honeypot_acc_age_min"
name="honeypot_acc_age_min"
value="{{ settings.honeypot_acc_age_min or 30 }}" min="1">
<small class="help-text">
Users must be on the server for at least this many days
to be considered an "old account"
</small>
</div>
</div>
<div class="col-md-6">
<div class="form-group">
<label for="honeypot_get_role">Mute Role ID (Old Accounts)</label>
<input type="text" class="form-control" id="honeypot_get_role"
name="honeypot_get_role"
value="{{ settings.honeypot_get_role or '' }}"
placeholder="e.g. 123456789012345678">
<small class="help-text">
Role for muted old accounts. Empty = use normal mute role
</small>
</div>
</div>
</div>
<div class="form-group">
<label for="honeypot_ignore_roles">Ignored Roles (Mod Roles, etc.)</label>
<input type="text" class="form-control" id="honeypot_ignore_roles"
name="honeypot_ignore_roles"
value="{{ settings.honeypot_ignore_roles | from_json_ids if settings.honeypot_ignore_roles else '' }}"
placeholder="e.g. 111222333444 555666777888">
<small class="help-text">
Space- or comma-separated role IDs that are exempt from honeypot
(e.g., mod roles)
</small>
</div>
</div>
<!-- Action Buttons -->
<div class="text-center">
<button type="submit" class="btn btn-primary mr-3">
@@ -371,6 +475,10 @@
const muteRoleId = document.getElementById('mute_role_id').value;
const logChannelId = document.getElementById('log_channel_id').value;
const muteDuration = document.getElementById('auto_mute_duration').value;
const honeypotChannelId = document.getElementById('honeypot_channel_id').value;
const honeypotLogChannelId = document.getElementById('honeypot_log_channel_id').value;
const honeypotGetRole = document.getElementById('honeypot_get_role').value;
const honeypotAccAgeMin = document.getElementById('honeypot_acc_age_min').value;
// Validate role ID format (if provided)
if (muteRoleId && !/^\d{17,19}$/.test(muteRoleId)) {
@@ -392,6 +500,27 @@
e.preventDefault();
return;
}
// Honeypot validations
if (honeypotChannelId && !/^\d{17,19}$/.test(honeypotChannelId)) {
alert('Honeypot channel ID must be a 1719 digit number');
e.preventDefault();
return;
}
if (honeypotLogChannelId && !/^\d{17,19}$/.test(honeypotLogChannelId)) {
alert('Honeypot log channel ID must be a 1719 digit number');
e.preventDefault();
return;
}
if (honeypotGetRole && !/^\d{17,19}$/.test(honeypotGetRole)) {
alert('Mute role ID must be a 1719 digit number');
e.preventDefault();
return;
}
if (honeypotAccAgeMin && (isNaN(honeypotAccAgeMin) || parseInt(honeypotAccAgeMin) < 1)) {
alert('Minimum account age must be at least 1 day');
e.preventDefault();
return;
}
});
</script>
</body>