I realized having to host this potentially indefinitely might not be the best idea, so I am going to shut down this gitea instance eventually.
You’ll have time, at least until the end of 2022, probably longer, but please just get all your stuff somewhere safe in case we ever disappear.
If any of your build scripts rely on my (kageru’s) projects hosted here, check my Github or IEW on Github for encoding projects. If you can’t find what you’re looking there, tell me to migrate it.

Uploading JuicyBot Base v0.0.1

master
juicy 3 years ago
parent 67ebd2071f
commit edd8fcc9ad

3
.idea/.gitignore vendored

@ -0,0 +1,3 @@
# Default ignored files
/shelf/
/workspace.xml

@ -0,0 +1,19 @@
<component name="ProjectDictionaryState">
<dictionary name="cekey">
<words>
<w>cooldown</w>
<w>couldn</w>
<w>dataframe</w>
<w>emoji</w>
<w>gamertag</w>
<w>platformid</w>
<w>playerdata</w>
<w>playerid</w>
<w>psyonix</w>
<w>qqfcwij</w>
<w>racker</w>
<w>rlstats</w>
<w>xbox</w>
</words>
</dictionary>
</component>

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="PYTHON_MODULE" version="4">
<component name="NewModuleRootManager">
<content url="file://$MODULE_DIR$">
<excludeFolder url="file://$MODULE_DIR$/.idea" />
</content>
<orderEntry type="jdk" jdkName="Python 3.7 (untitled)" jdkType="Python SDK" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>

@ -0,0 +1,6 @@
<component name="InspectionProjectProfileManager">
<settings>
<option name="USE_PROJECT_PROFILE" value="false" />
<version value="1.0" />
</settings>
</component>

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.7 (untitled)" project-jdk-type="Python SDK" />
</project>

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/discordbotto.iml" filepath="$PROJECT_DIR$/.idea/discordbotto.iml" />
</modules>
</component>
</project>

Binary file not shown.

@ -0,0 +1,65 @@
from discord.ext import commands
from config import cogs
import configloader
class Admin(commands.Cog):
def __init__(self, bot):
self.bot = bot
async def cog_check(self, ctx):
return await ctx.bot.is_owner(ctx.author)
@commands.command(description='Shows existing Cogs',
usage=f'{configloader.__prefix__}cogs',
hidden=True)
@commands.cooldown(1, 2, commands.BucketType.user)
async def cogs(self, ctx):
await ctx.send(cogs.__cogs__)
@commands.command(name='load',
description='Loads a Module',
usage=f'{configloader.__prefix__}load <cog>',
hidden=True)
@commands.cooldown(1, 2, commands.BucketType.user)
async def load_cog(self, ctx, cog):
try:
self.bot.load_extension(f"commands.{cog}")
except Exception as err:
print(f"{cog} couldn't be loaded")
raise err
else:
await ctx.send(f'{cog} : Successfully loaded')
@commands.command(name='unload',
description='Unloads a Module',
usage=f'{configloader.__prefix__}unload <cog>',
hidden=True)
@commands.cooldown(1, 2, commands.BucketType.user)
async def unload_cog(self, ctx, cog):
try:
self.bot.unload_extension(f"commands.{cog}")
except Exception as err:
print(f"{cog} : couldn't be unloaded")
raise err
else:
await ctx.send(f'{cog} : Successfully unloaded')
@commands.command(name='reload',
description='Reloads a Module',
usage=f'{configloader.__prefix__}reload <cog>',
hidden=True)
@commands.cooldown(1, 2, commands.BucketType.user)
async def reload_cog(self, ctx, cog):
try:
self.bot.unload_extension(f"commands.{cog}")
self.bot.load_extension(f'commands.{cog}')
except Exception as err:
print(f"'{cog} : couldn't be reloaded")
raise err
else:
await ctx.send(f'{cog} : Successfully reloaded')
def setup(bot):
bot.add_cog(Admin(bot))

@ -0,0 +1,12 @@
from discord.ext import commands
import configloader
class Help(commands.Cog):
def __init__(self, bot):
pass
def setup(bot):
bot.remove_command("help")
bot.add_cog(Help(bot))

@ -0,0 +1,5 @@
__cogs__ = [
'commands.admin',
'commands.help',
'handlers.errorHandling'
]

@ -0,0 +1,4 @@
__token__ = "YOUR TOKEN"
__prefix__ = "!"
__greet_channel__ = "YOUR GREET CHANNEL ID"
__api_key__ = ""

@ -0,0 +1,11 @@
from config.cogs import __cogs__
from utils import embed
try:
from config.config import __token__, __prefix__, __greet_channel__, __api_key__
except ImportError:
import os
__token__ = os.environ.get('DISCORD_TOKEN')
__prefix__ = os.environ.get('DISCORD_PREFIX')
__greet_channel__ = os.environ.get('DISCORD_GREET_CHANNEL')
__api_key__ = os.environ.get('DISCORD_API_KEY')

Binary file not shown.

