Passed
Pull Request — main (#114)
by
unknown
01:30
created

run.Bot.load_cogs()   A

Complexity

Conditions 2

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 3
dl 0
loc 6
rs 10
c 0
b 0
f 0
cc 2
nop 1
1
from glob import glob
2
3
from pincer import Client
4
5
6
class Bot(Client):
7
    def __init__(self, *args, **kwargs):
8
        self.load_cogs()
9
        super().__init__(*args, **kwargs)
10
11
    def load_cogs(self):
12
        """
13
        Load all cogs from the `cogs` directory.
14
        """
15
        for cog in glob("cogs/*.py"):
16
            self.load_cog(cog.replace("/", ".").replace("\\", ".")[:-3])
17
18
19
if __name__ == "__main__":
20
    Bot("XXXYOURBOTTOKENHEREXXX").run()
21