Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: dkoz/palworld-palbot
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v0.3.7
Choose a base ref
...
head repository: dkoz/palworld-palbot
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: main
Choose a head ref
  • 5 commits
  • 10 files changed
  • 1 contributor

Commits on Nov 20, 2024

  1. Copy the full SHA
    b08d01c View commit details

Commits on Nov 22, 2024

  1. Update Packages

    dkoz committed Nov 22, 2024
    Copy the full SHA
    ded1ada View commit details

Commits on Nov 28, 2024

  1. Update README

    dkoz committed Nov 28, 2024
    Copy the full SHA
    83a50a6 View commit details

Commits on Dec 3, 2024

  1. Shop Checks

    dkoz committed Dec 3, 2024
    Copy the full SHA
    f6d97d2 View commit details

Commits on Dec 6, 2024

  1. Palguard Delete Pals

    dkoz committed Dec 6, 2024
    Copy the full SHA
    20feb54 View commit details
Showing with 81 additions and 19 deletions.
  1. +3 −3 README.md
  2. +8 −7 cogs/economy/core.py
  3. +4 −4 cogs/economy/shop.py
  4. +32 −0 cogs/palguard.py
  5. +1 −0 docker-compose.yml
  6. +8 −1 i18n/br.json
  7. +8 −1 i18n/de.json
  8. +8 −1 i18n/en.json
  9. +8 −1 i18n/es.json
  10. +1 −1 requirements.txt
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -8,9 +8,6 @@

