Passed
Push — main ( d9c4dc...ea73d7 )
by Yohann
01:08
created

pincer_bot.bot.Bot.__init__()   A

Complexity

Conditions 1

Size

Total Lines 6
Code Lines 5

Duplication

Lines 6
Ratio 100 %

Importance

Changes 0
Metric Value
cc 1
eloc 5
nop 3
dl 6
loc 6
rs 10
c 0
b 0
f 0
1
import os
0 ignored issues
show
introduced by
Missing module docstring
Loading history...
2
from glob import glob
3
from time import perf_counter
4
5
import dotenv
6
from pincer import Client
7
8
9 View Code Duplication
class Bot(Client):
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated in your project.
Loading history...
introduced by
Missing class docstring
Loading history...
10
11
    def __init__(self, *args, **kwargs):
12
        self.load_cogs()
13
14
        dotenv.load_dotenv('.env')
15
        super().__init__(token=os.environ.get('TOKEN'), *args, **kwargs)
16
        self.start_time = perf_counter()
17
18
    def load_cogs(self):
19
        """Load all cogs from the `cogs` directory."""
20
        for cog in glob("pincer_bot/cogs/*.py"):
21
            self.load_cog(cog.replace("/", ".").replace("\\", ".")[:-3])
22
            print("Loaded cogs from", cog)
23
24
    @Client.event
25
    async def on_ready(self):
0 ignored issues
show
introduced by
Missing function or method docstring
Loading history...
26
        print(
27
            f"Logged in as {self.bot} "
28
            f"after {perf_counter() - self.start_time:.3f} seconds."
29
        )
30