Okay I'm making a python Discord Bot using Discord python API. I'm trying to compare the message after they message the command ?event_add {message/event they want to add} to current list of events. If the message matches the current list of events the bot would return with a message saying that we already have the event. My problem is that the string does not want to compare with the list and always returns back that it does not match.
OS : Windows 10 Creators Update
Python : 3.6.2
Discord.py : https://discordpy.readthedocs.io/en/latest/, GitHub : https://github.com/Rapptz/discord.py
Code:
import discord
from discord.ext import commands
import logging
import sys
import time
import asyncio
bot = commands.Bot(command_prefix="/")
console = discord.Object("357208549614419970")
events = {"learn to bake"}
@bot.event
async def on_ready():
print("Logged in as: ")
print(bot.user.id)
print(bot.user.name)
print("******************")
@bot.command(pass_context = True)
async def test(ctx):
await bot.say("Testing...... Am I a real boy yet?")
events = ['drawn out a dragon, and do a hand stand']
await bot.say(events)
@bot.command(pass_context = True)
async def add_event(ctx, event):
if event in events:
await bot.say("Sorry we already have that, also we need to teach %s
to read. Add that to the list please." % ctx.message.author.mention)
else:
await bot.say("Something is broken %s" % ctx.message.author.mention)