discord

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

本秂侑毒 提交于 2020-11-29 19:21:18
问题 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:06:20
问题 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

Discord.py welcome bot on_member_join event not getting callded

强颜欢笑 提交于 2020-11-25 03:56:25
问题 I've been interested in working with discord bots lately, and from what I'm seeing this code should work but it is not... I'm simply just playing around with the API because it's fun so I'm pretty new with this. I just want the bot to welcome someone when they join. import discord client = discord.Client() @client.event async def on_ready(): print('We have logged in as {0.user}'.format(client)) channel = client.guilds[0].get_channel(CHANNEL ID) await channel.send("Bot online") @client.event