-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
73 lines (48 loc) · 2.04 KB
/
main.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
import discord
import time
from discord.ext import commands
import io
import aiohttp
from config import *
from discord_slash import SlashCommand, SlashContext
bot = commands.Bot(command_prefix='!') #sets the prefix
slash = SlashCommand(bot,sync_commands=True)
@slash.slash(name='test',description= "just tests the bot, nothing much")
async def test(ctx):
await ctx.reply('hello')
@bot.command()
async def vore(ctx):
await ctx.reply("*you nom your tail accidently*")
@bot.command()
async def cat(ctx):
async with aiohttp.ClientSession() as session:
async with session.get("https://cataas.com/cat") as resp:
if resp.status != 200:
return await ctx.send('error getting file')
data = io.BytesIO(await resp.read())
await ctx.reply(file=discord.File(data, "cat.png" ))
@bot.command()
async def dog(ctx):
async with aiohttp.ClientSession() as session:
async with session.get("https://placedog.net/640/480?random") as resp:
if resp.status != 200:
return await ctx.send('error getting file')
data = io.BytesIO(await resp.read())
await ctx.reply(file=discord.File(data, "480.png" ))
@slash.slash(name='doggo',description='gives a random cute dog picture')
async def dog(ctx):
async with aiohttp.ClientSession() as session:
async with session.get("https://placedog.net/640/480?random") as resp:
if resp.status != 200:
return await ctx.send('error getting file')
data = io.BytesIO(await resp.read())
await ctx.reply(file=discord.File(data, "480.png" ))
@slash.slash(name='kitten',description='gives a random cute kitten picture')
async def cat(ctx):
async with aiohttp.ClientSession() as session:
async with session.get("https://cataas.com/cat") as resp:
if resp.status != 200:
return await ctx.send('error getting file')
data = io.BytesIO(await resp.read())
await ctx.reply(file=discord.File(data, "cat.png" ))
bot.run(TOKEN) #this is set on the config.py file