Support the development on [Patreon](https://www.patreon.com/palbotinn) and visit our [Website](https://palbot.gg).

> [!IMPORTANT]
> Due to personal reasons, I won't be able to keep maintaining the bot for much longer. I'll still fix any bugs that pop up, but I won’t be adding new features or continuing work on Pal Game for the time being.
## Features:
- **Server Management:** Easily add, edit, and delete servers directly through the bot, enabling RCON, server queries, and other functionalities to operate smoothly.
- **RCON Integration:** Seamlessly control your server using RCON commands.
@@ -24,6 +21,9 @@
- **Kits**: Effortlessly distribute custom kits with items, pals, and eggs to players across your Palworld servers.
- **Steam API Integration**: Seamlessly integrate with the Steam API to fetch player profiles and enhance server management with detailed user insights.
- **Localization Support**: Translate your server's features and messages into multiple languages, allowing players to enjoy a localized experience. This feature supports community-contributed translations, ensuring that the language used is both accurate and culturally relevant.
- **Discord Admninistration**: Manage your discord server directly from the bot.
- **Admin Commands**: Effortlessly manage members with commands like kick, ban, timeout, and more.
- **Ticket System**: Create a customized thread based ticket system with ease.

## Installation:
Please check our [wiki](https://github.com/dkoz/palworld-bot/wiki) for all guides related to the bot.
15 changes: 8 additions & 7 deletions cogs/economy/core.py
Original file line number Diff line number Diff line change
@@ -25,33 +25,34 @@
class EconomyCog(commands.Cog):
def __init__(self, bot):
self.bot = bot
self.bot.loop.create_task(init_db())
self.bot.loop.create_task(self.load_config())
self.bot.loop.create_task(self.initialize())
self.refresh_settings.start()
self.clear_old_cooldowns.start()
self.work_cooldown = {}
self.daily_cooldown = {}
self.economy_config = {}

async def initialize(self):
await init_db()
await self.load_config()

async def load_config(self):
self.currency = await get_economy_setting("currency_name") or "points"
self.work_timer = int(await get_economy_setting("work_timer") or 60)
self.daily_timer = int(await get_economy_setting("daily_timer") or 86400)
work_reward_min = await get_economy_setting("work_reward_min") or "1"
work_reward_max = await get_economy_setting("work_reward_max") or "10"
self.work_min = int(work_reward_min)
self.work_max = int(work_reward_max)
work_descriptions_str = await get_economy_setting("work_description") or '["You worked and earned {earned_points} {currency}."]'
self.work_descriptions = json.loads(work_descriptions_str)
self.work_timer = int(await get_economy_setting("work_timer") or 60)
self.daily_reward = int(await get_economy_setting("daily_reward") or 100)
self.daily_timer = int(await get_economy_setting("daily_timer") or 86400)
role_bonuses_str = await get_economy_setting("role_bonuses") or '{"Server Booster": 10, "Supporter": 5}'
self.economy_config["role_bonuses"] = json.loads(role_bonuses_str)

# Need to reload the settings because of memory caching

@tasks.loop(minutes=1)
async def refresh_settings(self):
await self.load_config()
# print("Refreshed economy settings.")

@tasks.loop(hours=1)
async def clear_old_cooldowns(self):
8 changes: 4 additions & 4 deletions cogs/economy/shop.py
Original file line number Diff line number Diff line change
@@ -192,13 +192,13 @@ async def purchase_item(self, interaction: nextcord.Interaction, item_name: str,
try:
response = await self.rcon_util.rcon_command(server_info, command)

if "Failed to parse UID" in response:
if "Failed to parse UID" in response or "Failed to find player by UID/SteamID" in response:
await set_points(user_id, user_name, points)
await interaction.followup.send(
t("ShopCog", "shop.redeem.error_user_not_found").format(user_name=user_name),
ephemeral=True
)
logging.error(f"Failed to parse UID for user {user_name} (ID: {user_id}) while purchasing {item_name}. Points refunded.")
logging.error(f"Failed to find player {user_name} (ID: {user_id}) while purchasing {item_name}. Points refunded.")
return

await asyncio.sleep(1)
@@ -274,13 +274,13 @@ async def redeem(
try:
response = await self.rcon_util.rcon_command(server_info, command)

if "Failed to parse UID" in response:
if "Failed to parse UID" in response or "Failed to find player by UID/SteamID" in response:
await set_points(user_id, user_name, points)
await interaction.followup.send(
t("ShopCog", "shop.redeem.error_user_not_found").format(user_name=user_name),
ephemeral=True
)
logging.error(f"Failed to parse UID for user {user_name} (ID: {user_id}) while redeeming {item_name}. Points refunded.")
logging.error(f"Failed to find player {user_name} (ID: {user_id}) while redeeming {item_name}. Points refunded.")
return

await asyncio.sleep(1)
32 changes: 32 additions & 0 deletions cogs/palguard.py
Original file line number Diff line number Diff line change
@@ -392,6 +392,38 @@ async def on_autocomplete_rcon(
):
await self.autocomplete_server(interaction, current)

@palguard.subcommand(description=t("PalguardCog", "deletepals.description"))
@restrict_command()
async def deletepals(
self,
interaction: nextcord.Interaction,
steamid: str = nextcord.SlashOption(description=t("PalguardCog", "description.userid")),
palfilter: str = nextcord.SlashOption(description=t("PalguardCog", "description.palfilter")),
server: str = nextcord.SlashOption(
description=t("PalguardCog", "description.server"), autocomplete=True
),
):
await interaction.response.defer(ephemeral=True)
server_info = await self.get_server_info(server)
if not server_info:
await interaction.followup.send(
t("PalguardCog", "deletepals.server_not_found").format(server=server), ephemeral=True
)
return
response = await self.rcon_util.rcon_command(server_info, f"deletepals {steamid} {palfilter}")
embed = nextcord.Embed(
title=t("PalguardCog", "deletepals.title").format(server=server),
description=t("PalguardCog", "deletepals.response").format(response=response),
color=nextcord.Color.blurple()
)
await interaction.followup.send(embed=embed)

@deletepals.on_autocomplete("server")
async def on_autocomplete_rcon(
self, interaction: nextcord.Interaction, current: str
):
await self.autocomplete_server(interaction, current)

# Palguard Whitelist Functions
@nextcord.slash_command(
name="whitelist",
1 change: 1 addition & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -4,6 +4,7 @@ services:
build: .
volumes:
- ./data:/app/data
- ./logs:/app/logs
env_file:
- .env
restart: unless-stopped
9 changes: 8 additions & 1 deletion i18n/br.json
Original file line number Diff line number Diff line change
@@ -295,7 +295,8 @@
"itemid": "Selecione um item para dar.",
"palid": "Selecione um Pal para dar.",
"level": "Nível do Pal.",
"eggid": "Selecione um ovo para dar."
"eggid": "Selecione um ovo para dar.",
"palfilter": "Filtrar palavras-chave para exclusão de Pals."
},
"reloadcfg": {
"description": "Recarregar a configuração do servidor.",
@@ -309,6 +310,12 @@
"response": "Dando {palid} a {steamid}.\nPalcon: {response}",
"title": "Palguard Pal - {server}"
},
"deletepals": {
"description": "Excluir Pals de um jogador.",
"server_not_found": "Servidor {server} não encontrado.",
"response": "Palcon: {response}",
"title": "Palguard Pals - {server}"
},
"giveitem": {
"description": "Dar um item a um jogador.",
"server_not_found": "Servidor {server} não encontrado.",
9 changes: 8 additions & 1 deletion i18n/de.json
Original file line number Diff line number Diff line change
@@ -295,7 +295,8 @@
"itemid": "Wählen Sie einen Gegenstand zum Geben.",
"palid": "Wählen Sie einen Pal zum Geben.",
"level": "Level des Pals.",
"eggid": "Wählen Sie ein Ei zum Geben."
"eggid": "Wählen Sie ein Ei zum Geben.",
"palfilter": "Schlüsselwörter für die Pal-Löschung filtern."
},
"reloadcfg": {
"description": "Server-Konfiguration neu laden.",
@@ -309,6 +310,12 @@
"response": "Geben von {palid} an {steamid}.\nPalcon: {response}",
"title": "Palguard Pal - {server}"
},
"deletepals": {
"description": "Lösche Pals bei einem Spieler.",
"server_not_found": "Server {server} nicht gefunden.",
"response": "Palcon: {response}",
"title": "Palguard Pal - {server}"
},
"giveitem": {
"description": "Gib einem Spieler einen Gegenstand.",
"server_not_found": "Server {server} nicht gefunden.",
9 changes: 8 additions & 1 deletion i18n/en.json
Original file line number Diff line number Diff line change
@@ -295,7 +295,8 @@
"itemid": "Select an item to give.",
"palid": "Select a Pal to give.",
"level": "Level of the Pal.",
"eggid": "Select an egg to give."
"eggid": "Select an egg to give.",
"palfilter": "Filter keywords for Pal deletion."
},
"reloadcfg": {
"description": "Reload server configuration.",
@@ -309,6 +310,12 @@
"response": "Giving {palid} to {steamid}.\nPalcon: {response}",
"title": "Palguard Pal - {server}"
},
"deletepals": {
"description": "Delete Pals from a player.",
"server_not_found": "Server {server} not found.",
"response": "Palcon: {response}",
"title": "Palguard Pal - {server}"
},
"giveitem": {
"description": "Give an item to a player.",
"server_not_found": "Server {server} not found.",
9 changes: 8 additions & 1 deletion i18n/es.json
Original file line number Diff line number Diff line change
@@ -295,7 +295,8 @@
"itemid": "Selecciona un objeto para dar.",
"palid": "Selecciona un Pal para dar.",
"level": "Nivel del Pal.",
"eggid": "Selecciona un huevo para dar."
"eggid": "Selecciona un huevo para dar.",
"palfilter": "Filtrar palabras clave para la eliminación de Pals."
},
"reloadcfg": {
"description": "Recargar la configuración del servidor.",
@@ -309,6 +310,12 @@
"response": "Dando {palid} a {steamid}.\nPalcon: {response}",
"title": "Palguard Pal - {server}"
},
"deletepals": {
"description": "Eliminar Pals de un jugador.",
"server_not_found": "Servidor {server} no encontrado.",
"response": "Palcon: {response}",
"title": "Palguard Eliminar Pals - {server}"
},
"giveitem": {
"description": "Dar un objeto a un jugador.",
"server_not_found": "Servidor {server} no encontrado.",
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
nextcord==2.6.0
python-dotenv==1.0.1
gamercon-async==1.0.7
aiohttp==3.10.10
aiohttp==3.10.11
aiosqlite==0.20.0
pytz==2024.2
steam==1.4.4