-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
9e46e7b
commit 719ee77
Showing
7 changed files
with
262 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,5 @@ | ||
.idea/ | ||
.env | ||
nextcord/venv | ||
discord/venv | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,209 @@ | ||
import json | ||
import os | ||
import requests | ||
import random | ||
import nekos_fun | ||
import discord | ||
from discord.ext import commands | ||
from discord import app_commands | ||
from typing import Optional, Literal | ||
|
||
|
||
class Bot(discord.Client): | ||
def __init__(self, *, intents: discord.Intents): | ||
super().__init__(intents=intents) | ||
self.tree = app_commands.CommandTree(self) | ||
async def setup_hook(self): | ||
await self.tree.sync() | ||
|
||
|
||
intents=discord.Intents(messages = True, members = True, typing = True, guilds = True) | ||
bot = Bot(intents=intents) | ||
game = discord.Game("Naughty") | ||
|
||
token = os.environ["TOKEN"] | ||
|
||
@bot.event | ||
async def on_ready(): | ||
print(bot.user.name) | ||
await bot.change_presence(status=discord.Status.idle, activity=game) | ||
|
||
|
||
@bot.tree.command(description="Shows the help menu", nsfw=True) | ||
async def help(ctx:discord.Interaction): | ||
await ctx.response.defer() | ||
ret = "```\n" | ||
ret += "gelbooru [tags]\n" | ||
ret += "Get image/video from Gelbooru.\n" | ||
ret += "yandere [tags]\n" | ||
ret += "Get image from Yandere.\n" | ||
ret += "konachan [tags]\n" | ||
ret += "Get image from Konachan.\n" | ||
ret += "danbooru [tags]\n" | ||
ret += "Get image from danbooru.\n" | ||
ret += "nekolewd\n" | ||
ret += "Get lewded nekos from NekoLove.\n" | ||
ret += "nekosfun\n" | ||
ret += "Get images/gifs from NekosLife.\n" | ||
ret += "```" | ||
await ctx.followup.send(ret) | ||
|
||
@bot.tree.command(description="Get hentai from Gelbooru", nsfw=True) | ||
@app_commands.describe(tag="Add a tag") | ||
async def gelbooru(ctx:discord.Interaction, tag:Optional[str]=None)->None: | ||
await ctx.response.defer() | ||
formated_tag = tag.replace(" ", "_") | ||
if tag == None: | ||
api="https://gelbooru.com/index.php?page=dapi&s=post&q=index&json=1&limit=100&tags=rating:explicit+-loli+-shota+-cub" | ||
response = requests.get(api) | ||
ret = json.loads(response.text) | ||
post = random.choice(ret["post"]) | ||
else: | ||
api="https://gelbooru.com/index.php?page=dapi&s=post&q=index&json=1&limit=100&tags=rating:explicit+-loli+-shota+-cub" + formated_tag | ||
response = requests.get(api) | ||
ret = json.loads(response.text) | ||
post = random.choice(ret["post"]) | ||
source = post["source"] | ||
owner = post["owner"] | ||
score = post["score"] | ||
image:str=post["file_url"] | ||
created_at=post["created_at"] | ||
if image.endswith(".mp4"): | ||
await ctx.followup.send(image) | ||
else: | ||
embed = discord.Embed(title="Created by {}".format(owner)) | ||
embed.add_field(name="Source", value="[Click here]({})".format(source), inline=True) | ||
embed.add_field(name="Score", value=score, inline=True) | ||
embed.set_image(url=image) | ||
embed.set_footer(text="Fetched from Gelbooru\nCreated at {}".format(created_at)) | ||
await ctx.followup.send(embed=embed) | ||
|
||
|
||
@bot.tree.command(description="Get hentai from Yandere", nsfw=True) | ||
@app_commands.describe(tag="Add a tag") | ||
async def yandere(ctx: discord.Interaction, tag:Optional[str]=None)->None: | ||
await ctx.response.defer() | ||
if tag == None: | ||
ret = random.choice(requests.get( | ||
"https://yande.re/post.json?limit=100&tags=rating:explicit+-loli+-shota+-cub").json()) | ||
else: | ||
tag = tag.replace(" ", "_") | ||
ret = random.choice(requests.get( | ||
"https://yande.re/post.json?limit=100&tags=rating:explicit+-loli+-shota+-cub" + tag).json()) | ||
created_at = ret["created_at"] | ||
file=ret["file_url"] | ||
author=ret["author"] | ||
source=ret["source"] | ||
score=ret["score"] | ||
embed = discord.Embed(title="Created by {}".format(author)) | ||
embed.add_field(name="Source", value="[Click here]({})".format(source), inline=True) | ||
embed.add_field(name="Score", value=score, inline=True) | ||
embed.set_image(url=file) | ||
embed.set_footer(text="Fetched from Yande.re\nCreated at {}".format(created_at)) | ||
await ctx.followup.send(embed=embed) | ||
|
||
|
||
@bot.tree.command(description="Get hentai from Konachan", nsfw=True) | ||
@app_commands.describe(tag="Add a tag") | ||
async def konachan(ctx:discord.Interaction, tag:Optional[str]=None)->None: | ||
await ctx.response.defer() | ||
if tag == None: | ||
ret = random.choice(requests.get("https://konachan.com/post.json?s=post&q=index&limit=100&tags=rating:explicit+-loli+-shota+-cub").json()) | ||
|
||
else: | ||
tag = tag.replace(" ", "_") | ||
ret = random.choice(requests.get(f"https://konachan.com/post.json?s=post&q=index&limit=100&tags=rating:explicit+-loli+-shota+-cub" + tag).json()) | ||
|
||
created_at = ret["created_at"] | ||
file = ret["file_url"] | ||
author = ret["author"] | ||
source = ret["source"] | ||
score = ret["score"] | ||
embed = discord.Embed(title="Created by {}".format(author)) | ||
embed.add_field( | ||
name="Source", value="[Click here]({})".format(source), inline=True) | ||
embed.add_field(name="Score", value=score, inline=True) | ||
embed.set_image(url=file) | ||
embed.set_footer( | ||
text="Fetched from Konachan\nCreated at {}".format(created_at)) | ||
await ctx.followup.send(embed=embed) | ||
|
||
|
||
@bot.tree.command(description="Get hentai from Danbooru", nsfw=True) | ||
@app_commands.describe(tag="Add a tag") | ||
async def danbooru(ctx: discord.Interaction, tag:Optional[str]=None)->None: | ||
await ctx.response.defer() | ||
if tag == None: | ||
ret = random.choice(requests.get( | ||
"https://danbooru.donmai.us/posts.json?limit=100&tags=rating:explicit-loli-shota-cub").json()) | ||
|
||
else: | ||
tag = tag.replace(" ", "_") | ||
ret = random.choice(requests.get( | ||
"https://danbooru.donmai.us/posts.json?limit=100&tags=rating:explicit-loli-shota-cub" + tag).json()) | ||
|
||
created_at = ret["created_at"] | ||
file = ret["file_url"] | ||
author = ret["tag_string_artist"] | ||
source = ret["source"] | ||
score = ret["score"] | ||
embed = discord.Embed(title="Created by {}".format(author)) | ||
embed.add_field( | ||
name="Source", value="[Click here]({})".format(source), inline=True) | ||
embed.add_field(name="Score", value=score, inline=True) | ||
embed.set_image(url=file) | ||
embed.set_footer( | ||
text="Fetched from Danbooru\nCreated at {}".format(created_at)) | ||
await ctx.followup.send(embed=embed) | ||
|
||
|
||
@bot.tree.command(description="Get lewded nekos from NekoLove", nsfw=True) | ||
async def nekolewd(ctx:discord.Interaction): | ||
await ctx.response.defer() | ||
ret = requests.get("https://neko-love.xyz/api/v1/nekolewd").json() | ||
response=ret["code"] | ||
image=ret["url"] | ||
|
||
if response !=200: | ||
embed = discord.Embed(description="Error with API!\nPlease contact the neko-love.xyz team. If the fault is not on their side, please reach up to me") | ||
await ctx.followup.send(embed=embed) | ||
else: | ||
embed = discord.Embed() | ||
embed.set_image(url=image) | ||
embed.set_footer( | ||
text="Fetched from NekoLove") | ||
await ctx.followup.send(embed=embed) | ||
|
||
|
||
@bot.tree.command(description="Get an image/gif from NekosLife", nsfw=True) | ||
@app_commands.describe(tag="Which tag?") | ||
async def nekosfun(ctx:discord.Interaction, tag:Optional[Literal["ass", "bj", "boobs", "cum", "hentai", "spank", "gasm", "lesbian", "pussy"]]): | ||
if tag == None: | ||
tags = ["ass", "bj", "boobs", "cum", "hentai", | ||
"spank", "gasm", "lesbian", "pussy"] | ||
image = nekos_fun.nekofun(random.choice(tags)) | ||
|
||
else: | ||
image = nekos_fun.nekofun(str(tag)) | ||
|
||
if image != 200: | ||
await ctx.followup.send(image) | ||
else: | ||
embed = discord.Embed() | ||
embed.set_image(url=image) | ||
embed.set_footer( | ||
text="Fetched from Nekos.Fun") | ||
await ctx.followup.send(embed=embed) | ||
|
||
@bot.tree.command(description="Ask a member if you can f*ck them") | ||
@app_commands.describe(member="Which member?") | ||
async def f_ck(ctx:discord.Integration, member:Member) | ||
|
||
@bot.event | ||
async def on_application_command_error(ctx:discord.Interaction, error:app_commands.AppCommandError): | ||
if isinstance(error, KeyError): | ||
embed = discord.Embed(title="Hentai Failed", description="Hentai couldn't be sent in this channel", | ||
color=0xff0000).add_field(name="Reason", value="Tag not found") | ||
await ctx.followup.send(embed=embed) | ||
|
||
bot.run(token) |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import os | ||
import platform | ||
|
||
pip_install = 'pip install -U pip' | ||
packages = 'pip install -U discord requests' | ||
|
||
if platform.system == 'Windows': # if OS is Windows | ||
os.system('python.exe -m' + pip_install) | ||
|
||
elif platform.system=='Linux': # if OS is Linux | ||
os.system('python3 -m' + pip_install) | ||
|
||
os.system(packages) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import requests | ||
|
||
|
||
def nekofun(endpoint:str): | ||
r = requests.get("http://api.nekos.fun:8080/api/" + endpoint) | ||
if r.status_code != 200: | ||
return("An error has occurred") | ||
else: | ||
return(r.json()["url"]) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import os | ||
import platform | ||
|
||
pip_install = 'pip install -U pip' | ||
packages = 'pip install -U nextcord requests' | ||
|
||
if platform.system == 'Windows': # if OS is Windows | ||
os.system('python.exe -m' + pip_install) | ||
|
||
elif platform.system=='Linux': # if OS is Linux | ||
os.system('python3 -m' + pip_install) | ||
|
||
os.system(packages) |