Skip to content

armgit / avibe

Public Imported from GitHub
0

Make your computer a home for your AI partner. Avibe is the local-first Agent OS: Vibey, its built-in AI partner, works out of the box, and Claude Code, Codex & OpenCode run unchanged beside it — reach them from your browser, phone, or any chat app.

fix(discord): tighten interactions and updates

yh ca3f7bca0f44c
diff --git a/config/v2_config.py b/config/v2_config.py
index 3289ed85a..61ef45c69 100644
--- a/config/v2_config.py
+++ b/config/v2_config.py
@@ -161,7 +161,7 @@ class V2Config:
slack = SlackConfig(**_filter_dataclass_fields(SlackConfig, slack_payload))
slack.validate()
- discord_payload = payload.get("discord") or None
+ discord_payload = payload.get("discord")
if discord_payload is not None and not isinstance(discord_payload, dict):
raise ValueError("Config 'discord' must be an object")
discord = None
diff --git a/core/update_checker.py b/core/update_checker.py
index 5078046bf..5c43eace5 100644
--- a/core/update_checker.py
+++ b/core/update_checker.py
@@ -442,14 +442,21 @@ class UpdateChecker:
channels = getattr(store, "settings", None)
if not channels or not hasattr(channels, "channels"):
return None
+ platform = getattr(self.controller.config, "platform", "slack")
for channel_id, settings in channels.channels.items():
if getattr(settings, "enabled", False):
+ if platform == "discord" and not str(channel_id).isdigit():
+ continue
return str(channel_id)
return None
async def handle_update_button_click(self, context: MessageContext, target_version: Optional[str] = None) -> None:
"""Handle update button click for Discord (non-Slack)."""
im_client = self.controller.im_client
+ message_id = context.message_id
+ if not message_id:
+ await im_client.send_message(context, "Update action unavailable for this message.")
+ return
if self._upgrade_lock.locked():
await im_client.edit_message(
context,
@@ -460,34 +467,25 @@ class UpdateChecker:
if not target_version:
version_info = await self._get_version_info_async()
+ if version_info.get("error"):
+ await im_client.edit_message(context, message_id, text="Update check failed. Please try again later.")
+ return
if not version_info.get("has_update"):
- await im_client.edit_message(context, context.message_id, text="Already up to date.")
+ await im_client.edit_message(context, message_id, text="Already up to date.")
return
target_version = version_info.get("latest")
if not target_version:
await im_client.edit_message(
- context,
- context.message_id,
- text="Update information unavailable. Please try again later.",
+ context, message_id, text="Update information unavailable. Please try again later."
)
return
- await im_client.edit_message(context, context.message_id, text="Updating Vibe Remote...")
- result = await self._perform_update(
- target_version, channel_id=context.channel_id, message_id=context.message_id
- )
+ await im_client.edit_message(context, message_id, text="Updating Vibe Remote...")
+ result = await self._perform_update(target_version, channel_id=context.channel_id, message_id=message_id)
if not result.get("ok"):
- await im_client.edit_message(
- context,
- context.message_id,
- text="Upgrade failed. Please check logs.",
- )
+ await im_client.edit_message(context, message_id, text="Upgrade failed. Please check logs.")
elif not result.get("restarting"):
- await im_client.edit_message(
- context,
- context.message_id,
- text="Upgrade complete. Please restart Vibe Remote.",
- )
+ await im_client.edit_message(context, message_id, text="Upgrade complete. Please restart Vibe Remote.")
async def _perform_update(
self, target_version: str, channel_id: Optional[str] = None, message_id: Optional[str] = None
diff --git a/modules/im/discord.py b/modules/im/discord.py
index 4ced66ac8..c1f593279 100644
--- a/modules/im/discord.py
+++ b/modules/im/discord.py
@@ -323,7 +323,10 @@ class DiscordBot(BaseIMClient):
async def _on_ready_event(self):
logger.info("Discord client ready")
if self._on_ready:
- await self._on_ready()
+ try:
+ await self._on_ready()
+ except Exception as err:
+ logger.error("Discord on_ready callback failed: %s", err, exc_info=True)
async def _is_authorized_channel(self, channel_id: str) -> bool:
if not self.settings_manager:
@@ -1001,6 +1004,12 @@ class _DiscordButtonView(discord.ui.View):
except Exception:
pass
channel_id, thread_id = self.outer._extract_context_ids(interaction.channel)
+ guild_id = str(interaction.guild_id) if interaction.guild_id else None
+ if guild_id and not self.outer._is_allowed_guild(guild_id):
+ return
+ if not await self.outer._is_authorized_channel(channel_id):
+ await self.outer._send_unauthorized_message(channel_id)
+ return
context = MessageContext(
user_id=str(interaction.user.id),
channel_id=channel_id,