julia-discordbot

a discord bot originally written in julia and now in python

https://github.com/grsbe/julia-discordbot

Science Score: 31.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
    Found CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
  • DOI references
  • Academic publication links
  • Academic email domains
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (4.5%) to scientific vocabulary
Last synced: 6 months ago · JSON representation ·

Repository

a discord bot originally written in julia and now in python

Basic Info
  • Host: GitHub
  • Owner: grsbe
  • License: mit
  • Language: Python
  • Default Branch: main
  • Size: 70 MB
Statistics
  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • Open Issues: 0
  • Releases: 0
Created about 2 years ago · Last pushed 12 months ago
Metadata Files
Readme License Citation

README.md

Local Setup:

First time:
py -m venv venv
Windows: > venv\Scripts\activate Linux: $ . venv/bin/activate pip install requirements.txt

Linux:
$ . venv/bin/activate

Windows: (cmd in Scoreboard directory)
venv\Scripts\activate

pip install discord-py-interactions --upgrade

Server Setup:

Remove the build line in the docker compose file
Add the .key file in the db folder

Owner

  • Name: Tobi
  • Login: grsbe
  • Kind: user

Citation (citations.py)

from interactions import ChannelHistory, Extension
import os, time


class Citations(Extension):
    def __init__(self, bot):
        # do some initialization here
        self.zitate_channel = 844336088175607818


    async def async_start(self):
        print("trying to extract channel")
        chan = await self.bot.fetch_channel(self.zitate_channel)
        chanhist = ChannelHistory(chan, limit=50, before=None)
        messages = await chanhist.fetch()
        i=1
        with open('./db/messages.txt', 'w', encoding='utf-8') as f:
            for message in messages:
                f.write(f"{message.author.global_name} ; {message.timestamp} ; {message.content}\n")
        while True:
            i += 1
            if i % 20 == 0:
                print(f"Extracted {i * 50 * 20} messages")
            try:
                time.sleep(0.7) # to avoid the rate limit
                chanhist = ChannelHistory(chan, limit=50, before=messages[-1].id)
                messages = await chanhist.fetch()
                with open('./db/messages.txt', 'a', encoding='utf-8') as f:
                    for message in messages:
                        f.write(f"{message.author.global_name} ; {message.timestamp} ; {message.content}\n")
                if len(messages) < 50: # 1/50 chance to get fucked
                    break
            except:
                break
        print("done extracting channel")
        
            

GitHub Events

Total
  • Push event: 2
Last Year
  • Push event: 2