├── config ├── prefixes.json └── colors.py ├── README.md ├── requirements.txt ├── Procfile ├── cogs ├── fun.py ├── general.py ├── util.py ├── admin.py └── anime.py ├── LICENSE └── bot.py /config/prefixes.json: -------------------------------------------------------------------------------- 1 | {} 2 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # killua 2 | Killua Bot Python 3 | -------------------------------------------------------------------------------- /requirements.txt: -------------------------------------------------------------------------------- 1 | discord 2 | jishaku 3 | discord.py 4 | requests 5 | jikanpy 6 | datetime 7 | 8 | -------------------------------------------------------------------------------- /Procfile: -------------------------------------------------------------------------------- 1 | worker: pip install -r requirements.txt && python -m pip install -U git+https://github.com/Rapptz/discord-ext-menus && python bot.py -------------------------------------------------------------------------------- /cogs/fun.py: -------------------------------------------------------------------------------- 1 | import discord 2 | from discord.ext import commands 3 | from requests import get 4 | 5 | class Fun(commands.Cog): 6 | def __init__(self, bot): 7 | self.bot = bot 8 | 9 | @commands.command(name="8ball", aliases=["8b"]) 10 | async def _8ball(self, ctx, *, question): 11 | answer = get(url="https://nekos.life/api/v2/8ball").json() 12 | await ctx.send("> %s\n%s %s" %(question, ctx.author.mention, answer["response"])) 13 | 14 | 15 | 16 | def setup(bot): 17 | bot.add_cog(Fun(bot)) -------------------------------------------------------------------------------- /config/colors.py: -------------------------------------------------------------------------------- 1 | colors = { 2 | "WHITE": 0xFFFFFF, 3 | "AQUA": 0x1ABC9C, 4 | "GREEN": 0x2ECC71, 5 | "BLUE": 0x3498DB, 6 | "PURPLE": 0x9B59B6, 7 | "LUMINOUS_VIVID_PINK": 0xE91E63, 8 | "GOLD": 0xF1C40F, 9 | "ORANGE": 0xE67E22, 10 | "RED": 0xE74C3C, 11 | "NAVY": 0x34495E, 12 | "DARK_AQUA": 0x11806A, 13 | "DARK_GREEN": 0x1F8B4C, 14 | "DARK_BLUE": 0x206694, 15 | "DARK_PURPLE": 0x71368A, 16 | "DARK_VIVID_PINK": 0xAD1457, 17 | "DARK_GOLD": 0xC27C0E, 18 | "DARK_ORANGE": 0xA84300, 19 | "DARK_RED": 0x992D22, 20 | "DARK_NAVY": 0x2C3E50, 21 | } 22 | 23 | color = [c for c in colors.values()] 24 | -------------------------------------------------------------------------------- /cogs/general.py: -------------------------------------------------------------------------------- 1 | import discord 2 | from discord.ext import commands 3 | 4 | class General(commands.Cog): 5 | def __init__(self, bot): 6 | self.bot = bot 7 | 8 | @commands.command(name="ping") 9 | async def ping(self, ctx): 10 | await ctx.send(f'Pong! {round(self.bot.latency*1000)}ms') 11 | 12 | @commands.command(name='avatar', aliases=["ava", "pfp", "av"], description="Get user avatar", usage="[@member]") 13 | async def ava(self, ctx): 14 | member = ctx.message.mentions[0] 15 | if not member: 16 | member = ctx.message.author 17 | embed = discord.Embed(title=f"{member.name}#{member.discriminator} Avatar", colour=0x37e666) 18 | embed.set_image(url=member.avatar_url) 19 | await ctx.send(embed=embed) 20 | 21 | 22 | 23 | def setup(bot): 24 | bot.add_cog(General(bot)) -------------------------------------------------------------------------------- /cogs/util.py: -------------------------------------------------------------------------------- 1 | import discord 2 | from discord.ext import commands 3 | from discord import Embed 4 | from requests import get 5 | import random 6 | 7 | 8 | class Util(commands.Cog): 9 | def __init__(self,bot): 10 | self.bot = bot 11 | 12 | @commands.command(name="npm") 13 | async def npm(self, ctx, *, npm): 14 | res = get("https://registry.npmjs.com/%s" %(npm)).json() 15 | name = res["name"] 16 | desc = res["description"] 17 | author = res["author"]["name"] 18 | url = res["homepage"] 19 | 20 | embed = Embed( 21 | title=name, 22 | color=random.choice(self.bot.color), 23 | description=desc, 24 | url=url 25 | ) 26 | embed.add_field(name="Name: ", value=name, inline=False) 27 | embed.add_field(name="Author: ", value=author, inline=False) 28 | await ctx.send(embed=embed) 29 | 30 | def setup(bot): 31 | bot.add_cog(Util(bot)) 32 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2020 Fabian maulana 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /cogs/admin.py: -------------------------------------------------------------------------------- 1 | import discord 2 | from discord.ext import commands 3 | from asyncio import sleep 4 | import json 5 | 6 | class Admin(commands.Cog): 7 | def __init__(self, bot): 8 | self.bot = bot 9 | 10 | @commands.command(name="clear", aliases=["cl", 'purge']) 11 | @commands.has_permissions(administrator=True) 12 | async def clear(self, ctx, *, amount): 13 | if not amount: 14 | return await ctx.send("Give me amount") 15 | await ctx.channel.purge(limit=int(amount)) 16 | msg = await ctx.send(f" Cleared {amount} Messages") 17 | await sleep(5.0) 18 | await msg.delete() 19 | 20 | @commands.command(name="prefix", aliases=["ch", "changeprefix"]) 21 | @commands.has_permissions(administrator=True) 22 | async def prefix(self, ctx, *, prefix): 23 | with open("../config/prefixes.json", "r") as f: 24 | data = json.load(f) 25 | 26 | data[str(ctx.guild.id)] = prefix 27 | 28 | with open("../config/prefixes.json", "w") as f: 29 | json.dump(data, f, indent=4) 30 | 31 | await ctx.send("Prefix set to `%s`" %(Prefix)) 32 | 33 | def setup(bot): 34 | bot.add_cog(Admin(bot)) 35 | -------------------------------------------------------------------------------- /cogs/anime.py: -------------------------------------------------------------------------------- 1 | import discord 2 | from discord.ext import commands 3 | from jikanpy import Jikan 4 | from discord import Embed 5 | 6 | jikan = Jikan() 7 | 8 | class Anime(commands.Cog): 9 | def __init__(self, bot): 10 | self.bot = bot 11 | 12 | @commands.command(name="anime", aliases=["searchanime"]) 13 | async def anime(self, ctx, *, anime): 14 | anime = jikan.search("anime", str(anime), page=1) 15 | result = anime["results"][0] 16 | title = result["title"] 17 | image = result["image_url"] 18 | desc = result["synopsis"] 19 | episodes = result["episodes"] 20 | rate = result["score"] 21 | created = result["start_date"] 22 | status = result["end_date"] 23 | 24 | star = ":star:"*round(rate) 25 | 26 | if status: 27 | status = "ended" 28 | else: 29 | status = "ongoing" 30 | embed = Embed( 31 | title=title, 32 | description=desc, 33 | colour=0x03fc35 34 | ) 35 | embed.add_field(name="Title: ", value=title, inline=False) 36 | embed.add_field(name="Rate: ", value=f'{star}/{rate}', inline=False) 37 | embed.add_field(name="Status: ", value=status) 38 | if status == "ended": 39 | embed.add_field(name="Episodes: ", value=episodes) 40 | embed.set_thumbnail(url=image) 41 | 42 | await ctx.send(embed=embed) 43 | 44 | def setup(bot): 45 | bot.add_cog(Anime(bot)) -------------------------------------------------------------------------------- /bot.py: -------------------------------------------------------------------------------- 1 | import discord 2 | from discord.ext import commands 3 | import os 4 | import jishaku 5 | import json 6 | from config.colors import color, colors 7 | 8 | async def get_prefix(bot, msg): 9 | with open("./config/prefixes.json", "r") as f: 10 | prefixes = json.load(f) 11 | return prefixes[str(msg.guild.id)] 12 | 13 | 14 | bot = commands.AutoShardedBot( 15 | command_prefix="k!", 16 | shard_count=5, 17 | owner_ids=[681843628317868049, 593774699654283265] 18 | ) 19 | 20 | bot.colors = colors 21 | bot.color = color 22 | 23 | bot.load_extension("jishaku") 24 | 25 | @bot.command(name="hello") 26 | async def hello(ctx): 27 | await ctx.send("Hello"); 28 | 29 | @bot.event 30 | async def on_ready(): 31 | print('Logged in as') 32 | print(bot.user.name) 33 | print(bot.user.id) 34 | print('------') 35 | 36 | @bot.event 37 | async def on_guild_join(guild): 38 | with open("./config/prefixes.json", "r") as f: 39 | prefixes = json.load(f) 40 | 41 | prefixes[str(guild.id)] = "k!" 42 | 43 | with open("./config/prefixes.json", "w") as f: 44 | json.dump(prefixes, f, indent=4) 45 | 46 | 47 | @bot.event 48 | async def on_guild_remove(guild): 49 | with open("./config/prefixes.json", "r") as f: 50 | prefixes = json.load(f) 51 | 52 | prefixes.pop(str(guild.id)) 53 | 54 | with open("./config/prefixes.json", "w") as f: 55 | json.dump(prefixes, f, indent=4) 56 | 57 | 58 | for name in os.listdir('./cogs'): 59 | if name.endswith('.py'): 60 | bot.load_extension(f'cogs.{name[:-3]}') 61 | 62 | bot.run(os.environ["SECRET"]) 63 | --------------------------------------------------------------------------------