Exemplo n.º 1
0
 def __init__(self, bot):
     self.bot = bot
     self.token = bot.config["githubkey"]
     self.bot.snipe = {}
     self.bot.editsnipe = {}
     self.mystbin = mystbin.Client()
     self.cleverbot = async_cleverbot.Cleverbot(
         self.bot.config['travitiakey'])
Exemplo n.º 2
0
    def __init__(self, bot: core.Bot):
        self.bot = bot
        self.cleverbot = cb = ac.Cleverbot(
            api_key=bot.config['travitia']['token'],
            session=bot.session,
            context=ac.DictContext())

        cb.emotions = tuple(ac.Emotion)
Exemplo n.º 3
0
 async def cleverbot(self, ctx, *, arg):
     if not functions.check(ctx, "fun", "cleverbot"):
         e = discord.Embed(title="Nie masz uprawnień", description="Nie posiadasz uprawnień `fun.cleverbot`", color=discord.Color.red())
         e.set_footer(text="Uprawnienie administratora może edytować permisje do różnych ról (komenda perm)")
         return await ctx.send(embed=e)
   
     cb = ac.Cleverbot(config.cleverbot)
     async with ctx.typing():
         response = await cb.ask(arg)
         await ctx.send(response.text)
Exemplo n.º 4
0
    async def on_message(self, msg):
        if msg.author.bot:
            return

        with open("cleverbot.json", "r") as f:
            cleverbot = json.load(f)

            if str(msg.guild.id) in cleverbot:
                if msg.channel.id == cleverbot[str(msg.guild.id)]:
                    cb = ac.Cleverbot(config.cleverbot)
                    async with msg.channel.typing():
                        response = await cb.ask(msg.content)
                        await msg.channel.send(response.text)
Exemplo n.º 5
0
    async def chatbot(self,
                      ctx: utils.CustomContext,
                      emotion: EmotionConverter = None):
        """Starts an interactive session with the chat bot.
        Type `cancel` to quit talking to the bot."""

        cb = async_cleverbot.Cleverbot(
            self.bot.settings["keys"]["chatbot_api"])
        not_ended = True

        emotion = emotion or async_cleverbot.Emotion.neutral

        await ctx.send(
            "I have started a chat bot session for you, type away! Type `cancel` to end the session."
        )

        while not_ended:
            try:
                message = await self.bot.wait_for(
                    "message",
                    timeout=30.0,
                    check=lambda m: m.author == ctx.author and m.channel == ctx
                    .channel)
            except asyncio.TimeoutError:
                await cb.close()
                not_ended = False
                return await ctx.send(
                    "You took a very long time to talk to the bot, so I ended the session."
                )
            else:
                async with ctx.typing():
                    if message.content.lower() == "cancel":
                        await cb.close()
                        not_ended = False
                        return await ctx.send(
                            "Good bye! \N{SLIGHTLY SMILING FACE}")
                    response = await cb.ask(message.content,
                                            ctx.author.id,
                                            emotion=emotion)

                    try:
                        text = utils.owoify_text(
                            response.text) if self.bot.config[
                                ctx.guild.id]["owoify"] else response.text
                    except (KeyError, AttributeError):
                        text = response.text

                    await message.reply(text)
Exemplo n.º 6
0
 async def chatbot(self, ctx):
     em=discord.Embed(description="Alright! I've started the chatbot, you can now talk to him, to cancel use `chat stop`, `chat close` or `chat cancel`", color=color())
     await ctx.reply(embed=em, mention_author=False)
     cleverbot = ac.Cleverbot(get_config("CLEVERBOT"))
     while True:
         try:
             msg = await self.bot.wait_for("message", check=lambda msg: msg.author == ctx.author and msg.channel == ctx.channel, timeout=30)
         except asyncio.TimeoutError:
             em=discord.Embed(description="I've stopped the chatbot, as you've not been responding for 30 seconds", color=color())
             await msg.reply(embed=em, mention_author=False)
             break
         else:
             if msg.content.lower() in ["chat stop", "chat close", "chat cancel"]:
                 em=discord.Embed(description="Alright! I've successfully stopped the chatbot", color=color())
                 await msg.reply(embed=em, mention_author=False)
                 break
             else:
                 async with ctx.typing():
                     res = await cleverbot.ask(msg.content, msg.author.id)
                     await msg.reply(res.text, mention_author=False, allowed_mentions=discord.AllowedMentions.none())
     return
