discord

Cannot read property 'send' of underfined

天涯浪子 提交于 2020-11-30 00:23:01
问题 const mudaeon = require('./mudaetime.json'); const cron = require('cron'); const Discord = require('discord.js'); const client = new Discord.Client(); module.exports = { name: 'mudaetime', description: '...', execute(message, args) { if (mudaeon) { const channel = client.channels.cache.get('id'); let scheduledMessage = new cron.CronJob( '* * * * *', () => { scheduledMessage.start(); }, message.react('✅'), channel.send('check $tu ! <@&id') ); } else !mudaeon; { cancel(); } }, }; Please help

Cannot read property 'send' of underfined

房东的猫 提交于 2020-11-30 00:22:20
问题 const mudaeon = require('./mudaetime.json'); const cron = require('cron'); const Discord = require('discord.js'); const client = new Discord.Client(); module.exports = { name: 'mudaetime', description: '...', execute(message, args) { if (mudaeon) { const channel = client.channels.cache.get('id'); let scheduledMessage = new cron.CronJob( '* * * * *', () => { scheduledMessage.start(); }, message.react('✅'), channel.send('check $tu ! <@&id') ); } else !mudaeon; { cancel(); } }, }; Please help

Cannot read property 'send' of underfined

陌路散爱 提交于 2020-11-30 00:22:12
问题 const mudaeon = require('./mudaetime.json'); const cron = require('cron'); const Discord = require('discord.js'); const client = new Discord.Client(); module.exports = { name: 'mudaetime', description: '...', execute(message, args) { if (mudaeon) { const channel = client.channels.cache.get('id'); let scheduledMessage = new cron.CronJob( '* * * * *', () => { scheduledMessage.start(); }, message.react('✅'), channel.send('check $tu ! <@&id') ); } else !mudaeon; { cancel(); } }, }; Please help

Cannot read property 'send' of underfined

强颜欢笑 提交于 2020-11-30 00:21:16
问题 const mudaeon = require('./mudaetime.json'); const cron = require('cron'); const Discord = require('discord.js'); const client = new Discord.Client(); module.exports = { name: 'mudaetime', description: '...', execute(message, args) { if (mudaeon) { const channel = client.channels.cache.get('id'); let scheduledMessage = new cron.CronJob( '* * * * *', () => { scheduledMessage.start(); }, message.react('✅'), channel.send('check $tu ! <@&id') ); } else !mudaeon; { cancel(); } }, }; Please help

Cannot read property 'send' of underfined

那年仲夏 提交于 2020-11-30 00:21:00
问题 const mudaeon = require('./mudaetime.json'); const cron = require('cron'); const Discord = require('discord.js'); const client = new Discord.Client(); module.exports = { name: 'mudaetime', description: '...', execute(message, args) { if (mudaeon) { const channel = client.channels.cache.get('id'); let scheduledMessage = new cron.CronJob( '* * * * *', () => { scheduledMessage.start(); }, message.react('✅'), channel.send('check $tu ! <@&id') ); } else !mudaeon; { cancel(); } }, }; Please help

Online User count from a Discord Role

笑着哭i 提交于 2020-11-29 21:24:35
问题 I want my Discord Bot to display the Number of Online Users of a Role as an Activity. I can't seem to figure it out and i can't find anything on the Web. Can someone give me example code or explain it to me? 回答1: You can use Guild.members.forEach() to loop through every member of the guild, then if they have that role (you can use GuildMember.roles.has(Role.id) to check that) increase a counter. When you have finished your loop through the members, use the counter in your Client.user

Online User count from a Discord Role

梦想的初衷 提交于 2020-11-29 21:10:50
问题 I want my Discord Bot to display the Number of Online Users of a Role as an Activity. I can't seem to figure it out and i can't find anything on the Web. Can someone give me example code or explain it to me? 回答1: You can use Guild.members.forEach() to loop through every member of the guild, then if they have that role (you can use GuildMember.roles.has(Role.id) to check that) increase a counter. When you have finished your loop through the members, use the counter in your Client.user

Online User count from a Discord Role

半城伤御伤魂 提交于 2020-11-29 21:10:47
问题 I want my Discord Bot to display the Number of Online Users of a Role as an Activity. I can't seem to figure it out and i can't find anything on the Web. Can someone give me example code or explain it to me? 回答1: You can use Guild.members.forEach() to loop through every member of the guild, then if they have that role (you can use GuildMember.roles.has(Role.id) to check that) increase a counter. When you have finished your loop through the members, use the counter in your Client.user

ClientConnectorError: Cannot connect to host discordapp.com:443 ssl:default [Connect call failed ('162.159.134.233', 443)]

我们两清 提交于 2020-11-29 19:25:59
问题 So I was trying out making a bot in Discord and I tried running my discord bot over Gitpod and it was able to run, but when I tried running it on pythonanywhere.com, I get this error: aiohttp.client_exceptions.ClientConnectorError: Cannot connect to host discordapp.com:443 ssl:default [Connect call failed ('162.159.134.233', 443)] Here is a snippet of my code: import discord from discord.ext import commands import json with open("credentials.json") as creds: creds = json.loads(creds.read())

Getting number of members and servers a bot is serving

若如初见. 提交于 2020-11-29 19:21:36
问题 So I went through the discord.js guide, and found that client.guilds.size and client.users.size is for finding no of users and servers a bot is on. But when I implement it I get "undefined". Any reason why? 回答1: Try client.guilds.cache.size and client.users.cache.size . This changed in discord.js v12. client.users has been changed from a Collection to a Manager. client.guilds has been changed from a Collection to a Manager. 回答2: You can use client.guilds.cache.size which will return the