1.0.0 โ€ข Published 1 year ago

@tea062024/veniam-facere-voluptatum v1.0.0

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

๐Ÿ“ฅ ยป Installation

npm install @tea062024/veniam-facere-voluptatum

โœจ Example bot made in Discord.js

https://github.com/sefinek24/is-discord-invitation-bot

๐Ÿค” ยป Table

FunctionAsync/awaitOptionsValidationFaster methodReliabilityRecommended
onlineYesViewAPIโŒโœ…โœ…
regexNoViewRegexโœ…โŒโŒ

๐ŸŒ API

online(message)

Checks for valid Discord invitation links in the provided text and fetches invitation data.

  • message (string): The input text to search for Discord invitation links.

Returns (object): A Promise that resolves to an object with invitation data.

Invitation Data

If a valid invitation link is found, the returned data will have the following structure:

{
  "success": true,
  "code": 200,
  "isInvitation": true,
  "message": "Success",
  "url": {
    "full": "https://discord.gg/crtm7UKz",
    "invitationCode": "crtm7UKz",
    "fetched": "crtm7UKz"
  },
  "inviter": {
    "id": "614087461227986965",
    "username": "sefinek025",
    "avatar": "a_fc3d7404ae62d64ca4c3d777815ba167",
    "discriminator": "0",
    "public_flags": 256,
    "premium_type": 2,
    "flags": 256,
    "banner": "a_d9d11fb5320ce4cca30b7d85c837ce64",
    "accent_color": null,
    "global_name": "Sefinek ๐ŸŒ ",
    "avatar_decoration_data": {
      "asset": "a_88f42fb7360d8224a670a50c3496f315",
      "sku_id": "1174460780842856588"
    },
    "banner_color": null
  },
  "guild": {
    "id": "1002327795344621669",
    "name": "Pomoc IT - Sefinek",
    "splash": null,
    "banner": null,
    "description": null,
    "icon": "faf0e64797c69de5e14be94603935cd9",
    "features": [ "COMMUNITY", "CHANNEL_ICON_EMOJIS_GENERATED", "NEWS" ],
    "verification_level": 3,
    "vanity_url_code": null,
    "nsfw_level": 0,
    "nsfw": false,
    "premium_subscription_count": 0
  }
}

In case the invitation was not valid 100%:

{
  "success": true,
  "code": null,
  "isInvitation": false,
  "message": "No valid links found",
  "url": null,
  "inviter": null,
  "guild": null
}

regex(message, { options })

