Code Monkey home page Code Monkey logo

Comments (5)

AhmedMondo avatar AhmedMondo commented on July 17, 2024

should i pass my own fetching system or there is another solution ?

from discord-html-transcripts.

AhmedMondo avatar AhmedMondo commented on July 17, 2024

and is there any plans to support stickers ?

from discord-html-transcripts.

AhmedMondo avatar AhmedMondo commented on July 17, 2024

Here is the function i made for fetching the whole messages and it works

async function fetchAllMessages(channel, limit = Infinity) {
  if (!channel) {
    throw new Error(`Expected channel, got ${typeof channel}.`);
  }
  if (limit <= 100) {
    return channel.messages.fetch({ limit });
  }

const { Collection } = require('discord.js');
  let collection = new Collection();
  let lastId = null;
  let options = {};
  let remaining = limit;

  while (remaining > 0) {
    options.limit = remaining > 100 ? 100 : remaining;
    remaining = remaining > 100 ? remaining - 100 : 0;

    if (lastId) {
      options.before = lastId;
    }

    let messages = await channel.messages.fetch(options);

    if (!messages.last()) {
      break;
    }

    collection = collection.concat(messages);
    lastId = messages.last().id;
  }
  return collection.reverse()
}

from discord-html-transcripts.

ItzDerock avatar ItzDerock commented on July 17, 2024

and is there any plans to support stickers ?

Can you create a separate issue for this? If it's possible I will implement it.

from discord-html-transcripts.

AhmedMondo avatar AhmedMondo commented on July 17, 2024

and is there any plans to support stickers ?

Can you create a separate issue for this? If it's possible I will implement it.

Ok

from discord-html-transcripts.

Related Issues (20)

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.