node.js

How to make the bot send personalized emojis?

…衆ロ難τιáo~ 提交于 2021-02-10 17:28:41
问题 Well, I'm currently using the emoji :x: , but on my server I have an emoji called :superbotxemoji : I just don't know how I get my bot to use it My code: const Discord = require('discord.js'); module.exports = { name: 'say', description: 'say', execute(message, args) { const { prefix, token } = require('../config.json'); if (!message.member.hasPermission('ADMINISTRATOR')) return message.channel.send({ embed: { color: 16777201, description: `:x: | ${message.author}, You are not allowed to use

Is there a better way with NodeJs to get updates from a Telegram bot?

你说的曾经没有我的故事 提交于 2021-02-10 17:27:53
问题 I'm using simply like below: class Bot { constructor(token) { let _baseApiURL = `https://api.telegram.org`; //code here } getAPI(apiName) { return axios.get(`${this.getApiURL()}/${apiName}`); } getApiURL() { return `${this.getBaseApiUrl()}/bot${this.getToken()}`; } getUpdates(fn) { this.getAPI('getUpdates') .then(res => { this.storeUpdates(res.data); fn(res.data); setTimeout(() => { this.getUpdates(fn); }, 1000); }) .catch(err => { console.log('::: ERROR :::', err); }); } } const bot = new

How to make the bot send personalized emojis?

牧云@^-^@ 提交于 2021-02-10 17:27:35
问题 Well, I'm currently using the emoji :x: , but on my server I have an emoji called :superbotxemoji : I just don't know how I get my bot to use it My code: const Discord = require('discord.js'); module.exports = { name: 'say', description: 'say', execute(message, args) { const { prefix, token } = require('../config.json'); if (!message.member.hasPermission('ADMINISTRATOR')) return message.channel.send({ embed: { color: 16777201, description: `:x: | ${message.author}, You are not allowed to use

How to make the bot send personalized emojis?

倾然丶 夕夏残阳落幕 提交于 2021-02-10 17:26:14
问题 Well, I'm currently using the emoji :x: , but on my server I have an emoji called :superbotxemoji : I just don't know how I get my bot to use it My code: const Discord = require('discord.js'); module.exports = { name: 'say', description: 'say', execute(message, args) { const { prefix, token } = require('../config.json'); if (!message.member.hasPermission('ADMINISTRATOR')) return message.channel.send({ embed: { color: 16777201, description: `:x: | ${message.author}, You are not allowed to use

How to make the bot send personalized emojis?

こ雲淡風輕ζ 提交于 2021-02-10 17:26:08
问题 Well, I'm currently using the emoji :x: , but on my server I have an emoji called :superbotxemoji : I just don't know how I get my bot to use it My code: const Discord = require('discord.js'); module.exports = { name: 'say', description: 'say', execute(message, args) { const { prefix, token } = require('../config.json'); if (!message.member.hasPermission('ADMINISTRATOR')) return message.channel.send({ embed: { color: 16777201, description: `:x: | ${message.author}, You are not allowed to use

How to make the bot send personalized emojis?

不问归期 提交于 2021-02-10 17:26:04
问题 Well, I'm currently using the emoji :x: , but on my server I have an emoji called :superbotxemoji : I just don't know how I get my bot to use it My code: const Discord = require('discord.js'); module.exports = { name: 'say', description: 'say', execute(message, args) { const { prefix, token } = require('../config.json'); if (!message.member.hasPermission('ADMINISTRATOR')) return message.channel.send({ embed: { color: 16777201, description: `:x: | ${message.author}, You are not allowed to use

How to make the bot send personalized emojis?

a 夏天 提交于 2021-02-10 17:25:16
问题 Well, I'm currently using the emoji :x: , but on my server I have an emoji called :superbotxemoji : I just don't know how I get my bot to use it My code: const Discord = require('discord.js'); module.exports = { name: 'say', description: 'say', execute(message, args) { const { prefix, token } = require('../config.json'); if (!message.member.hasPermission('ADMINISTRATOR')) return message.channel.send({ embed: { color: 16777201, description: `:x: | ${message.author}, You are not allowed to use

SyntaxError: Unexpected token { when compiling my node.js code

谁都会走 提交于 2021-02-10 16:59:14
问题 I'm getting the below error every time with the first 'import' when I trying to run grandstack neo4j graphql api app. PS C:\Users\grand-stack-starter-master\api> nodemon index.js [nodemon] 1.19.1 [nodemon] to restart at any time, enter `rs` [nodemon] watching: *.* [nodemon] starting `node index.js src/index.js` C:\Users\grand-stack-starter-master\api\src\index.js:1 import { typeDefs } from "./graphql-schema"; ^ SyntaxError: Unexpected token { at Module._compile (internal/modules/cjs/loader.js

SyntaxError: Unexpected token { when compiling my node.js code

眉间皱痕 提交于 2021-02-10 16:59:05
问题 I'm getting the below error every time with the first 'import' when I trying to run grandstack neo4j graphql api app. PS C:\Users\grand-stack-starter-master\api> nodemon index.js [nodemon] 1.19.1 [nodemon] to restart at any time, enter `rs` [nodemon] watching: *.* [nodemon] starting `node index.js src/index.js` C:\Users\grand-stack-starter-master\api\src\index.js:1 import { typeDefs } from "./graphql-schema"; ^ SyntaxError: Unexpected token { at Module._compile (internal/modules/cjs/loader.js

setTimeout not working with random delay

为君一笑 提交于 2021-02-10 16:58:08
问题 Beginning with node.js, I try to invoke a function after a random amount of time. Why does this not work : function main() { console.log('*** START ***'); } function blink() { console.log('*** BLINK ***'); } main(); var delay = Number(Math.random(1000, 10000)); setTimeout(blink, delay); If I replace the random generated number with a static one, it works : function main() { console.log('*** START ***'); } function blink() { console.log('*** BLINK ***'); } main(); setTimeout(blink, 3000);