Skip to content

Commit

Permalink
Started the bugfixes.
Browse files Browse the repository at this point in the history
  • Loading branch information
mleandrojr committed Apr 19, 2024
1 parent 75ff890 commit 47aca9d
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
1 change: 1 addition & 0 deletions src/action/SaveUserAndChat.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ export default class SaveUserAndChat extends Action {
const chat = await ChatHelper.getByTelegramId(this.context.chat.getId());
const chatId = chat === null ? await ChatHelper.createChat(this.context.chat) : chat!.id;

console.log("Chat:", chat, "ChatId:", chatId);
UserHelper.updateUser(contextUser);
ChatHelper.updateChat(this.context.chat);

Expand Down
9 changes: 7 additions & 2 deletions src/controller/Controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -197,12 +197,17 @@ export default class Controller {
*
* @param command
*/
private executeCommand(command: Command): void {
private async executeCommand(command: Command): Promise<void> {

const commandContext = command.isCalled();

if (!commandContext) {
return Promise.resolve();
}

try {
!commandContext || command.run(commandContext);

await command.run(commandContext);

} catch (error: any) {
Log.save(error.toString());
Expand Down
1 change: 1 addition & 0 deletions src/helper/Chat.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ export default class ChatHelper {
*/
public static async createChat(chat: Record<string, any>): Promise<any> {

console.log("Abc");
const title = chat.getTitle() || chat.getUsername() || (`${chat.getFirstName()} ${chat.getLastName()}`).trim();
const newChat = new Chats();
newChat
Expand Down

0 comments on commit 47aca9d

Please sign in to comment.