- discord.js
- require-all
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Ограничения: | |
| // https://discordapp.com/developers/docs/resources/channel#embed-limits | |
| // Объекто ореентированный эмбед | |
| // Удобно использовать для небольших эмбедов для сокращения кода | |
| msg.channel.send({ | |
| embed: { | |
| color: 3447003, | |
| author: { | |
| name: bot.user.username, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| require('regenerate')( | |
| '😀|😬|😁|😂|😃|😄|🤣|😅|😆|😇|😉|😊|🙂|🙃|☺|😋|😌|😍|😘|😗|😙|😚|🤪|😜|😝|😛|🤑|😎|🤓|🧐|🤠|🤗|🤡|😏|😶|😐|😑|😒|🙄|🤨|🤔|🤫|🤭|🤥|😳|😞|😟|😠|😡|🤬|😔|😕|🙁|☹|😣|😖|😫|😩|😤|😮|😱|😨|😰|😯|😦|😧|😢|😥|😪|🤤|😓|😭|🤩|😵|😲|🤯|🤐|😷|🤕|🤒|🤮|🤢|🤧|😴|💤|😈|👿|👹|👺|💩|👻|💀|☠|👽|🤖|🎃|😺|😸|😹|😻|😼|😽|🙀|😿|😾|👐|🤲|🙌|👏|🙏|🤝|👍|👎|👊|✊|🤛|🤜|🤞|✌|🤘|🤟|👌|👈|👉|👆|👇|☝|✋|🤚|🖐|🖖|👋|🤙|💪|🖕|✍|🤳|💅|👄|👅|👂|👃|👁|👀|🧠|👤|👥|🗣|👶|🧒|👦|👧|🧑|👨|🧔|👱|👩|👱|🧓|👴|👵|👲|👳|🧕|🤶|🎅|👼|👸|🤴|👰|🤵|🤵|🕴️|🕴|🧙|🧝|🧚|🧞|🧜|🧛|🧟|🙇|💁|🙅|🙆|🤷|🙋|🤦|🙎|🙍|💇|💆|🤰|🤱|🚶|🏃|👫|👬|👭|💑|👩❤️👩|👨❤️👨|💏|👩❤️💋👩|👨❤️💋👨|❤|🧡|💛|💚|💙|💜|🖤|💔|❣|💕|💞|💓|💗|💖|💘|💝|💟|🐶|🐱|🐭|🐹|🐰|🐻|🐼|🐨|🐯|🦁|🐮|🐷|🐽|🐸|🐵|🙈|🙉|🙊|🐒|🦍|🐔|🐧|🐦|🐤|🐣|🐥|🐺|🦊|🐗|🐴|🦓|🦒|🦌|🦄|🐝|🐛|🦋|🐌|🐞|🐜|🦗|🕷|🕸|🦂|🐢|🐍|🦎|🦀|🦑|🐙|🦐|🐠|🐟|🐡|🐬|🦈|🐳|🐋|🐊|🐆|🐅|🐃|🐂|🐄|🐪|🐫|🐘|🦏|🐐|🐏|🐑|🐎|🐖|🦇|🐓|🦃|🕊|🦅|🦆|🦉|🐕|🐩|🐈|🐇|🐀|🐁|🐿|🦔|🐾|🐉|🐲|🦕|🦖|🌵|🎄|🌲|🌳|🌴|🌱|🌿|☘|🍀|🎍|🎋|🍃|🍂|🍁|🌾|🌺|🌻|🌹|🥀|🌷|🌼|🌸|💐|🍄|🌰|🐚|🌎|🌍|🌏|🌕|🌖|🌗|🌘|🌑|🌒|🌓|🌔|🌚|🌝|🌛|🌜|🌞|🌙|⭐|🌟|💫|✨|☄|☀|🌤|⛅|🌥|🌦|☁|🌧|⛈|🌩|⚡|🔥|💥|❄|🌨|☃|⛄|🌬|💨|🌪|🌫|☔|💧|💦|🌊|🍏|🍎|🍐|🍊|🍋|🍌|🍉|🍇|🍓|🍈|🍒|🍑|🍍|🥥|🥝|🍅|🥑|🍆|🌶|🥒|🥦|🌽|🥕|🥗|🥔|🍠|🥜|🍯|🍞|🥐|🥖|🥨|🥞|🧀|🍗|🍖|🥩|🍤|🥚|🍳|🥓|🍔|🍟|🌭|🍕|🍝|🥪|🥙|🌮|🌯|🍜|🥘|🍲|🥫|🍥|🍣|🍱|🍛|🍙|🍚|🍘|🥟|🍢|🍡|🍧|🍨|🍦|🍰|🎂|🥧|🍮|🍭|🍬|🍫|🍿|🍩|🍪|🥠|☕|🍵|🥣|🍼|🥤|🥛|🍺|🍻|🍷|🥂 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| bot.on('guildMemberAdd', async member => { | |
| let invites = require('./ready'); | |
| const guildInvites = await member.guild.fetchInvites(); | |
| const existingInvites = invites[member.guild.id]; | |
| invites[member.guild.id] = guildInvites; | |
| const invite = guildInvites.find(i => existingInvites.get(i.code).uses < i.uses); | |
| }); |
Хочешь добавить немного разнообразия в ваше повседневное текстовое общение? Тебе повезло! Дискорд поддерживает форматирование, оно поможет вам сделать сообщения особенным. И вот руководство для этого! Просто добавьте немного символов вокруг текста! Вот несколько примеров...
Курсив *Курсив* или _Курсив_
Жирный **bold**
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * Uses Levenshtein distance on several lines | |
| * @param {string} s ## String to compare each element of array | |
| * @param {string[]} a ## Array to compare | |
| * @returns {array} Returns an array of best matches, 0 index is the best match. | |
| * @author [Bitler](https://github.com/thebitler/) | |
| */ | |
| function compareArr(s, a) { | |
| return a.map(e => [e, require('js-levenshtein')(s.toLowerCase(), e.toLowerCase())]).sort((a, b) => a[1] - b[1]); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * Selecting for you best constrasting color (black or white) | |
| * @param {number} r Red - integer (from 0 to 255) | |
| * @param {number} g Green - integer (from 0 to 255) | |
| * @param {number} b Blue - integer (from 0 to 255) | |
| * @returns '#000000' or '#ffffff' (black or white in hex value) | |
| * @author [Bitler](https://github.com/thebitler/) | |
| */ | |
| function contrast(r, g, b) { | |
| [r, g, b] = [r, g, b].map(c => c / 255).map(c => (c <= 0.03928 ? c / 12.92 : ((c + 0.055) / 1.055) ** 2.4)); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| async function status(msg) { | |
| //тут состояние всего. | |
| const superagent = require('superagent'); //нужен модуль superagent | |
| if (msg.content.startsWith('-all')) { | |
| //команда | |
| const message = await msg.channel.send('ща глянем'); //что пишет бот в первом неизмененном сообщении | |
| let delay = `задержка ${message.createdTimestamp - msg.createdTimestamp} мс. задержка API ${Math.round( | |
| client.ping | |
| )} мс.`; //задержка |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 'use strict' | |
| // see: https://github.com/nodejs/node/pull/6157 | |
| var startTime = process.hrtime() | |
| var startUsage = process.cpuUsage() | |
| // spin the CPU for 500 milliseconds | |
| var now = Date.now() | |
| while (Date.now() - now < 500) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * Creating MySQL connection URL | |
| */ | |
| let MySQL_URL = (username, password, host, port, database) => | |
| `mysql://${username}:${password}@${host}:${port}/${database}`; |
OlderNewer