Coder Social home page Coder Social logo

richer-embed's Introduction

richer-embed

An extension of Discord.js's RichEmbed class, with more functionality such as setting local images as embed.image and embed.thumbnail and personalizing the embed with a User's profile picture and name. Made for farazkaleemmalik/phoenixwright, a bot made with Discord.js.

RicherEmbed

Kind: global class

new RicherEmbed(channelObj, options)

Returns: RicherEmbed - Returns itself

Param Type Description
channelObj Channel | User Discord.js Channel instance for which the embed is being created
options Object Additional properties to add to embed. An existing embed can also be inserted to turn it into a RicherEmbed instance (may be buggy).

richerEmbed.personalise(authorObj) ⇒ RicherEmbed

Personalises the embed for a User by changing the title and the thumbnail

Kind: instance method of RicherEmbed
Returns: RicherEmbed - Returns itself

Param Type Description
authorObj User User to personalise

richerEmbed.setLocalThumbnail(pathName) ⇒ RicherEmbed

Attaches a local image as a thumbnail for the embed

Kind: instance method of RicherEmbed
Returns: RicherEmbed - Returns itself

Param Type Description
pathName String Path to image. Relative paths are relative to entry file

richerEmbed.setLocalImage(pathName) ⇒ RicherEmbed

Attaches a local image as the main image for the embed

Kind: instance method of RicherEmbed
Returns: RicherEmbed - Returns itself

Param Type Description
pathName String Path to image. Relative paths are relative to entry file

richerEmbed.setContent(title, content) ⇒ RicherEmbed

Sets content for the embed

Kind: instance method of RicherEmbed
Returns: RicherEmbed - Returns itself

Param Type Description
title String Title of embed
content String Content of embed, to be set embed.description

richerEmbed.replace(messageToReplace)

Replaces a message with this embed

Kind: instance method of RicherEmbed

Param Type Description
messageToReplace Message The message to replace. Note that this overrides the message channel previously set of the new provided is in a different channel

richerEmbed.send() ⇒ Promise(Message)

Send the message to the channel in embed.channel

Kind: instance method of RicherEmbed

richerEmbed.chat(authorObj, command, imageUrl) ⇒ RicherEmbed

Turns the embed into a chat embed, to be used by a bot command

Kind: instance method of RicherEmbed
Returns: RicherEmbed - Returns itself

Param Type Description
authorObj User Author of chat command
command String Exact command in the form of "commandName parameters more_parameters". The first word is excluded from the embed's content.
imageUrl String Url of main image

richer-embed's People

Contributors

numberisnan avatar

Stargazers

 avatar

Watchers

James Cloos avatar

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.