-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdiscordbot.py
76 lines (59 loc) · 2.31 KB
/
discordbot.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
import discord
from discord.ext import commands
import requests
from bs4 import BeautifulSoup
client = discord.Client()
@client.event
async def on_ready():
await client.change_presence(status=discord.Status.idle, activity=discord.Game('리그순위 확인 '))
print('Logged in as')
print(client.user.name)
print(client.user.id)
print('------')
@client.event
async def on_message(message):
if message.content.startswith('!프리미어리그순위'):
a = ''
source = requests.get(
"https://sports.news.naver.com/wfootball/index.nhn").text
soup = BeautifulSoup(source, "html.parser")
result = soup.find('div', id='_team_rank_epl')
i = 1
for key in result.select('span.name'):
a = a + str(i) + "위: " + key.get_text() + "\n"
i = i + 1
await message.channel.send(a)
if message.content.startswith('!분데스리가순위'):
a = ''
source = requests.get(
"https://sports.news.naver.com/wfootball/index.nhn").text
soup = BeautifulSoup(source, "html.parser")
result = soup.find('div', id='_team_rank_bundesliga')
i = 1
for key in result.select('span.name'):
a = a + str(i) + "위: " + key.get_text() + "\n"
i = i + 1
await message.channel.send(a)
if message.content.startswith('!라리가순위'):
a = ''
source = requests.get(
"https://sports.news.naver.com/wfootball/index.nhn").text
soup = BeautifulSoup(source, "html.parser")
result = soup.find('div', id='_team_rank_primera')
i = 1
for key in result.select('span.name'):
a = a + str(i) + "위: " + key.get_text() + "\n"
i = i + 1
await message.channel.send(a)
if message.content.startswith('!세리에A순위'):
a = ''
source = requests.get(
"https://sports.news.naver.com/wfootball/index.nhn").text
soup = BeautifulSoup(source, "html.parser")
result = soup.find('div', id='_team_rank_seria')
i = 1
for key in result.select('span.name'):
a = a + str(i) + "위: " + key.get_text() + "\n"
i = i + 1
await message.channel.send(a)
client.run('Nzg1MDMzNzAyNjE0NjMwNDQx.X8x9mw.wHsz9Uz0yxaYxEcDaywsGC6fJ_M')