Issue
I can't increase the value of the Int pinggoals which is inside my config.py.
import discord
from discord.ext import commands
from config import *
import asyncio
@client.event
async def on_message(message):
if '*ping' in message.content:
await message.channel.send('🏓 Pong! \r Bot / ' + str(ponggoals) + ' : 0 \\ Users')
pinggoals += 1
my config.py is just pinggoals = 1
Solution
You will have to declare the variable outside of the if
statement. Something like this should work:
from discord.ext import commands
from config import *
import asyncio
@client.event
async def on_message(message):
pinggoals = 0 # You can't increase a non-number, change this to whatever you want
if '*ping' in message.content:
await message.channel.send('🏓 Pong! \r Bot / ' + str(ponggoals) + ' : 0 \\ Users')
pinggoals += 1
The reason I don't think having global pinggoals
will work, is because pinggoals is not set to an integer, and you can't add one to nothing.
Answered By - RogerFederer2006
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.