Giter Site home page Giter Site logo

discordeno / serverless-deno-deploy-template Goto Github PK

View Code? Open in Web Editor NEW
33.0 3.0 10.0 63 KB

Template or boilerplate using Discordeno Slash Serverless Bot on Deno Deploy for Discord API Bots

License: Apache License 2.0

TypeScript 97.82% Dockerfile 2.18%
discord bot javascript typescript discord-api deno discordeno

serverless-deno-deploy-template's Issues

Error on `deno cache ...` and in Deno Deploy

Error The deployment failed: failed to fetch 'https://raw.githubusercontent.com/usesift/media_types/34656bf398c81f2687fa5010e56844dac4e7a2e9/mod.ts': HTTP status client error (404 Not Found) for url (https://raw.githubusercontent.com/usesift/media_types/34656bf398c81f2687fa5010e56844dac4e7a2e9/mod.ts)

Template doesn't work

The tasks don't work, many files reference a non-existent deps.ts, etc, etc...

Is this meant to be working or has this template been abandoned?

perm levels

a permission level system to control which users can use which commands so normal users can't use /kick or something

Uses old apis?

Hi I'm new to discordeno and wanted to try it out using deploy, so I came here, deploy has a new ui so the setup process is completely different though thats not the point of this issue, after I set it up I noticed it couldn't deploy because of type errors about a missing export, so I tried the version of discordeno around the last commit was made, well that didn't work either anyways here are the errors.

with v13 rc18
error: TS2345 [ERROR]: Argument of type 'bigint' is not assignable to parameter of type 'Bot'.
          snowflakeToBigint(iconUrl.id),
          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    at file:///home/yavor/tools/src/utils/Embed.ts:73:11

TS2345 [ERROR]: Argument of type 'bigint' is not assignable to parameter of type 'Bot'.
          snowflakeToBigint(url.id),
          ~~~~~~~~~~~~~~~~~~~~~~~~~
    at file:///home/yavor/tools/src/utils/Embed.ts:141:11

TS2724 [ERROR]: '"file:///home/yavor/tools/deps.ts"' has no exported member named 'DiscordApplicationCommandOptionTypes'. Did you mean 'DiscordenoApplicationCommandOption'?
import { DiscordApplicationCommandOptionTypes } from "../../../deps.ts";
         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    at file:///home/yavor/tools/src/commands/general/avatar.ts:1:10

TS2724 [ERROR]: '"file:///home/yavor/tools/deps.ts"' has no exported member named 'setApplicationId'. Did you mean 'getApplicationInfo'?
  setApplicationId,
  ~~~~~~~~~~~~~~~~
    at file:///home/yavor/tools/src/utils/redeploy.ts:5:3

    'getApplicationInfo' is declared here.
    export async function getApplicationInfo(bot: Bot) {
                          ~~~~~~~~~~~~~~~~~~
        at https://deno.land/x/[email protected]/src/helpers/oauth/getApplicationInfo.ts:5:23

TS2724 [ERROR]: '"file:///home/yavor/tools/deps.ts"' has no exported member named 'setApplicationId'. Did you mean 'getApplicationInfo'?
  setApplicationId,
  ~~~~~~~~~~~~~~~~
    at file:///home/yavor/tools/src/utils/redeploy.ts:5:3

    'getApplicationInfo' is declared here.
    export async function getApplicationInfo(bot: Bot) {
                          ~~~~~~~~~~~~~~~~~~
        at https://deno.land/x/[email protected]/src/helpers/oauth/getApplicationInfo.ts:5:23

TS2305 [ERROR]: Module '"file:///home/yavor/tools/deps.ts"' has no exported member 'upsertSlashCommands'.
  upsertSlashCommands,
  ~~~~~~~~~~~~~~~~~~~
    at file:///home/yavor/tools/src/utils/redeploy.ts:6:3

TS2724 [ERROR]: '"file:///home/yavor/tools/deps.ts"' has no exported member named 'DiscordApplicationCommandOptionTypes'. Did you mean 'DiscordenoApplicationCommandOption'?
import { DiscordApplicationCommandOptionTypes } from "../../../deps.ts";
         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    at file:///home/yavor/tools/src/commands/general/language.ts:1:10

TS2305 [ERROR]: Module '"file:///home/yavor/tools/deps.ts"' has no exported member 'validatePermissions'.
import { Interaction, validatePermissions } from "../../deps.ts";
                      ~~~~~~~~~~~~~~~~~~~
    at file:///home/yavor/tools/src/utils/permissionLevels.ts:1:23

TS2554 [ERROR]: Expected 4 arguments, but got 3.
  await sendWebhook(snowflakeToBigint(id), token, {
        ^
    at file:///home/yavor/tools/src/utils/logWebhook.ts:22:9

    An argument for 'options' was not provided.
    export async function sendWebhook(bot: Bot, webhookId: bigint, webhookToken: string, options: ExecuteWebhook) {
                                                                                         ~~~~~~~~~~~~~~~~~~~~~~~
        at https://deno.land/x/[email protected]/src/helpers/webhooks/sendWebhook.ts:7:86

TS2305 [ERROR]: Module '"file:///home/yavor/tools/deps.ts"' has no exported member 'camelize'.
  camelize,
  ~~~~~~~~
    at file:///home/yavor/tools/mod.ts:2:3

TS2724 [ERROR]: '"file:///home/yavor/tools/deps.ts"' has no exported member named 'DiscordInteractionResponseTypes'. Did you mean 'DiscordenoInteractionResponse'?
  DiscordInteractionResponseTypes,
  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    at file:///home/yavor/tools/mod.ts:3:3

TS2305 [ERROR]: Module '"file:///home/yavor/tools/deps.ts"' has no exported member 'verifySignature'.
  verifySignature,
  ~~~~~~~~~~~~~~~
    at file:///home/yavor/tools/mod.ts:10:3

Found 12 errors.
with latest
error: TS2345 [ERROR]: Argument of type 'bigint' is not assignable to parameter of type 'string'.
    return { content: translate(payload.guildId!, "PING_RESPONSE") };
                                ~~~~~~~~~~~~~~~~
    at file:///home/yavor/tools/src/commands/general/ping.ts:7:33

TS2305 [ERROR]: Module '"file:///home/yavor/tools/deps.ts"' has no exported member 'EmbedAuthor'.
  EmbedAuthor,
  ~~~~~~~~~~~
    at file:///home/yavor/tools/src/utils/Embed.ts:3:3

TS2305 [ERROR]: Module '"file:///home/yavor/tools/deps.ts"' has no exported member 'EmbedField'.
  EmbedField,
  ~~~~~~~~~~
    at file:///home/yavor/tools/src/utils/Embed.ts:4:3

TS2305 [ERROR]: Module '"file:///home/yavor/tools/deps.ts"' has no exported member 'EmbedFooter'.
  EmbedFooter,
  ~~~~~~~~~~~
    at file:///home/yavor/tools/src/utils/Embed.ts:5:3

TS2305 [ERROR]: Module '"file:///home/yavor/tools/deps.ts"' has no exported member 'EmbedImage'.
  EmbedImage,
  ~~~~~~~~~~
    at file:///home/yavor/tools/src/utils/Embed.ts:6:3

TS2345 [ERROR]: Argument of type 'bigint' is not assignable to parameter of type 'Bot'.
          snowflakeToBigint(iconUrl.id),
          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    at file:///home/yavor/tools/src/utils/Embed.ts:73:11

TS2345 [ERROR]: Argument of type 'bigint' is not assignable to parameter of type 'string'.
          snowflakeToBigint(iconUrl.id),
                            ~~~~~~~~~~
    at file:///home/yavor/tools/src/utils/Embed.ts:73:29

TS2345 [ERROR]: Argument of type 'bigint' is not assignable to parameter of type 'Bot'.
          snowflakeToBigint(url.id),
          ~~~~~~~~~~~~~~~~~~~~~~~~~
    at file:///home/yavor/tools/src/utils/Embed.ts:141:11

TS2345 [ERROR]: Argument of type 'bigint' is not assignable to parameter of type 'string'.
          snowflakeToBigint(url.id),
                            ~~~~~~
    at file:///home/yavor/tools/src/utils/Embed.ts:141:29

TS2724 [ERROR]: '"file:///home/yavor/tools/deps.ts"' has no exported member named 'DiscordApplicationCommandOptionTypes'. Did you mean 'DiscordApplicationCommandOptionChoice'?
import { DiscordApplicationCommandOptionTypes } from "../../../deps.ts";
         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    at file:///home/yavor/tools/src/commands/general/avatar.ts:1:10

TS2322 [ERROR]: Type '(payload: Interaction) => { content: string; embeds?: undefined; } | { embeds: Embed[]; content?: undefined; }' is not assignable to type '(payload: Interaction) => InteractionResponse | InteractionApplicationCommandCallbackData | Promise<...>'.
  Type '{ content: string; embeds?: undefined; } | { embeds: Embed[]; content?: undefined; }' is not assignable to type 'InteractionResponse | InteractionApplicationCommandCallbackData | Promise<InteractionResponse | InteractionApplicationCommandCallbackData>'.
    Type '{ embeds: Embed[]; content?: undefined; }' is not assignable to type 'InteractionResponse | InteractionApplicationCommandCallbackData | Promise<InteractionResponse | InteractionApplicationCommandCallbackData>'.
      Type '{ embeds: Embed[]; content?: undefined; }' is not assignable to type 'InteractionApplicationCommandCallbackData'.
        Types of property 'embeds' are incompatible.
          Type 'import("file:///home/yavor/tools/src/utils/Embed.ts").Embed[]' is not assignable to type 'import("https://deno.land/x/[email protected]/transformers/embed.ts").Embed[]'.
            Type 'import("file:///home/yavor/tools/src/utils/Embed.ts").Embed' is not assignable to type 'import("https://deno.land/x/[email protected]/transformers/embed.ts").Embed'.
              Types of property 'timestamp' are incompatible.
                Type 'string | undefined' is not assignable to type 'number | undefined'.
                  Type 'string' is not assignable to type 'number'.
  execute: function (payload) {
  ~~~~~~~
    at file:///home/yavor/tools/src/commands/general/avatar.ts:16:3

    The expected type comes from property 'execute' which is declared here on type 'Command'
      execute: (
      ~~~~~~~
        at file:///home/yavor/tools/src/commands/mod.ts:36:3

TS7053 [ERROR]: Element implicitly has an 'any' type because expression of type 'string' can't be used to index type 'Collection<bigint, User>'.
  No index signature with a parameter of type 'string' was found on type 'Collection<bigint, User>'.
    const targetUser = payload.data?.resolved?.users?.[userId] ||
                       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    at file:///home/yavor/tools/src/commands/general/avatar.ts:19:24

TS2339 [ERROR]: Property 'user' does not exist on type '{ avatar?: bigint | undefined; permissions?: bigint | undefined; nick?: string | undefined; premiumSince?: number | undefined; communicationDisabledUntil?: number | undefined; id: bigint; guildId: bigint; roles: bigint[]; toggles: { ...; }; joinedAt: number; }'.
      payload.member?.user || payload.user!;
                      ~~~~
    at file:///home/yavor/tools/src/commands/general/avatar.ts:20:23

TS2345 [ERROR]: Argument of type 'bigint' is not assignable to parameter of type 'string'.
        return { content: translate(payload.guildId!, "MISSING_MEMBER") };
                                    ~~~~~~~~~~~~~~~~
    at file:///home/yavor/tools/src/commands/general/avatar.ts:29:37

TS2345 [ERROR]: Argument of type 'bigint' is not assignable to parameter of type 'string'.
      return { content: translate(payload.guildId!, "MISSING_MEMBER") };
                                  ~~~~~~~~~~~~~~~~
    at file:///home/yavor/tools/src/commands/general/avatar.ts:36:35

TS2724 [ERROR]: '"file:///home/yavor/tools/deps.ts"' has no exported member named 'setApplicationId'. Did you mean 'getApplicationInfo'?
  setApplicationId,
  ~~~~~~~~~~~~~~~~
    at file:///home/yavor/tools/src/utils/redeploy.ts:5:3

    'getApplicationInfo' is declared here.
    export async function getApplicationInfo(bot: Bot) {
                          ~~~~~~~~~~~~~~~~~~
        at https://deno.land/x/[email protected]/helpers/oauth/getApplicationInfo.ts:5:23

TS2724 [ERROR]: '"file:///home/yavor/tools/deps.ts"' has no exported member named 'setApplicationId'. Did you mean 'getApplicationInfo'?
  setApplicationId,
  ~~~~~~~~~~~~~~~~
    at file:///home/yavor/tools/src/utils/redeploy.ts:5:3

    'getApplicationInfo' is declared here.
    export async function getApplicationInfo(bot: Bot) {
                          ~~~~~~~~~~~~~~~~~~
        at https://deno.land/x/[email protected]/helpers/oauth/getApplicationInfo.ts:5:23

TS2305 [ERROR]: Module '"file:///home/yavor/tools/deps.ts"' has no exported member 'upsertSlashCommands'.
  upsertSlashCommands,
  ~~~~~~~~~~~~~~~~~~~
    at file:///home/yavor/tools/src/utils/redeploy.ts:6:3

TS2724 [ERROR]: '"file:///home/yavor/tools/deps.ts"' has no exported member named 'DiscordApplicationCommandOptionTypes'. Did you mean 'DiscordApplicationCommandOptionChoice'?
import { DiscordApplicationCommandOptionTypes } from "../../../deps.ts";
         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    at file:///home/yavor/tools/src/commands/general/language.ts:1:10

TS2345 [ERROR]: Argument of type 'bigint' is not assignable to parameter of type 'string'.
      return { content: translate(payload.guildId!, "LANGUAGE_MISSING_KEY") };
                                  ~~~~~~~~~~~~~~~~
    at file:///home/yavor/tools/src/commands/general/language.ts:21:35

TS2345 [ERROR]: Argument of type 'bigint' is not assignable to parameter of type 'string'.
          payload.guildId!,
          ~~~~~~~~~~~~~~~~
    at file:///home/yavor/tools/src/commands/general/language.ts:27:11

TS2345 [ERROR]: Argument of type 'bigint' is not assignable to parameter of type 'string'.
    await updateGuildCommands(payload.guildId!);
                              ~~~~~~~~~~~~~~~~
    at file:///home/yavor/tools/src/commands/general/language.ts:35:31

TS2345 [ERROR]: Argument of type 'bigint' is not assignable to parameter of type 'string'.
      content: translate(payload.guildId!, "LANGUAGE_UPDATED"),
                         ~~~~~~~~~~~~~~~~
    at file:///home/yavor/tools/src/commands/general/language.ts:38:26

TS2305 [ERROR]: Module '"file:///home/yavor/tools/deps.ts"' has no exported member 'validatePermissions'.
import { Interaction, validatePermissions } from "../../deps.ts";
                      ~~~~~~~~~~~~~~~~~~~
    at file:///home/yavor/tools/src/utils/permissionLevels.ts:1:23

TS2339 [ERROR]: Property 'user' does not exist on type '{ avatar?: bigint | undefined; permissions?: bigint | undefined; nick?: string | undefined; premiumSince?: number | undefined; communicationDisabledUntil?: number | undefined; id: bigint; guildId: bigint; roles: bigint[]; toggles: { ...; }; joinedAt: number; }'.
  BOT_OWNERS: (payload) => [""].includes(payload.member?.user.id || payload.user?.id!),
                                                         ~~~~
    at file:///home/yavor/tools/src/utils/permissionLevels.ts:34:58

TS2339 [ERROR]: Property 'user' does not exist on type '{ avatar?: bigint | undefined; permissions?: bigint | undefined; nick?: string | undefined; premiumSince?: number | undefined; communicationDisabledUntil?: number | undefined; id: bigint; guildId: bigint; roles: bigint[]; toggles: { ...; }; joinedAt: number; }'.
  const user = payload.member?.user || payload.user!;
                               ~~~~
    at file:///home/yavor/tools/src/utils/logWebhook.ts:13:32

TS2345 [ERROR]: Argument of type 'bigint | "Channel ID unavailable"' is not assignable to parameter of type 'string'.
  Type 'bigint' is not assignable to type 'string'.
    ).addField("Channel", payload.channelId || "Channel ID unavailable", true)
                          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    at file:///home/yavor/tools/src/utils/logWebhook.ts:19:27

TS2345 [ERROR]: Argument of type 'bigint | "Guild ID unavailable"' is not assignable to parameter of type 'string'.
  Type 'bigint' is not assignable to type 'string'.
    .addField("Guild", payload.guildId || "Guild ID unavailable", true);
                       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    at file:///home/yavor/tools/src/utils/logWebhook.ts:20:24

TS2554 [ERROR]: Expected 4 arguments, but got 3.
  await sendWebhook(snowflakeToBigint(id), token, {
        ^
    at file:///home/yavor/tools/src/utils/logWebhook.ts:22:9

    An argument for 'options' was not provided.
    export async function sendWebhook(bot: Bot, webhookId: bigint, webhookToken: string, options: ExecuteWebhook) {
                                                                                         ~~~~~~~~~~~~~~~~~~~~~~~
        at https://deno.land/x/[email protected]/helpers/webhooks/sendWebhook.ts:7:86

TS2724 [ERROR]: '"file:///home/yavor/tools/deps.ts"' has no exported member named 'camelize'. Did you mean 'Camelize'?
  camelize,
  ~~~~~~~~
    at file:///home/yavor/tools/mod.ts:2:3

TS2305 [ERROR]: Module '"file:///home/yavor/tools/deps.ts"' has no exported member 'DiscordInteractionResponseTypes'.
  DiscordInteractionResponseTypes,
  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    at file:///home/yavor/tools/mod.ts:3:3

Found 31 errors.

document redeploy

It would be nice to have an explanation of the REDEPLOY_AUTHORIZATION and redeploy.ts setup. Where do these values come from? How do you use the endpoint?

It looks like it might just expect any random value, but I can't get it to work by calling the endpoint on deno deploy

❯ curl -i -H "Authorization:_MYSECRET_" -X POST https://MY_DEPLOY.deno.dev/redeploy
HTTP/2 401 
content-type: application/json; charset=utf-8
content-length: 42
date: Thu, 29 Jul 2021 04:54:12 GMT
via: HTTP/1.1 deploy
x-deno-ray: us-west1-a::89293705eb2b3f116286284463b1d447

{"error":"Invalid authorization header."}

REST

rest u need to add an entire REST manager into this using v11 rest

updateGuildCommands leading to an error

I have tried to make guild commands just for the purpose of tesing using updateGuildCommands method (of course with guild id). It gave me these 2 errors:

Error serving request: Error: Location:
   at Object.runMethod (https://raw.githubusercontent.com/discordeno/discordeno/main/src/rest/run_method.ts:21:11)
   at upsertSlashCommands (https://raw.githubusercontent.com/discordeno/discordeno/main/src/helpers/interactions/commands/upsert_slash_commands.ts:11:23)
   at updateGuildCommands (file:///src/src/utils/redeploy.ts:49:11)
   at Object.redeploy [as /redeploy] (file:///src/src/utils/redeploy.ts:17:16)
   at handleRequest (https://deno.land/x/[email protected]/mod.ts:48:55)
   at async Event.respondWith (deno:ext/http/01_http.js:151:16)

Error: [404] The resource at the location specified doesn't exist.
   at Object.processQueue (https://raw.githubusercontent.com/discordeno/discordeno/main/src/rest/process_queue.ts:74:50)
   at async Object.processRequest (https://raw.githubusercontent.com/discordeno/discordeno/main/src/rest/process_request.ts:30:9)

Any ideas how to fix it?

Logs

logger system that would log activity to a discord channel through a webhook

Inhibitors

inhibitors that can prevent a command from running if its like nsfw command in a non nsfw channel

port util folder

I think you should get the util folder ported over as well for better ux like Embed class

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.