-
Notifications
You must be signed in to change notification settings - Fork 0
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
Showing
5 changed files
with
49 additions
and
9 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 |
---|---|---|
@@ -0,0 +1,14 @@ | ||
from discord.ext import commands | ||
|
||
class Test(commands.Cog): | ||
|
||
def __init__(self, bot): | ||
self.bot = bot | ||
|
||
@commands.command() | ||
@commands.bot_has_permissions(send_messages=True) | ||
async def ping(self, ctx): | ||
await ctx.send('pong') | ||
|
||
def setup(bot): | ||
bot.add_cog(Test(bot)) |
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,31 @@ | ||
import os, discord | ||
from discord.ext import commands | ||
|
||
bot = commands.Bot(command_prefix='q!') | ||
|
||
@bot.event | ||
async def on_ready(): | ||
for cog in [cog.replace('.py', '') for cog in os.listdir('cogs') if '.py' in cog]: | ||
await bot.change_presence(activity=discord.Game(name=f'loading cogs.{cog}')) | ||
print(f'loading cogs.{cog}') | ||
try: | ||
bot.load_extension(f'cogs.{cog}') | ||
except Exception as e: | ||
await bot.change_presence(activity=discord.Game(name=f'error loading cogs.{cog}!')) | ||
print(f'error loading cogs.{cog}!') | ||
raise e | ||
await bot.change_presence(activity=discord.Game(name='Message me "q!help" for info')) | ||
|
||
@bot.event | ||
async def on_command_error(ctx, error): | ||
if isinstance(error, commands.CommandNotFound): | ||
print(f'{error}') | ||
return | ||
if isinstance(error, commands.CheckFailure): | ||
print(f'{error} ({ctx.invoked_with})') | ||
return | ||
await ctx.send(f'`ERROR: {error}`') | ||
raise error | ||
|
||
def run(): | ||
bot.run(os.getenv('TOKEN')) |
File renamed without changes.
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 |
---|---|---|
@@ -1,10 +1,5 @@ | ||
from keep_alive import keep_alive | ||
import data | ||
from core.keep_alive import keep_alive | ||
from core.bot import run | ||
|
||
records = data.get('TEST') | ||
records.append({'test': 'g', 'test1': 'h'}) | ||
records[1]['fsd'] = 'q' | ||
print(records) | ||
data.set('TEST', records) | ||
|
||
keep_alive() | ||
keep_alive() | ||
run() |