Пример #1
0
    def build_json(self):
        '''
        Convert daily calendar info to discord Embed json data
        '''
        if not self.ready: return []

        return [{
            'title':
            self.title,
            'description': (bible_url.html_convert(self.sections[''])
                            if '' in self.sections else ''),
            'color':
            self.color,
            'footer': {
                'text':
                'Revised Common Lectionary, Copyright © 1992 Consultation on Common Texts. Used by permission.'
            },
            'author': {
                'name': 'Revised Common Lectionary',
                'url': self.url
            },
            'fields': [{
                'name': key,
                'value': bible_url.html_convert(self.sections[key]),
                'inline': False
            } for key in self.sections if key]
        }]
Пример #2
0
    def build_json(self):
        '''
        Helper method to construct a list of Discord Embed json representing
        the calendar data.
        '''
        if not self.ready: return []

        return [{
            'title':
            self.title,
            # Would have used an f-string for the description,
            # but f-string expressions cannot include backslashes
            'description': (self.today.strftime(
                '[**Saints & Feasts**](https://www.oca.org/saints/all-lives/%Y/%m/%d)\n'
            ) + "\n".join(self.saints_feasts) + self.today.strftime(
                '\n[**Troparia and Kontakia**](https://www.oca.org/saints/troparia/%Y/%m/%d)'
            ) + '\n\n**The Scripture Readings**'),
            'footer': {
                'text': 'Copyright © Orthodox Church in America.'
            },
            'author': {
                'name': 'American Orthodox Lectionary',
                'url': self.url
            },
            'fields': [{
                'name': section[0],
                'value': bible_url.html_convert('\n'.join(section[1])),
                'inline': False
            } for section in self.readings]
        }]
Пример #3
0
    def build_embeds(self):
        '''
        "Public" function to construct a list of Discord Embeds representing
        the calendar data.
        '''
        if not self.ready: return []

        embeds = []

        # Title & Subtitles Embed
        embed = Embed(title=self.title)
        embed.set_author(name='Orthodox Calendar', url=self.url)
        embed.description = '\n'.join(self.subtitles)
        embeds.append(embed)

        # Saints Embed
        embed = Embed(title='The Saints')
        embed.description = '\n'.join(self.saints)
        embeds.append(embed)

        # Readings Embed
        embed = Embed(title='The Scripture Readings')
        embed.description = bible_url.html_convert(self.readings)
        embeds.append(embed)

        # Troparion Embed
        embed = Embed(title='Troparion')
        for saint in self.troparion.keys():
            embed.add_field(name=saint,
                            value=self.troparion[saint],
                            inline=False)
        embeds.append(embed)

        return embeds
Пример #4
0
    def build_embeds(self):
        '''
        Helper method to construct a list of Discord embeds based upon the
        data scraped from the daily readings webpages
        '''
        if not self.ready: return []

        embeds = []

        # For each page that was scraped
        for page in self.pages:
            embed = Embed(title=page.title)
            embed.set_author(name='Catholic Lectionary', url=page.url)
            embed.set_footer(text=page.footer)
            embed.description = page.desc

            # For each lectionary section on the page
            # Ex: Reading 1, Responsorial Psalm, Reading 2, Alleluia, Gospel
            for header in page.sections.keys():
                value = bible_url.html_convert(page.sections[header])
                embed.add_field(name=header, value=value, inline=False)

            # An embed for each page
            embeds.append(embed)

        return embeds
Пример #5
0
    def build_embeds(self):
        '''
        Function to convert daily lectionary info to discord.py Embed
        '''
        if not self.ready: return []

        embed = Embed(title=self.title)
        embed.set_author(name='Revised Common Lectionary', url=self.url)

        for key in self.sections.keys():
            if key == '':
                embed.description = bible_url.html_convert(self.sections[''])
            else:
                value = bible_url.html_convert(self.sections[key])
                embed.add_field(name=key, value=value, inline=False)

        return [embed]
Пример #6
0
    def build_embeds(self):
        if not self.ready: return []

        title = self.title + '\n' + self.desc
        embed = Embed(title=title)
        embed.set_author(name='Armenian Lectionary', url=self.url)

        temp = bible_url.html_convert(self.readings)
        if self.notes_url != '': temp += f"\n\n*[Notes]({self.notes_url})"
        embed.description = temp

        return [embed]
Пример #7
0
    def build_json(self):
        '''
        Public function to construct json representing
        the calendar entry.

        If the data isn't ready, an empty list is returned.
        '''
        if not self.ready: return []

        embeds = []

        # Title & Subtitles
        embeds.append({
            'title': self.title,
            'description': '\n'.join(self.subtitles),
            'author': {
                'name': 'Russian Orthodox Lectionary',
                'url': self.url
            }
        })

        # Saints & Feasts
        embeds.append({
            'title': 'Saints & Feasts',
            'description': '\n'.join(self.saints)
        })

        # Readings
        embeds.append({
            'title': 'The Scripture Readings',
            'description': bible_url.html_convert(self.readings)
        })

        # Troparion
        embeds.append({
            'title':
            'Troparion',
            'footer': {
                'text': '© Holy Trinity Russian Orthodox Church'
            },
            'fields': [{
                'name': saint,
                'value': self.troparion[saint],
                'inline': False
            } for saint in self.troparion]
        })

        return embeds
Пример #8
0
    def build_json(self):
        if not self.ready: return []

        return [{
            'title':
            self.title,
            'color':
            0xA68141,  # Golden brown
            'footer': {
                'text':
                'Copyright © 2017 Greek Orthodox Archdiocese of America.'
            },
            'thumbnail': {
                'url': self.icon_url
            },
            'author': {
                'name': 'Greek Orthodox Lectionary',
                'url': self.url
            },
            'fields': [{
                'name': self.fast[0],
                'value': self.fast[1],
                'inline': False
            }, {
                'name':
                'Saints & Feasts',
                'value':
                '\n'.join([f'• {item}' for item in self.saints_feasts]),
                'inline':
                False
            }, {
                'name':
                'Scripture Readings',
                'value':
                bible_url.html_convert('\n'.join(self.readings)),
                'inline':
                False
            }]
        }]
Пример #9
0
    def build_json(self):
        '''
        Helper method to construct a list of Discord embed json based on
        the data scraped from the daily readings webpages
        '''
        if not self.ready: return []

        embeds = []

        # For each page that was scraped
        for page in self.pages:
            embeds.append({
                'title':
                page.title,
                'description':
                page.desc,
                'color':
                self.color,
                'footer': {
                    'text': page.footer + '\nCopyright © USCCB.'
                },
                'author': {
                    'name': 'Catholic Lectionary',
                    'url': page.url
                },
                'fields': [
                    {
                        'name': header,
                        'value': bible_url.html_convert(page.sections[header]),
                        'inline': False
                    }
                    # For each lectionary section on the page
                    # Ex: Reading 1, Responsorial Psalm, Reading 2, Alleluia, Gospel
                    for header in page.sections
                ]
            })

        return embeds