Skip to content

Commit

Permalink
chore: AppOctokit > RestOctokitFromApp
Browse files Browse the repository at this point in the history
  • Loading branch information
Keyrxng committed Oct 27, 2024
1 parent c8e12eb commit c29e93a
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 12 deletions.
4 changes: 2 additions & 2 deletions src/bot/features/admin/set-webhook.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ feature.command("setWebhook", logHandle("command-setWebhook"), chatAction("typin
try {
await ctx.api.setWebhook(webhookUrl);
return ctx.reply("Webhook URL has been set.");
} catch (er) {
return ctx.reply(`Failed to set webhook URL. \n\n${JSON.stringify(er)}`);
} catch (error) {
return ctx.reply(`Failed to set webhook URL. \n\n${JSON.stringify(error)}`);
}
});

Expand Down
6 changes: 3 additions & 3 deletions src/bot/helpers/grammy-context.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { Context as UbiquityOsContext } from "../../types";
import { Logger } from "../../utils/logger";
import { createAdapters } from "../../adapters";
import { PluginContext } from "../../types/plugin-context-single";
import { Octokit as AppOctokit } from "octokit";
import { Octokit as RestOctokitFromApp } from "octokit";

export type GrammyTelegramUpdate = Update;

Expand All @@ -18,7 +18,7 @@ export interface SessionData {
interface Dependencies {
logger: Logger;
config: UbiquityOsContext["env"];
octokit: AppOctokit;
octokit: RestOctokitFromApp;
}

interface ExtendedContextFlavor extends Dependencies {
Expand All @@ -32,7 +32,7 @@ export async function createContextConstructor({ logger, config, octokit }: Depe
return class extends DefaultContext implements ExtendedContextFlavor {
logger: Logger;
adapters = adapters;
octokit: AppOctokit = octokit;
octokit: RestOctokitFromApp = octokit;
config: UbiquityOsContext["env"];

constructor(update: GrammyTelegramUpdate, api: Api, me: UserFromGetMe) {
Expand Down
4 changes: 2 additions & 2 deletions src/bot/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@ import { unhandledFeature } from "./features/helpers/unhandled";
import { registerFeature } from "./features/commands/private-chat/register";
import { notifySubscribeFeature } from "./features/commands/private-chat/notify-subscribe";
import { walletFeature } from "./features/commands/private-chat/wallet";
import { Octokit as AppOctokit } from "octokit";
import { Octokit as RestOctokitFromApp } from "octokit";

interface Dependencies {
config: UbiquityOsContext["env"];
logger: Logger;
octokit: AppOctokit;
octokit: RestOctokitFromApp;
}

interface Options {
Expand Down
4 changes: 2 additions & 2 deletions src/types/context.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { Env } from "./env";
import { PluginSettings } from "./plugin-inputs";
import { Logs } from "@ubiquity-dao/ubiquibot-logger";
import { createAdapters } from "../adapters";
import { Octokit as AppOctokit } from "octokit";
import { Octokit as RestOctokitFromApp } from "octokit";

export type SupportedEventsU = WebhookEventName;

Expand All @@ -15,7 +15,7 @@ export type SupportedEvents = {
export interface Context<T extends SupportedEventsU = SupportedEventsU, TU extends SupportedEvents[T] = SupportedEvents[T]> {
eventName: T;
payload: TU["payload"];
octokit: Octokit | AppOctokit;
octokit: Octokit | RestOctokitFromApp;
config: PluginSettings;
env: Env;
logger: Logs;
Expand Down
6 changes: 3 additions & 3 deletions src/types/plugin-context-single.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { Context } from "./context";
import { App } from "octokit";
import { logger } from "../utils/logger";
import { Octokit } from "@octokit/rest";
import { Octokit as AppOctokit } from "octokit";
import { Octokit as RestOctokitFromApp } from "octokit";

/**
* Singleton for the plugin context making accessing it throughout
Expand Down Expand Up @@ -82,8 +82,8 @@ export class PluginContext {
* This can be used with events from both Telegram and GitHub, this token comes from
* the worker's environment variables i.e the Storage App.
*/
async getTelegramEventOctokit(): Promise<AppOctokit> {
let octokit: AppOctokit | null = null;
async getTelegramEventOctokit(): Promise<RestOctokitFromApp> {
let octokit: RestOctokitFromApp | null = null;

await this.getApp().eachInstallation(async (installation) => {
if (installation.installation.account?.login === this.config.storageOwner) {
Expand Down

0 comments on commit c29e93a

Please sign in to comment.