Coder Social home page Coder Social logo

Comments (12)

gazmull avatar gazmull commented on June 7, 2024 1

I missed the opportunity to ask this: What Discord.JS version are you using? I can only assume right now [according to the source code] that you're using the master version (v12) of D.JS, which installing v11 branch is not an option and instead install the master branch. Also recently, .setAuthorizedUser(<user>) has been changed to .setAuthorizedUsers(<array of user ids>) at master branch.

For more change notes: Click me or refer to the updated docs

from discord-paginationembed.

gazmull avatar gazmull commented on June 7, 2024

Hi. I've tested v11 branch and there are no problems encountered with my test script. Perhaps showing your source code will help?

from discord-paginationembed.

OmiMike avatar OmiMike commented on June 7, 2024
const { Embeds: EmbedsMode, FieldsEmbed: FieldsEmbedMode } = require('discord-paginationembed');
module.exports = {
	name: 'pokemon',
	aliases: ['p'],
	description: 'Pokemon List',
	cooldown: 1,
	async execute(prefix, command, message, args, db) {
		db.query("SELECT *, user_monsters.ID  FROM user_monsters JOIN monsters ON user_monsters.monster_ID = monsters.ID WHERE user_ID='" + message.author.id + "' ORDER BY seq_num;",async function(err,rows){
			if(err) throw err;
			if(rows != null && rows.length > 0){
				var pagenum = 1;
				if(!isNaN(parseInt(args[0]))) pagenum = args[0];
				var pages = [];
				var listpage = '';
				rows.forEach((row) => {
					var iv = (Math.floor(((row.attiv + row.defiv + row.hpiv + row.speediv + row.spattiv + row.spdefiv) / 6) * 100));
					var pokerow = (row.shiny != 1 ? '' : '__✨__ ') + '# '  + row.seq_num + ' **' + row.name + '** | IV: ' + iv + '% | Lvl: ' + Math.floor((1/58) * (Math.sqrt(29) * Math.sqrt(8 * row.xp + 29) - 29)) + '\n';
					if((pokerow.length + listpage.length) > 725){
						pages.push(listpage);
						listpage = pokerow;
					}else{
						listpage += pokerow;
					}
				});
				pages.push(listpage);
				if(pagenum > pages.length) pagenum = 1;
				const embeds = [];
				var i = 0;
				pages.forEach((page) => {
					i++;
					const exampleEmbed = new Discord.MessageEmbed()
					.setThumbnail(message.author.displayAvatarURL)
					.setColor('#0099ff')
					.setTitle(message.author.username + '\'s Pokemon')
					.addField('Pokemon List', pages[i - 1])
					.setFooter("Showing page " + i + " of " + pages.length + ". Use `" + prefix + command + " <number>` to show a new page or use the emojis below.");
					embeds.push(exampleEmbed);
				});
				var neb = new EmbedsMode().setArray(embeds)
				  .setAuthorizedUser(message.author)
				  .setClientMessage(null, message.author.toString())
				  .setChannel(message.channel)
				  .showPageIndicator(false)
				  .setPage(pagenum)
				  .setColor(3447003);
				return await neb.build();
				///node_modules/discord.js/src/structures/MessageEmbed.js:157if (value.length > 1024) throw new RangeError('MessageEmbed field values may not exceed 1024 characters.');
			}else{
				message.reply("You don't have any pokemon!");
			}
		});
	}
};

This is one of my commands i think fixing this one I will be able to do the rest because they are basically the same setup.. I have tried putting in the RichEmbed and that isnt working either @gazmull

from discord-paginationembed.

OmiMike avatar OmiMike commented on June 7, 2024

now getting a new error for RichEmbed

image

Even after adding the RichEmbed it still likes to play with me hahaha

from discord-paginationembed.

OmiMike avatar OmiMike commented on June 7, 2024

So the master branch would be which npm install.. We use node.js

from discord-paginationembed.

OmiMike avatar OmiMike commented on June 7, 2024

npm install gazmull/discord-paginationembed#v11

Is this not the one i should be using?

from discord-paginationembed.

gazmull avatar gazmull commented on June 7, 2024

Yes. gazmull/discord-paginationembed#v11 is only for D.JS 11.3.2 and below.

from discord-paginationembed.

OmiMike avatar OmiMike commented on June 7, 2024

Thats the one i have and its throwing the RichEmbed error

from discord-paginationembed.

gazmull avatar gazmull commented on June 7, 2024

Are you sure your D.JS Version is v11.3.2 or below? It seems your source code says otherwise with new Discord.MessageEmbed()— or do you happen to really use MessageEmbed instead of RichEmbed for declaring a new instance of an embed?

The only thing I could think of, if ever the question above doesn't solve anything, is re-installing Discord.JS.

from discord-paginationembed.

OmiMike avatar OmiMike commented on June 7, 2024

MessageEmbed is whats used on all my commands and I'm not sure which version I'm using for discord.js to be honest

from discord-paginationembed.

OmiMike avatar OmiMike commented on June 7, 2024

I download discord.js about 6 weeks ago

from discord-paginationembed.

gazmull avatar gazmull commented on June 7, 2024

Please refer to npm ls discord.js.

from discord-paginationembed.

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.