GithubHelp home page GithubHelp logo

discordbotportaljp / daug.py Goto Github PK

View Code? Open in Web Editor NEW
6.0 6.0 3.0 112 KB

discord.py を利用した Discord Bot 向け機能拡張ライブラリ

Home Page: https://pypi.org/project/Daug/

Python 100.00%
discord discord-py python

daug.py's Introduction

daug.py's People

Contributors

1ntegrale9 avatar dependabot-preview[bot] avatar dependabot[bot] avatar yutarou12 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

daug.py's Issues

質問者が放置されているスレッドに気付く仕組みの導入

問題

スレッドには「質問者の対応待ち」と「回答待ち」の2つのステータスがあるが、
現状では回答待ちのスレッドに気付きにくい。

対策案

  • 最終発言がスレッド作者だったらチャンネル名に旗の絵文字などを付けておく
  • 一定時間回答待ちであれば雑談などに通知する

スレッド作成時に、トピックが空のチャンネルが存在するとエラーになる

1ユーザが1チャンネルまでしか作成できない仕様があり、
チャンネルのトピックを参照する処理の中で、
トピックが空の場合に以下のエラーが発生する。

Ignoring exception in on_message
Traceback (most recent call last):
  File "/app/.heroku/python/lib/python3.8/site-packages/discord/client.py", line 343, in _run_event
    await coro(*args, **kwargs)
  File "/app/.heroku/python/lib/python3.8/site-packages/Daug/cogs/thread.py", line 165, in on_message
    await self.dispatch_thread(message)
  File "/app/.heroku/python/lib/python3.8/site-packages/Daug/cogs/thread.py", line 45, in dispatch_thread
    if channels := [ch for ch in category_open.text_channels if str(message.author.id) in ch.topic]:
  File "/app/.heroku/python/lib/python3.8/site-packages/Daug/cogs/thread.py", line 45, in <listcomp>
    if channels := [ch for ch in category_open.text_channels if str(message.author.id) in ch.topic]:
TypeError: argument of type 'NoneType' is not iterable

短い質問文は直接タイトルに反映する

  • 30文字以内であれば、そのままタイトルに反映してISSUES側の質問は削除
  • タイトル設定も要求せずスレッド側で立てたことをメンション通知
  • 30文字以上であれば従来通りの仕様

ISSUESに1文で質問する文化が形成されてそれを真似られるのをシステムで撲滅する

AttributeError: 'NoneType' object has no attribute 'name'

エラー内容

2020-09-29T18:05:02.983059+00:00 app[discordbot.1]: Ignoring exception in on_message
2020-09-29T18:05:02.983350+00:00 app[discordbot.1]: Traceback (most recent call last):
2020-09-29T18:05:02.983665+00:00 app[discordbot.1]:   File "/app/.heroku/python/lib/python3.8/site-packages/discord/client.py", line 312, in _run_event
2020-09-29T18:05:02.983667+00:00 app[discordbot.1]:     await coro(*args, **kwargs)
2020-09-29T18:05:02.983894+00:00 app[discordbot.1]:   File "/app/.heroku/python/lib/python3.8/site-packages/Daug/cogs/thread.py", line 154, in on_message
2020-09-29T18:05:02.983896+00:00 app[discordbot.1]:     if self.is_category_closed(channel):
2020-09-29T18:05:02.987561+00:00 app[discordbot.1]:   File "/app/.heroku/python/lib/python3.8/site-packages/Daug/cogs/thread.py", line 71, in is_category_closed
2020-09-29T18:05:02.987562+00:00 app[discordbot.1]:     if '✅' in channel.category.name:
2020-09-29T18:05:02.987642+00:00 app[discordbot.1]: AttributeError: 'NoneType' object has no attribute 'name'

Cogのパッケージ化

以下の2点を理由としてパッケージ化を行う

  • Heroku へのデプロイ時に submodule がコケるので
  • メンバー自由にチャンネルを作成できるCogとして再利用可能に

チャンネル上限数対策で削除するスレッドのログを残す

  1. サーバーに「過去ログ」というチャンネルを作って削除した内容を全て投下していく
  2. ログ専用のサーバーを用意して、チャンネルも分けてコピーしていく
  3. ログを残さない

懸念事項

  • 利用規約や倫理的にログを残すのはアリか?
    • 告知・周知させた上で、Discord内に全員が見える場所に複製するのはセーフ?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.