Exemplo n.º 7
0
 async def on_message(self, message):
     if message.author.bot:
         return
     else:
         if message.content == "dude":
             await message.channel.send(f"Hmm?")
         elif message.content == "dude help":
             await message.channel.send(
                 f"Hmm, I don't have any commands but you can talk with me using dude <message> and i will reply to you & to get info about me use `dude say about you`!"
             )
         elif message.content == "dude say about you":
             await message.channel.send(
                 "Hey there, im DudeAI made by mikeuwu#8307, actually im a chatbot you can spend your time with me if you are bored or feeling lonely, you can keep your server active with help of me. If you have any questions/queries or need to give suggestion or need to report a bug please dm mikeuwu#8307"
             )
         else:
             if message.content.startswith("dude "):
                 #if message.author.voice is None:
                 dude = ai.Cleverbot("e/!-F6*FBW'8vZJ8,=No",
                                     context=ai.DictContext())
                 text = await dude.ask(message.content)
                 await message.channel.send(text.text)
                 await dude.close()
             else:
                 return
Exemplo n.º 8
0
import discord, random, json, time, asyncio, random
from discord.ext import commands, menus
from discord.ext.commands.cooldowns import BucketType
from copy import deepcopy as dc
import async_cleverbot as ac

config = "tools/config.json"
with open(config) as f:
    data = json.load(f)
cb = data['CLEVERBOT']

cleverbot = ac.Cleverbot(cb)


def rps_winner(userOneChoice, userTwoChoice):
    if userOneChoice == "\U0001faa8":
        if userTwoChoice == "\U00002702": return "You won!"
        if userTwoChoice == "\U0001faa8": return "Tie!"
        if userTwoChoice == "\U0001f4f0": return "I won!"
    elif userOneChoice == "\U00002702":
        if userTwoChoice == "\U00002702": return "Tie!"
        if userTwoChoice == "\U0001faa8": return "I won!"
        if userTwoChoice == "\U0001f4f0": return "You Won!"
    elif userOneChoice == "\U0001f4f0":
        if userTwoChoice == "\U00002702": return "I won!"
        if userTwoChoice == "\U0001faa8": return "You won!"
        if userTwoChoice == "\U0001f4f0": return "Tie!"
    else: return "error"


class BasketballMenu(menus.Menu):
Exemplo n.º 9
0
    def __init__(self, **kwargs):
        super().__init__(
            command_prefix=get_prefix,
            case_insensitive=True,
            # case_insensitive_prefix=True,
            status=discord.Status.dnd,
            activity=discord.Activity(type=discord.ActivityType.competing, name='a boot up challenge'),
            owner_id=345457928972533773,
            reconnect=True,
            allowed_mentions=discord.AllowedMentions(users=False, roles=False, everyone=False, replied_user=True),
            max_messages=10000,
            chunk_guilds_at_startup=True,  # this is here for easy access. In case I need to switch it fast to False I won't need to look at docs.
            intents=discord.Intents(
                guilds=True,  # guild/channel join/remove/update
                members=True,  # member join/remove/update
                bans=True,  # member ban/unban
                emojis=False,  # emoji update
                integrations=False,  # integrations update
                webhooks=False,  # webhook update
                invites=False,  # invite create/delete
                voice_states=True,  # voice state update
                presences=True,  # member/user update for games/activities
                guild_messages=True,  # message create/update/delete
                dm_messages=True,  # message create/update/delete
                guild_reactions=True,  # reaction add/remove/clear
                dm_reactions=True,  # reaction add/remove/clear
                guild_typing=False,  # on typing
                dm_typing=False,  # on typing
            )
        )

        self.config = config

        for extension in config.EXTENSIONS:
            try:
                self.load_extension(extension)
                print(f'[EXTENSION] {extension} was loaded successfully!')
            except Exception as e:
                print(f'[WARNING] Could not load extension {extension}: {e}')

        self.db = kwargs.pop("db")
        self.cmdUsage = {}
        self.cmdUsers = {}
        self.guildUsage = {}
        self.process = psutil.Process()

        self.support = 'https://discord.gg/f3MaASW'
        self.invite = 'https://dredd-bot.xyz/invite'
        self.privacy = '<https://gist.github.com/TheMoksej/02671c21451843d8186e718065b731ee>'
        self.license = '<https://github.com/TheMoksej/Dredd/blob/master/LICENSE>'
        self.gif_pfp = 'https://cdn.discordapp.com/attachments/667077166789558288/747132112099868773/normal_3.gif'
        self.vote = '<https://discord.boats/bot/667117267405766696/vote>'
        self.source = '<https://github.com/TheMoksej/Dredd/>'
        self.statuspage = '<https://status.dredd-bot.xyz>'
        self.bot_lists = {'dbots': "[Discord Bot Labs](https://dbots.cc/dredd 'bots.discordlabs.org')", 'dboats': "[Discord Boats](https://discord.boats/bot/667117267405766696/vote 'discord.boats')",
                          'dbl': "[Discord Bot list](https://discord.ly/dredd/upvote 'discordbotlist.com')", 'shitgg': "[Top.GG](https://top.gg/bot/667117267405766696/vote 'top.gg')"}
        self.cleverbot = ac.Cleverbot(config.CB_TOKEN)
        self.join_counter = Counter()  # counter for anti raid so the bot would ban the user if they try to join more than 5 times in short time span

        self.cache = CacheManager
        self.cmd_edits = {}
        self.dm = {}
        self.dms = {}  # cache for checks if user was already informed about dm logging
        self.updates = {}
        self.snipes = {}
        self.sr_api = sr_api.Client()

        self.guilds_data = {}
        self.loop = asyncio.get_event_loop()
        self.guild_loop = {}
        self.to_dispatch = {}
        self.music_guilds = {}

        # ranks
        self.devs = {}
        self.admins = {}
        self.boosters = {}
        self.lockdown = False
        self.auto_reply = True
        self.settings = {}
        self.blacklist = {}
        self.check_duration = {}

        # guilds / moderation
        self.prefix = {}
        self.moderation = {}
        self.memberlog = {}
        self.joinlog = {}
        self.leavelog = {}
        self.guildlog = {}
        self.joinrole = {}
        self.joinmessage = {}
        self.leavemessage = {}
        self.messageedits = {}
        self.messagedeletes = {}
        self.antihoist = {}
        self.automod = {}
        self.massmention = {}
        self.masscaps = {}
        self.invites = {}
        self.links = {}
        self.spam = {}
        self.modlog = {}
        self.raidmode = {}
        self.temp_bans = {}
        self.temp_mutes = {}
        self.mute_role = {}
        self.mod_role = {}
        self.admin_role = {}
        self.channels_whitelist = {}
        self.roles_whitelist = {}
        self.guild_disabled = {}
        self.cog_disabled = {}
        self.case_num = {}
        self.rr = {}

        # other
        self.afk = {}
        self.status_op = {}
        self.snipes_op = {}
        self.nicks_op = {}
        self.badges = {}
        self.disabled_commands = {}
        self.translations = {}
        self.reminders = {}
