-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbot.py
56 lines (41 loc) · 1.46 KB
/
bot.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
import discord
from discord.ext import commands
from googleapiclient.discovery import build
youtube=build('youtube','v3',developerKey='')
client=commands.Bot(command_prefix = ">")
@client.event
async def on_ready():
print("Let's kick ass")
@client.event
async def on_message(message):
if message.content.startswith('>ytstat') :
chl=message.content[8:len(message.content):1]
request=youtube.channels().list(part="statistics", forUsername=chl)
response=request.execute()
viewers=response['items'][0]['statistics']['viewCount'] + ' viewers'
subscribers=response['items'][0]['statistics']['subscriberCount'] + ' subscribers'
videos=response['items'][0]['statistics']['videoCount'] + ' videos'
await message.channel.send(chl)
await message.channel.send(viewers)
await message.channel.send(subscribers)
await message.channel.send(videos)
#await message.channel.send(message.content)
@client.command()
async def hello(ctx):
await ctx.send("hi")
@client.command()
async def thanks(ctx):
await ctx.send("Welcome")
@client.command()
async def arigato(ctx):
await ctx.send("Do itashimashite")
@client.command(aliases=["mb","maari boys"])
async def maariboys(ctx):
await ctx.send("World's Greatest")
@client.command()
async def clear(ctx, amount=1):
await ctx.channel.purge(limit=amount)
@client.command()
async def ping(ctx):
await ctx.send(f"Bot latency: {client.latency*1000} ms")
client.run("")