File tree Expand file tree Collapse file tree 4 files changed +42
-2
lines changed Expand file tree Collapse file tree 4 files changed +42
-2
lines changed Original file line number Diff line number Diff line change @@ -96,12 +96,13 @@ async def on_ready():
9696 teapot .cogs .osu .setup (bot )
9797 teapot .cogs .github .setup (bot )
9898 teapot .cogs .cat .setup (bot )
99+ teapot .cogs .eightball .setup (bot )
99100 teapot .cogs .neko .setup (bot )
100101 if teapot .config .storage_type () == "mysql" :
101102 for guild in bot .guilds :
102103 teapot .managers .database .create_guild_table (guild )
103104 elif teapot .config .storage_type () == "sqlite" :
104- print ("[!] Warning: SQLite storage has not been implemented yet. MySQL database is recommended" ) # WIP
105+ print ("[!] Warning: SQLite storage has not been implemented yet. MySQL is recommended" ) # WIP
105106 print (f"Registered commands and events in { round (time .perf_counter () - time_start , 2 )} s" )
106107 await bot .change_presence (status = discord .Status .online ,
107108 activity = discord .Game (teapot .config .bot_status ())) # Update Bot status
Original file line number Diff line number Diff line change 88
99
1010def version ():
11- return "v0.0.1.6 "
11+ return "v0.0.1.7 "
1212
1313
1414def config_version ():
Original file line number Diff line number Diff line change 11from .cat import *
22from .cmds import *
3+ from .eightball import *
34from .github import *
45from .music import *
56from .neko import *
Original file line number Diff line number Diff line change 1+ """ Module for generating random neko pictures"""
2+ import io
3+ import json
4+
5+ import aiohttp
6+ import discord
7+ import requests
8+ from discord .ext import commands
9+
10+ import teapot
11+ import teapot .tools .embed as dmbd
12+
13+
14+ class EightBall (commands .Cog ):
15+ """8 Ball"""
16+
17+ def __init__ (self , bot ):
18+ """ Initialize 8ball class"""
19+ self .bot = bot
20+
21+ def eightball_api (self , ctx ):
22+ try :
23+ req = requests .get (f'https://nekos.life/api/v2/8ball/{ x } ' )
24+ if req .status_code != 200 :
25+ print ("Could not get a response" )
26+ apijson = json .loads (req .text )
27+ em = dmbd .newembed ().set_image (url = apijson ["url" ])
28+ return em
29+ except :
30+ return teapot .messages .error (f"obtaining 8ball image ({ req .status_code } )" )
31+
32+ @commands .command (pass_context = True )
33+ async def eightball (self , ctx ):
34+ await ctx .send (embed = self .eightball_api (ctx ))
35+
36+ def setup (bot ):
37+ """ Setup Eight Ball Module"""
38+ bot .add_cog (EightBall (bot ))
You can’t perform that action at this time.
0 commit comments