I’m trying to make a discord bot that will publish my public IP address on a command. Almost everything is working, but the IP address returns a NoneType
. I have been using a library called publicip
to get the IP address.
import discord
import publicip
client = discord.Client()
@client.event
async def on_ready():
print(publicip.get())
@client.event
async def on_message(message):
if message.author == client.user:
return
if message.content.startswith('$ip?'):
ip = str(publicip.get())
await message.channel.send("The server ip is " + ip)
client.run('')