This is the full code
import discord
import os
import requests
from bs4 import BeautifulSoup
import lxml
client = discord.Client()
class GameCheck:
def __init__(self, name):
source = requests.get(f"https://www.11v11.com/teams/arsenal/tab/opposingTeams/opposition/{name}")
soup = BeautifulSoup(source.text, 'lxml')
games = soup.find_all(class_="result-status")
allgames = []
for game in games:
allgames.append(game.text)
self.last5 = allgames[-5:]
@client.event
async def on_ready():
print('We have logged in as {0.user}'.format(client))
@client.event
async def on_message(message):
if message.author == client.user:
return
if message.content.startswith('!history'):
team = message.content
ars = GameCheck(team)
await message.channel.send(f"`Our last 5 games with this club: {ars.last5}`")
client.run("Token")
My problem is at
if message.content.startswith('!history'):
team = message.content
ars = GameCheck(team)
await message.channel.send(f"`Our last 5 games with this club: {ars.last5}`")
I want to split the discord message that starts with !history for example "!history Leicester City/" put "Leicester City/" inside the variable team, and then run GameCheck on it. When I run this code it does not give me an error but it keeps giving me the same output no matter what "team" i put in.