-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbot.py
More file actions
38 lines (31 loc) · 993 Bytes
/
bot.py
File metadata and controls
38 lines (31 loc) · 993 Bytes
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
import discord
from discord.ext import commands
from scrapper import advscrape
from scrapper import scrape
client = commands.Bot(command_prefix= '!')
@client.event
async def on_ready():
await client.change_presence(status= discord.Status.online, activity=discord.Game('Hello there!'))
print("Bot is ready.")
@client.command()
async def ping(ctx):
await ctx.send(f'Pong!{round(client.latency *1000)}ms')
@client.command()
async def clear(ctx, amount =5):
await ctx.channel.purge(limit = amount)
@client.command()
async def search(ctx, *message):
query = (" ").join(message)
print(message)
URL = "https://www.google.com/search?q=" + query
item, link = scrape(URL)
await ctx.send(item.text)
await ctx.send(link)
@client.command()
async def advsearch(ctx, *message):
query = (" ").join(message)
print(message)
URL = "https://www.google.com/search?q=" + query
item = advscrape(URL)
await ctx.send(item.text)
client.run('TOKEN')