Skip to content

Commit 0f4b0f9

Browse files
committed
Move setup to init
1 parent af5c12f commit 0f4b0f9

2 files changed

Lines changed: 17 additions & 14 deletions

File tree

choose/__init__.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,22 @@
11
import json
22
from pathlib import Path
33

4+
from redbot.core.bot import Red
5+
6+
from .choose import Choose
7+
48
with open(Path(__file__).parent / "info.json") as fp:
59
__red_end_user_data_statement__ = json.load(fp)["end_user_data_statement"]
10+
11+
12+
async def setup(bot: Red) -> None:
13+
global old_choose
14+
old_choose = bot.get_command("choose")
15+
if old_choose:
16+
bot.remove_command(old_choose.name)
17+
18+
cog = Choose(bot)
19+
20+
r = bot.add_cog(cog)
21+
if r is not None:
22+
await r

choose/choose.py

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
import discord
66

77
from redbot.core import commands
8-
from redbot.core.bot import Red
98

109
log = logging.getLogger("red.raidensakura.choose")
1110

@@ -72,16 +71,3 @@ async def choose(self, ctx, *, options):
7271
return await ctx.send(
7372
"Oops, I encountered an error while trying to send the embed."
7473
)
75-
76-
77-
async def setup(bot: Red) -> None:
78-
global old_choose
79-
old_choose = bot.get_command("choose")
80-
if old_choose:
81-
bot.remove_command(old_choose.name)
82-
83-
cog = Choose(bot)
84-
85-
r = bot.add_cog(cog)
86-
if r is not None:
87-
await r

0 commit comments

Comments
 (0)