Exemplo n.º 10
0
 def __init__(self, bot):
     self.bot = bot
     self.cleverbot = ac.Cleverbot("Your TravitiaAPI Key")
     self.cleverbot.set_context(ac.DictContext(self.cleverbot))
Exemplo n.º 11
0
 def __init__(self, bot):
     self.bot = bot
     self.bot.chatbot = ac.Cleverbot(Tokens.chatbot.value)
     self.description = "Play some amazing games"
Exemplo n.º 12
0
 def __init__(self, bot):
     self.bot = bot
     self.x_r = ":warning:727013811571261540"
     self.clever = async_cleverbot.Cleverbot(self.bot.config.cleverbot)
     self.clever.set_context(async_cleverbot.DictContext(self.clever))
Exemplo n.º 13
0
import discord, random, json, time, asyncio, aiohttp
from discord.ext import commands, menus
from discord.ext.commands.cooldowns import BucketType
import asyncio
import random
from copy import deepcopy as dc
import async_cleverbot as ac

tools = "tools/tools.json"
with open(tools) as f:
    data = json.load(f)
footer = data['FOOTER']
color = int(data['COLOR'], 16)

cleverbot = ac.Cleverbot("45wE<Yk3dhd]B$$sTmO/")

def rps_winner(userOneChoice, userTwoChoice):
    if userOneChoice == "\U0001faa8":
        if userTwoChoice == "\U00002702": return "You won!"
        if userTwoChoice == "\U0001faa8": return "Tie!"
        if userTwoChoice == "\U0001f4f0": return "I won!"
    elif userOneChoice == "\U00002702":
        if userTwoChoice == "\U00002702": return "Tie!"
        if userTwoChoice == "\U0001faa8": return "I won!"
        if userTwoChoice == "\U0001f4f0": return "You Won!"
    elif userOneChoice == "\U0001f4f0":
        if userTwoChoice == "\U00002702": return "I won!"
        if userTwoChoice == "\U0001faa8": return "You won!"
        if userTwoChoice == "\U0001f4f0": return "Tie!"
    else: return "error"
Exemplo n.º 14
0
 def __init__(self, bot):
     self.bot = bot
     self.cb_client = ac.Cleverbot(TRAVITIA_TOKEN)
     self.cb_client.set_context(ac.DictContext(self.cb_client))
     self.cb_emotions = tuple(ac.Emotion)
     self._cd = CooldownMapping.from_cooldown(1.0, 5.0, BucketType.member)
