Skip to content

Commit

Permalink
Merge pull request #7 from Manifest-Holdings/prod
Browse files Browse the repository at this point in the history
Validation changes for discord/telegram
  • Loading branch information
treppers authored Jan 31, 2025
2 parents 8d3cb8e + 2d321ce commit 2196a1e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
6 changes: 3 additions & 3 deletions packages/client-discord/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -417,14 +417,14 @@ export const DiscordClientInterface: ElizaClient = {
});

if (response.ok) {
return true;
return { success: true, message: ""};
} else {
elizaLogger.error(`Invalid discord token: ${response.status} ${response.statusText}`);
return false;
return { success: false, message: response.statusText };
}
} catch (error) {
elizaLogger.error('Error validating discord token:', error);
return false;
return { success: false, message: error };
}
},
stop: async (runtime: IAgentRuntime) => {
Expand Down
8 changes: 4 additions & 4 deletions packages/client-telegram/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,20 +25,20 @@ export const TelegramClientInterface: Client = {
const response = await fetch(`https://api.telegram.org/bot${token}/getMe`);
if (!response.ok) {
elizaLogger.error('Invalid telegram token1:', response.statusText);
return false;
return { success: false, message: response.statusText };
}
const data = await response.json();
elizaLogger.log('data', data)
if (data["ok"]) {
return true;
return { success: true, message: '' };
} else {
elizaLogger.error('Invalid telegram token2:', data["description"]);
return false;
return { success: false, message: data["description"] };
}
} catch (error) {
// maybe don't log error.message as it may have secret in it
elizaLogger.error('Error verifying telegram token:', error.message);
return false;
return { success: false, message: error.message };
}
},
stop: async (runtime: IAgentRuntime) => {
Expand Down

0 comments on commit 2196a1e

Please sign in to comment.