Checks if the given string contains Discord server invitations. Validation is based solely on the string itself. In this case, the script does NOT verify whether the link is actually associated with a server.

  • message (string): The input string to be checked.
  • options (object, optional): An options object for customizing the behavior. You can customize which types of Discord server invitation links to check by setting specific options to true or false. Available options include:
    • defaultDiscordUrls (boolean, default false): Check default Discord invitation URLs.
    • otherDiscordUrls (boolean, default false): Checks other domains created by Discord Inc. that redirect to discord.com/*.
    • disboard (boolean, default false): Checks URL addresses associated with the disboard.org website.
    • discordMe (boolean, default false): Checks URL addresses associated with the discord.me website.
    • discordhome (boolean, default false): Checks URL addresses associated with the discordhome.com website.

If no options are provided, the everything option will be set to true, meaning that all types of Discord server invitation links will be checked.

Returns (boolean): true if the input is a valid Discord server invitation link, false otherwise.

๐Ÿ“„ ยป Examples

๐Ÿงช Online

In this case, isInvitation will be true due to the link with the code HjEyuee4mc, as it is the only valid one.

const IsInvitation = require('@tea062024/veniam-facere-voluptatum');

(async () => {
    const result = await IsInvitation.online(
        'Lorem ipsum dolor sit amet, https://discord.gg/notValid consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna https://discord.gg/HjEyuee4mc aliqua.",
    );

    console.log(result.isInvitation); // true
})();

If the regex detects any invitation, the script sends a POST request to the API to verify the link's validity.

๐Ÿ”ก Regex

Quick method, but definitely not recommended for most cases. isInvitation will be true even if the invitation has expired or simply doesn't work.

const IsInvitation = require('@tea062024/veniam-facere-voluptatum');

const result1 = IsInvitation.regex('https://discord.gg/HjEyuee4mc', { everything: true }); // Example with `everything` option
console.log(result1); // true

const result2 = IsInvitation.regex('https://discord.gg/notVaildUrl');
console.log(result2); // true

const result3 = IsInvitation.regex('https://example.com/bKzhAdd6Fa');
console.log(result3); // false

๐Ÿค ยป Help

If you have any questions or just need help, please visit my official website, where you can find my email and my current Discord username. Feel free to send me a message on Discord or reach out via email.

Alternatively, you can create a new Issue.

๐ŸŒฟ Pull requests

Collaborators are welcome! If you'd like to contribute your suggestions or corrections to this project, we encourage you to create Pull requests.

โญ ยป Thanks

Thank you for your interest in this module. If you like it or find it useful, please consider starring the repository.

Array.prototype.flattenawaitObject.fromEntriessuperstructdircodesmonorepovestdescriptorsoncestyled-componentsprototypenopetostringtaglinuxmacosrandomprivate datafixed-widthtestertestwhatwgschemeentriesfullsomeincludesInt32Arrayfastcopyhigher-orderparentsimmutableprophashcompile lesstypereact-hookschinesemodulewrapreact-testing-librarycommandpreserve-symlinksbeanstalkfind-upnodetakees2018fast-deep-copyinspectvisualappindicatorkinesiscss nestingserializerajaxArray.prototype.findLastregular expressionsES2022tapebluebirdassigncompareflatMappostcss-pluginECMAScript 3columnArray.prototype.filterObject.entriesflagses-shim APIwatchFiletypesauthenticationObject.is_.extendextensionreplayinstallencryptiongetPrototypeOfestrimLeftcjkWeakSetObject.definePropertydirectoryInt8Arraypnpm9pluginxtermttycolorsamazoneslint-pluginES2018PromisesharedbatchES2020starternegative zeroquerystringprocesses2015isConcatSpreadablefseventsrgbgenericstypeofes2016Array.prototype.containsprivateTypedArrayguidapicall-boundtrimmetadatajoigdprHyBicopyObservablesdeepwaitstableES7cloudformationispreprocessoropenequalitystyleguidefscallbound.envs3Uint8ClampedArraytrimEndgroupByiamcorsl10ncoreStreamsobjecthotcheckmatchesbyteasyncenvironmentwatcher0RFC-6455fast-cloneassertionfilterrapidaccessibilitywgetgradients css3trimRightdomsetImmediateansirestfulshamtypeerrorpyyamlwritableES2016debuggerRxJSenvironmentsgetOwnPropertyDescriptorponyfillInt16ArraydotenvdateES2023erroroffsetformatavaworkercharactergrouppruneargumentstatusfastclonereactgettercss-in-jsFloat64Arrayfast-copyRegExp.prototype.flagschromiumES2019Reflect.getPrototypeOflengthsetterpolyfillfunctionscallbackcryptemojiglobalcreatefolderES5variables in csswafmatchsharedarraybufferswffindLastObjectawscloudwatchreduxes2017ratelimitloggingautoprefixertypedarrayslockfile__proto__loggerreusestylingxhrperformancecommand-linecssutil.inspecthasdataviewregularcompilerflagdynamodbpersistenttaskbrowserlistTypeScriptcloudtrailfastspeedwalkjsdifftraversetyped arraydataArrayfromes-abstractjsonpathcliexpressrdsutilityESnextbufferargparsepackagesbusyECMAScript 2019serializationbddhas-ownemitUint16ArrayenvshrinkwrapsetPrototypeOfcomputed-typescurlrequestdescriptor$.extendtddvpccolourcore-jsless compilertoArrayES3mimeinstallercharacterstypedbundlingimportexporteveryUnderscoreArray.prototype.findLastIndexjsintrinsiceventEmitterstreams2symbolsmaptypedarraycallarraybufferprotocol-buffersuninstallphoneastcloudsearchpasswordresolveelmspinnerslazynativeECMAScript 5limitedcoerciblermqsthroatmergeglobalscryptobreakrm -rfuuidECMAScript 2015regexpsymlinksrfc4122stringifier-0removeconcatMapslotpostcssfindLastIndexassertdeep-copyconsumejasmineupCSSStyleDeclarationshimdeterministicmodulesfileduplexcommanderidentifiersstoragegatewaysequencereal-timetelephonecollectionroutingutilitiesBigInt64Arrayform-validationbyteLengthmapreducemakerangeerrores6toolscensorlogrobustenumerableformspropertyjsxdeepcopybuffersweaksetroute53parsermimetypesWebSocketsStreampromisesreduceMaplibphonenumberelbargsconfigurableeventsextraartes7sqseventDispatchermrumiddlewarelistenersnamesbindlinkeslintconfigreducerfetchjavascriptmime-dbebsdataViewprogresspackage managerparentiteratoridlehookformlimitprettysameValueZerooptimizerinferencelanguageprefixflattenes-shimsviewprotobufrequireString.prototype.trimfunctionalObject.assignwatchingbcryptautoscalingsettingszerokeybyteOffsetsideECMAScript 2016tc39sortedinpositivewriteArray.prototype.flates5routetrimStartimmerchromequeuebootstrap cssAsyncIteratorfluxArray.prototype.includesstructuredClone256geti18nendpointutilstylesheetomitmkdirpredactbannerio-tsformattingPushperformantschemaairbnbownspecYAMLtestingRegExp#flagsasciiboundJSON-Schemaawesomesauceerror-handlingnodejsname[[Prototype]]styleshebangdescriptionqueryarktypeURLterminalhasOwnauthefficientECMAScript 2020extenddayjsemrECMAScript 7safeES2017browserframeworkjshintvalidcircularArrayBufferoptionBigUint64ArraydefinePropertyfpsspinnerfast-deep-clonetextpromiseless.jsieexitinputtappicomatchUint8ArrayelasticacheiteratesiginthandlerssortvalidationArrayBuffer#slicestreamfigletnested cssidconnectenderfunctionmixinses8finduppredictablehardlinksstreamsclassesregexroutertoStringTagsymboldependencieswordbreakcall-bindnegativehasOwnPropertyIteratorCSSES2015ReactiveExtensionscollection.es6npmdebugtypanionloadingexit-codesinatratoobjecthooksmake dirwarningpipeprotoObject.keysreadableassertsstdlibsignalsreadoptimistecmascriptsimpledbhttpsmkdirpackagedeepclonesnsstatelessslicejwtArrayBuffer.prototype.sliceagentirqqueueMicrotasklruts@@toStringTagyupclassnamedifftypescriptnumberec2Array.prototype.flatMappathwebstylescolorsyntaxajvcloudfrontarraysyamldeleteurlreact-hook-formsetglacierchannelminimalargvconfiglinewrapconcurrencyserializestateMicrosoftlook-upjest
1.0.0

1 year ago