Skip to main content

samebotのplugin

Project description

インストール

win:
py -3 -m pip install samep
linux:
python3.8 -m pip install samep

追加項目

メインファイル

#main.py

from discord.ext import commands as c
from discord import Intents
from asyncpgw import start

import asyncio

class Main(c.Bot):
    def __init__(self):
        super().__init__(
            command_prefix = '!',
            description = 'this is bot',
            intents = Intents.all()
            )

        self.tables = []

    async def ps_connect(self):
        "postgresqlに接続"
        self.pool = await start.connect('postgres://username:password@/dbname')


    async def add_table(self, table):
        """postgtesqlに作成するテーブルを追加する"""
        if table not in self.tables:
            self.tables.append(table)


    async def on_ready(self):
        print('起動しました。')

        self.load_extension('samep.extension')

        for table in self.tables:
            await start.create(self.pool, table)


    async def start(self):

        await super().start('bot token')


    def main(self):
        loop = asyncio.get_event_loop()
        loop.run_until_complete(self.ps_connect())
        loop.run_until_complete(self.start())
        loop.close()


if __name__ == '__main__':
    bot = Main()
    bot.main()

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

samep-0.0.5.tar.gz (17.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

samep-0.0.5-py3-none-any.whl (22.1 kB view details)

Uploaded Python 3

File details

Details for the file samep-0.0.5.tar.gz.

File metadata

  • Download URL: samep-0.0.5.tar.gz
  • Upload date:
  • Size: 17.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.50.2 CPython/3.8.5

File hashes

Hashes for samep-0.0.5.tar.gz
Algorithm Hash digest
SHA256 0babe109201e9f8b4d607ebde7c61592055e22ffe755e7ace6f7a8510e3c5f7a
MD5 ad81e5aaf5b9fc92d47868fab656d358
BLAKE2b-256 571fdbdd226ce97b798eddd64e8cf441bf30038d92c218fa3eff206a9d6b1742

See more details on using hashes here.

File details

Details for the file samep-0.0.5-py3-none-any.whl.

File metadata

  • Download URL: samep-0.0.5-py3-none-any.whl
  • Upload date:
  • Size: 22.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.50.2 CPython/3.8.5

File hashes

Hashes for samep-0.0.5-py3-none-any.whl
Algorithm Hash digest
SHA256 408539102a11d03fd10d6e597af716ee21bef586edb1a413716f557967049a4c
MD5 e93ac539783a7e9b064d8636134ea155
BLAKE2b-256 73c0c474e2936ffd47d6e42107ff09f9c5fa99a7d2d15c7caf8237a7615b3c51

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page