@ -0,0 +1,41 @@
import traceback
import sys
from discord.ext import commands
import discord
import configloader
class ErrorHandler(commands.Cog):
def __init__(self, bot):
self.bot = bot
@commands.Cog.listener()
async def on_command_error(self, ctx, error):
bot_app_info = await self.bot.application_info()
ignore_error = (commands.CommandNotFound, commands.UserInputError)
if isinstance(error, ignore_error):
return
elif isinstance(error, commands.CommandOnCooldown):
embed = configloader.embed.messageEmbed(f"This command is ratelimited, please try again in",
"{:.2f}s".format(error.retry_after),
f"{bot_app_info.owner}", f"{bot_app_info.icon_url}")
return await ctx.send(embed=embed)
elif isinstance(error, commands.NoPrivateMessage):
try:
embed = configloader.embed.messageEmbed(f"This Command can't be used in Private Messages.",
"{:.2f}s".format(ctx.command),
f"{bot_app_info.owner}", f"{bot_app_info.icon_url}")
return await ctx.author.send(embed=embed)
except:
pass
elif isinstance(error, commands.MissingPermissions):
embed = configloader.embed.messageEmbed(f"You don't have Permissions to use this command",
"{:.2f}s".format(ctx.command),
f"{bot_app_info.owner}", f"{bot_app_info.icon_url}")
return await ctx.send(embed=embed)
def setup(bot):
bot.add_cog(ErrorHandler(bot))

@ -0,0 +1,60 @@
import discord
from discord.ext import commands
import sqlite3
import configloader
import random
import logging
from logging.handlers import RotatingFileHandler
logger = logging.getLogger('discord')
logger.setLevel(logging.WARNING)
handler = RotatingFileHandler(filename='logs/bot.log', maxBytes=1024 * 5, backupCount=2, encoding='utf-8', mode='w')
handler.setFormatter(logging.Formatter('%(asctime)s:%(levelname)s:%(name)s: %(message)s'))
logger.addHandler(handler)
__version__ = '0.0.1'
bot = commands.Bot(command_prefix=configloader.__prefix__)
def Database(db):
with sqlite3.connect(db) as con:
c = con.cursor()
c.execute('''CREATE TABLE IF NOT EXISTS `users` (`name`,`id`, `platform`);''')
con.commit()
c.close()
@bot.event
async def on_ready():
bot_app_info = await bot.application_info()
print("------------------------------------")
print(f"Owner: {bot_app_info.owner}")
print(f"Bot-Name: {bot.user.name}")
print(f"Bot-ID: {bot.user.id}")
print(f"Bot Version: {__version__}")
print("------------------------------------")
for cog in configloader.__cogs__:
try:
bot.load_extension(cog)
print(f"{cog} loaded")
except Exception as err:
print(f"Couldn't load cog: {cog}")
raise err
Database("db/db.db")
await bot.change_presence(activity=discord.Activity(type=discord.ActivityType.watching, name="Juicy developing."))
@bot.event
async def on_member_join(member):
bot_app_info = await bot.application_info()
emoji = [':wink:', ':wave:', ':tada:']
channel = bot.get_channel(int(configloader.__greet_channel__))
guild = member.guild
embed = configloader.embed.messageEmbed(f"Willkommen bei {guild.name} {random.choice(emoji)}",
f"{member.mention}",
f"{bot_app_info.owner}", f"{bot_app_info.icon_url}")
await channel.send(embed=embed)
if __name__ == "__main__":
bot.run(configloader.__token__)

@ -0,0 +1,10 @@
2020-05-05 11:41:55,808:WARNING:discord.client: PyNaCl is not installed, voice will NOT be supported
2020-05-05 11:42:44,589:WARNING:discord.client: PyNaCl is not installed, voice will NOT be supported
2020-05-05 12:02:46,688:WARNING:discord.client: PyNaCl is not installed, voice will NOT be supported
2020-05-05 12:05:01,635:WARNING:discord.client: PyNaCl is not installed, voice will NOT be supported
2020-05-05 12:08:16,694:WARNING:discord.client: PyNaCl is not installed, voice will NOT be supported
2020-05-05 12:10:00,026:WARNING:discord.client: PyNaCl is not installed, voice will NOT be supported
2020-05-05 12:11:03,303:WARNING:discord.client: PyNaCl is not installed, voice will NOT be supported
2020-05-05 12:13:57,539:WARNING:discord.client: PyNaCl is not installed, voice will NOT be supported
2020-05-05 12:14:11,853:WARNING:discord.client: PyNaCl is not installed, voice will NOT be supported
2020-05-05 12:21:59,614:WARNING:discord.client: PyNaCl is not installed, voice will NOT be supported

@ -0,0 +1,3 @@
discord.py
pandas
requests

@ -0,0 +1,9 @@
import discord
from datetime import date
def messageEmbed(title, text, owner, icon):
embed = discord.Embed(color=0xffd540)
embed.add_field(name=f"{title}", value=f"{text}")
embed.set_footer(text=f"© {owner}{date.today()}", icon_url=f"{icon}")
return embed
Loading…
Cancel
Save