Exemplo n.º 15
0
 def __init__(self, bot):
     self.bot = bot
     self.pypi_logo = "https://static1.squarespace.com/static/59481d6bb8a79b8f7c70ec19/594a49e202d7bcca9e61fe23/59b2ee34914e6b6d89b9241c/1506011023937/pypi_logo.png?format=1000w"
     self.clever = async_cleverbot.Cleverbot(bot.config.cleverbot)
     self.clever.set_context(async_cleverbot.DictContext(self.bot))
     self.http = CyberHTTP()
Exemplo n.º 16
0
 def __init__(self, client):
     self.client = client
     self.pypi = "https://raw.githubusercontent.com/github/explore/666de02829613e0244e9441b114edb85781e972c/topics/pip/pip.png"
     self.bot = async_cleverbot.Cleverbot(secrets()['cleverbot'])
     self.bot.set_context(async_cleverbot.DictContext(self.bot))
Exemplo n.º 17
0
 def __init__(self, bot):
     self.bot = bot
     api_key = os.getenv('CHATBOT_API_KEY')
     self.chat_bot = ac.Cleverbot(
         api_key, context=ac.DictContext()) if api_key else None
     self.is_talking = {}
Exemplo n.º 18
0
 def __init__(self, client):
     self.client = client
     self.x_r = ":warning:727013811571261540"
     self.bot = async_cleverbot.Cleverbot(secrets()['cleverbot'])
     self.bot.set_context(async_cleverbot.DictContext(self.bot))
Exemplo n.º 19
0
 def __init__(self, bot):
     self.bot = bot
     self.cleverbot = async_cleverbot.Cleverbot(
         self.bot.config['travitiakey'])
Exemplo n.º 20
0
from fuzzywuzzy import process

from jishaku.paginators import PaginatorInterface, WrappedPaginator

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)
load_dotenv()
TOKEN = os.getenv("DISCORD_TOKEN")

dagpi = Client(os.getenv("DAGPI_TOKEN"))
cleverbot = ac.Cleverbot(os.getenv("CHATBOT_TOKEN"))


client = aiozaneapi.Client(os.getenv("ZANE_TOKEN"))


async def get_prefix(bot, message):
    if message.guild is None:
        return "kb+"
    if message.guild.id in bot.prefixes.keys():
        return commands.when_mentioned_or(*bot.prefixes[message.guild.id])(bot, message)
    prefixes = await bot.pg.fetchval(
        "select prefixes from prefixes where guild_id = $1", message.guild.id
    )
    bot.prefixes[message.guild.id] = prefixes
    return commands.when_mentioned_or(*prefixes)(bot, message)
Exemplo n.º 21
0
bot.mystbin_client = mystbin.Client()
bot.version = "15"
START_BAL = 250
token = open("toke.txt", "r").read()
bot.load_extension("jishaku")
hce = bot.get_command("help")
hce.hidden = True
dagpitoken = open("asy.txt", "r").read()
robloxcookie = open("roblox.txt", "r").read()
topastoken = open("top.txt", "r").read()
chatbottoken = open("chat.txt", "r").read()
hypixel = open("hypixel.txt", "r").read()
bot.robloxc = f"{robloxcookie}"
bot.hypixel = f"{hypixel}"
bot.topken = f"{topastoken}"
bot.chatbot = ac.Cleverbot(f"{chatbottoken}")
bot.se = aiozaneapi.Client(f'{open("zane.txt", "r").read()}')
bot.dagpi = Client(dagpitoken)
bot.start_time = time.time()
bot.thresholds = (10, 25, 50, 100)





  



@bot.event
async def on_connect():
Exemplo n.º 22
0
 def __init__(self, bot):
     self.bot = bot
     self.cleverbot = ac.Cleverbot("lP/8s31p<L5S;+OrjL@W8s31p<L5S;+OrjL@Wy")
     self.cleverbot.set_context(ac.DictContext(self.cleverbot))
Exemplo n.º 23
0
 def __init__(self, client):
     self.client = client
     self.cleverbot = ac.Cleverbot(self.client.data["cbkey"])
     self.gapikey = self.client.data["gapikey"]
     self.cleverbot.set_context(ac.DictContext(self.cleverbot))
Exemplo n.º 24
0
 async def _make_cleverbot_session(self):
     cleverbot_session = ac.Cleverbot(await self._get_api_key(),
                                      context=ac.DictContext())
     return cleverbot_session