async def hanime(self, ctx: Context, *, query: str = ''): """Searches hanime for hentai""" if query == '': return await self.hanimerandom.invoke(ctx) data = await self.hanime_search(query) if len(data) == 0: await ctx.send(f"No hentai found for query `{query}`") return embeds = [ discord.Embed( colour=Colour.gold(), title=hentai['name'], description=re.sub(r'<.+?>', '', hentai['description']) ).set_author( name=f"Result for search {query}", url="https://hanime.tv/videos/hentai/"+hentai['slug'] ).set_image( url=hentai['cover_url'] ).add_field( name="tags", value=", ".join(hentai['tags']) ).set_footer( text=f"{hentai['views']} views | " f"{hentai['likes']} likes & {hentai['dislikes']} dislikes" ) for hentai in data ] menu = DefaultMenu() await menu.send_pages(ctx, ctx, embeds)
async def hanimerandom(self, ctx: Context): data = await self.hanime_random() embeds = [ discord.Embed( colour=Colour.gold(), description=f"{hentai['views']} views\n" f"{hentai['likes']} likes & {hentai['dislikes']} dislikes" ).set_author( name=hentai['name'], url="https://hanime.tv/videos/hentai/"+hentai['slug'] ).set_image( url=hentai['cover_url'] ).set_footer( text=f"page: {i}/{len(data)}" ) for i,hentai in enumerate(data, 1) ] menu = DefaultMenu() await menu.send_pages(ctx, ctx, embeds)
async def booru(self, ctx: Context, *tags: str): """Returns a random hot image from the danbooru website Can take in tags that limits what images can be returned. Note that the bot allows more than 2 tags, but those will only be used for filtering. That means you the first 2 tags should be the main ones and the other should only be minor filter ones. https://danbooru.donmai.us/wiki_pages/help:cheatsheet """ posts = await self.search_danbooru(tags) if len(posts) == 0: await ctx.send( f"No posts were returned for `{' '.join(tags)}`\n" f"This may be because the tag doesn't exist or " f"the combination of tags does not have any posts.") return embeds = [ discord.Embed( description=f"result for search: `{' '.join(tags)}`", color=discord.Colour.red() ).set_author( name="danbooru", url="https://danbooru.donmai.us/posts?tags="+'+'.join(tags), icon_url="https://danbooru.donmai.us/images/danbooru-logo-500x500.png" ).add_field( name=f"{post['tag_count_general']} tags", value=textwrap.shorten(post['tag_string_general'], 1024) ).add_field( name=f"rating: {post['rating']}", value='\u200b' ).set_image( url=post['file_url'] ).set_footer( text=f"id: {post['id']} | character: {post['tag_string_character']} | artist: {post['tag_string_artist']}" ) for post in posts ] menu = DefaultMenu() await menu.send_pages(ctx, ctx, embeds)
async def activity(self, ctx: Context, member: Member = None): """Shows the activity of a member.""" member = member or ctx.author # type: ignore if member.activity is None: embed = discord.Embed( colour=discord.Colour.red(), title=f"{member.display_name} does not have any activity" ).set_author( name=member, url=member.avatar_url ) await ctx.send(embed=embed) return embeds = [] for activity in member.activities: if isinstance(activity, discord.Spotify): progress = datetime.now().astimezone() - utc_as_timezone(activity.start) embed = discord.Embed( colour=activity.colour, title=activity.title, description=f"By: {activity.artist}\n" f"On: {activity.album}" ).set_thumbnail( url=activity.album_cover_url ).add_field( name="Progress", value=f"{progress.seconds // 60}:{progress.seconds % 60:02d} / " f"{activity.duration.seconds // 60}:{activity.duration.seconds % 60:02d}" ) elif isinstance(activity, discord.Activity): if activity.details: embed = discord.Embed( colour=discord.Colour.blurple(), title=activity.details, description=activity.state ).set_author( name=f"{activity.type.name.title()} {activity.name}", icon_url=activity.small_image_url or discord.Embed.Empty, url=activity.url or discord.Embed.Empty ) else: embed = discord.Embed( colour=discord.Colour.blurple(), title=f"{activity.type.name.title()} {activity.name}", ) embed.set_thumbnail( url=activity.large_image_url or discord.Embed.Empty ) if activity.start: elapsed = datetime.now().astimezone() - utc_as_timezone(activity.start) embed.add_field( name="Elapsed:", value=f"{elapsed.seconds // 3600}:{elapsed.seconds % 3600 // 60}:{elapsed.seconds % 60}" ) elif isinstance(activity, discord.CustomActivity): embed = discord.Embed( colour=discord.Colour.gold(), description=f"**{activity.emoji}** {activity.name}" ) else: self.logger.error(f"{activity=}") continue embed.set_footer( text=f'Activity of {member}', icon_url=member.avatar_url ) embeds.append(embed) menu = DefaultMenu() await menu.send_pages(ctx, ctx, embeds)
from cogs.math import math from cogs.meme import meme from cogs.moderation import moderation from cogs.music import music from cogs.photo import photo from cogs.starboard import starboard from cogs.qtopia import qtopia from cogs.quiz import quiz from cogs.tictactoe import tictactoe from cogs.timezone import timezone # Get Members intent intents = discord.Intents.all() # Configure help menu menu = DefaultMenu(page_left="⬅️", page_right="➡️") # Configure the bot BOT_TOKEN = os.getenv("BOT_TOKEN") bot = commands.Bot( command_prefix=["luci ", "Luci "], case_insensitive=True, strip_after_prefix=False, intents=intents, self_bot=False, owner_id=707557256220115035, help_command=PrettyHelp(color=0xf34949, sort_commands=True), description="A General-Purpose Discord Bot Created by luciferchase#6310") # Set up logging logging.basicConfig(level=logging.WARNING)
bot = commands.AutoShardedBot(case_insensitive=True, command_prefix=mixedCase("sb!"), help_command=PrettyHelp()) bot.help_command = PrettyHelp() #cog loading bot.add_cog(Bal(bot)) bot.add_cog(Bet(bot)) bot.add_cog(Add(bot)) bot.add_cog(Ping(bot)) bot.add_cog(Sharding(bot)) bot.add_cog(Remove(bot)) bot.add_cog(Close(bot)) ending_note = "{ctx.bot.user.name}\nLieutenantLark, 2021" nav = DefaultMenu(page_left="⬅️", page_right="➡️", remove="🇽") color = discord.Color.dark_gold() bot.help_command = PrettyHelp(no_description="E", navigation=nav, color=color, active_time=10, ending_note=ending_note) @bot.event async def on_ready(): print('Logged on as', bot.user.name, 'with id', bot.user.id) status_change.start() @tasks.loop(minutes=10)
M = "Minecraft" D = "Doom" V = "Valorant" DCP = "Developer Changelog Ping" #---------- intents = discord.Intents.default() intents.members = True intents.presences = True client = discord.Client(intents=intents) client = discord.Client bot = commands.Bot(command_prefix='?', intents = intents) bot.remove_command('help') DiscordComponents(bot) #------------------------------------------------- ending_note = f"Running CUBEBOT {BotVerson}" nav = DefaultMenu() color = discord.Color.dark_gold() bot.help_command = PrettyHelp(active_time=120, color=color, ending_note=ending_note, index_title="Commands", show_index=True, sort_commands=False ) #------------------------------------------------- @bot.event async def on_member_join(member): channel = discord.utils.get(member.guild.channels, name="joins") embed = discord.Embed(title = 'User Has Joined the Server:sunglasses:', description = f'\n{member} has joined us!' + f'\n\nRunning CUBEBOT {BotVerson}', color = 0xC0C0C0) await channel.send(embed = embed) role = get(member.guild.roles, name=ROLEc)
""" Note: Rename `env.example` to `.env` and enter your token then run `poetry run test` in your terminal """ import os from discord.ext import commands from pretty_help import DefaultMenu, PrettyHelp import dotenv dotenv.load_dotenv("./tests/.env") # ":discord:743511195197374563" is a custom discord emoji format. Adjust to match your own custom emoji. menu = DefaultMenu( "\U0001F44D", "👎", ":discord:743511195197374563", active_time=5, delete_after_timeout=True, ) # Custom ending note ending_note = "The ending note from {ctx.bot.user.name}\nFor command {help.clean_prefix}{help.invoked_with}" bot = commands.Bot( command_prefix="!", description="this is the bots descripton", ) bot.help_command = PrettyHelp(menu=menu, ending_note=ending_note) # bot.help_command = PrettyHelp(menu=menu, ending_note=ending_note, show_index=False)
data = data[0] return data description = "Check out our slash commands! Type `/` to bring up all of the slash commands! If you do not see any slash commands from country bot, then please kick country bot and use [this link to invite it again](https://discord.com/api/oauth2/authorize?client_id=810662403217948672&permissions=2048&scope=bot%20applications.commands)" bot = commands.Bot( command_prefix=get_prefix123, case_insensitive=True, help_command=None, description=description, ) slash = SlashCommand(bot, sync_commands=True) menu = DefaultMenu("◀️", "▶️", "❌") # You can copy-paste any icons you want. ending_note = "Type {help.clean_prefix}help command to get information on a command\nType {help.clean_prefix}help category to get information on a category\nPlease do not put text in <> or []\n<> = mandatory argument, [] = optional argument" bot.help_command = PrettyHelp( navigation=menu, color=discord.Colour.red(), ending_note=ending_note ) bot.topgg_webhook = topgg.WebhookManager(bot).dbl_webhook("/dblwebhook", "dbl_password") bot.topgg_webhook.run(4355) dbl_token = os.environ["TOPGGTOKEN"] bot.topggpy = topgg.DBLClient(bot, dbl_token, autopost=True, post_shard_count=True) @bot.event async def on_autopost_success():
bot.load_extension('cogs.moderation') bot.load_extension('cogs.invite-tracker') bot.load_extension('cogs.crypto') import logging logger = logging.getLogger('discord') logger.setLevel(logging.DEBUG) handler = logging.FileHandler(filename='discord.log', encoding='utf-8', mode='w') handler.setFormatter( logging.Formatter('%(asctime)s:%(levelname)s:%(name)s: %(message)s')) logger.addHandler(handler) nav = DefaultMenu(page_left="\U000025c0\U0000fe0f", page_right="\U000025b6\U0000fe0f" ) # Left And Right Arrows For Help Navigation. color = discord.Color.blue() bot.help_command = PrettyHelp(navigation=nav, color=color) # Initiziation Of Help Command @bot.event async def on_shard_ready(shard_id): print(f"Shard {shard_id} Ready!") @bot.event async def on_ready(): print(f"{bot.user} is ready")
settings = db["settings"] stonk = db["stonk"] centralbank = db["centralbank"] def get_prefix(client, message): server = settings.find_one({"gid": message.guild.id}) return server["prefix"] intents = discord.Intents.default() intents.members = True client = commands.Bot(command_prefix=get_prefix, description="Bot is here for your entertainment",case_insensitive=True, intents=intents) botcolour = 0x0fa4aab status = cycle(["with your luck", "with you | try !help"]) menu = DefaultMenu('◀️', '▶️', '❌') client.help_command = PrettyHelp(navigation=menu, index_title="Help", sort_commands=True, no_category="Owner", color=discord.Colour.blurple()) @client.event async def on_ready(): await client.change_presence(activity=discord.Game("with you | try !help")) # change_status.start() print('We have logged in as {0.user}'.format(client)) # @tasks.loop(minutes=11) # async def change_status():
import os import discord import asyncio import random import functions import requests from replit import db from discord.ext import commands from pretty_help import DefaultMenu, PrettyHelp activity = discord.Activity(type=discord.ActivityType.watching, name="you become Inorganic! | $help") bot = commands.Bot(command_prefix="$",activity=activity) nav = DefaultMenu("◀️", "▶️") bot.help_command = PrettyHelp(navigation=nav, color=discord.Colour.green()) # async def log(string,channelname=None,servername=None,membername=None): # await bot.get_channel(860153556883472434).send(string+ "by"+membername+"at"+(servername+channelname)) # from discord.ext.commands import CommandNotFound # @bot.event # async def on_command_error(ctx, error): # if isinstance(error, CommandNotFound): # await log(("Command not found error encountered by"+" on command "+" "+ ctx.message.content),(" " + ctx.guild.name + " "),(" "+ctx.channel.name+" "),ctx.author.name) # # print(ctx.message) # raise error # print(len(bot.guilds), bot.guilds)
import discord from discord.ext import commands from discord.utils import get import asyncio import random as r import datetime import images as imgs from io import BytesIO import aiohttp from cfg import TOKEN import youtube_dl import os from pretty_help import DefaultMenu, PrettyHelp menu = DefaultMenu(page_left="👍", page_right="👎", remove="a:python:837943828505559070", active_time=5) ending_note = "The end of {ctx.bot.user.name}'s help command." i = discord.Intents().all() bot = commands.Bot(command_prefix='!!', intents=i) bot.help_command = PrettyHelp(menu=menu, ending_note=ending_note) @bot.command() @commands.has_permissions(administrator=True) async def ping(ctx, member: discord.Member, *, t=10): """ping member by id(staff only)""" t = int(t) for i in range(t):
def __init__(self, bot: Bot): self.bot = bot self.menu = DefaultMenu()
""" Note: Rename `env.example` to `.env` and enter your token then run `poetry run test` in your terminal """ import os from discord.ext import commands from pretty_help import DefaultMenu, PrettyHelp import dotenv dotenv.load_dotenv("./tests/.env") # ":discord:743511195197374563" is a custom discord emoji format. Adjust to match your own custom emoji. menu = DefaultMenu("\U0001F44D", "👎", ":discord:743511195197374563") # Custom ending note ending_note = "The ending not from {ctx.bot.user.name}\nFor command {help.clean_prefix}{help.invoked_with}" bot = commands.Bot( command_prefix="!", description="this is the bots descripton", ) bot.help_command = PrettyHelp( menu=menu, ending_note=ending_note, ) @bot.event async def on_ready(): print(f"Logged in as: {bot.user.name}") print(f"With ID: {bot.user.id}")
from keep_alive import keep_alive from discord.ext import commands from pretty_help import DefaultMenu, PrettyHelp prefix = '_' def get_prefix(bot, message): prefixes = [prefix, '>>'] if not message.guild: return prefix return commands.when_mentioned_or(*prefixes)(bot, message) menu = DefaultMenu("◀️", "▶️", "❌", active_time=60) embed_colour = 0xf1c40f cmd_cd = 2 log_channel = 837542790119686145 bot = commands.AutoShardedBot(shard_count=2, command_prefix=get_prefix, owner_id=267550284979503104, case_insensitive=True, help_command=PrettyHelp(), self_bot=False) bot.help_command = PrettyHelp(menu=menu,
bot = commands.Bot(command_prefix=configuration.bot_prefix, intents=discord.Intents.all()) # To show the bot is ready! @bot.event async def on_ready(): print('bot is connected') # For this to work, use (pip install discord-pretty-helper) I use this to save some time from pretty_help import PrettyHelp, DefaultMenu menu = DefaultMenu('◀', '▶', '❌', active_time=2000) bot.help_command = PrettyHelp(menu=menu, no_category='Base Commands') # Base Command @bot.command(name="invite") async def invite(context): """ Sends an invite link to invite the bot to your server """ embed = discord.Embed( description= f"Invite the bot here: <https://discord.com/api/oauth2/authorize?client_id={configuration.application_id}&permissions=4294967287&scope=bot%20applications.commands>" )